Question

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 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.

now how can i play that flv file from this memory (bytes memory variable)

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top