views:

244

answers:

1

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)

A: 

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.

Michael Brewer-Davis