I have a flv video file. I loaded the binary data of this flv file to memory by using
var myFile:File = File.documentsDirectory.resolvePath("AIR Test/video.flv");
var myFileStream:FileStream = new FileStream();
myFileStream.open(myFile, FileMode.READ);
var **bytes**:ByteArray = new ByteArray();
myFileStream.readBytes(bytes);
myFileStream.close();
Now I'd like to change some header of this loaded flv in bytes memory variable, but after changing header, changed header was stored in bytes memory variable that is overwritten.
How can I play that flv file from this memory (bytes memory variable)?
One option would be to save the bytes as a temp file and then play back from the local filesystem.
// write to temp file
var f:File = File.createTempFile();
var fs:FileStream = new FileStream();
fs.open(f, FileMode.WRITE);
fs.writeBytes(bytes);
fs.close();
// play back
var display:VideoDisplay; // created somehow
display.source = f.url;
Not sure about some of the details (Does the temp file need a .flv extension? Does the source URL need to be the native path or some such?) but that approach should work within AIR.