¿Cómo reproducir byteArray con formato flv en OSMF?

I am developing an web application in flex which have a feature of recording the runtime by having a snapshot of each frames then encoding it into a ByteArray for video playback.

I am currently using NetStream.appendBytes() for playing the ByteArray FLV. It is working, but I just found out about OSMF and thinking bout integrating it in my application.

It is it possible to play the flv byteArray in OSMF? An example on how can it be done would be totally great. thanks!

preguntado el 09 de enero de 11 a las 02:01

1 Respuestas

I am now able to play flv bytearrays in OSMF. Beforehand, I've already been able to play byteArray by creating a new class that extends netStream and overriding its play method to use appendbytes instead. So what I did was to make OSMF use it. I did this creating these classes: 1. ByteStreamElement - media element 2. ByteStreamLoader - extends LoaderBase 3. ByteStreamLoadTrait - extends LoadTrait

overriding netstremas seek/play method:

//manually dispatch seek event since we override seek()
dispatchEvent(new NetStatusEvent(NetStatusEvent.NET_STATUS,false,false, {code:"NetStream.Play.Seek", level:"status"})); 

//look for byte position based on _seekTime value
flvStream = _sfw.getFlvStream(false);  
_seekTime = parameters[1] * 1000; //netstream time in milliseconds
_flvParser.parse(flvStream, false, flvTagSeeker);
flvStream.position = _flvParserProcessed;

//append flvtag from the new byte position to end of flv byteArray 
var tmp:ByteArray = new ByteArray();
flvStream.readBytes(tmp, 0, flvStream.bytesAvailable);
_flvParserProcessed = 0;
this.appendBytesAction(NetStreamAppendBytesAction.RESET_SEEK);
appendBytes(tmp)  

Y usándolo así:

 mediaPlayerSprite = new MediaPlayerSprite();
 addChild(mediaPlayerSprite);
 mediaPlayerSprite.media = new  ByteStreamElement();

Im really not sure though if this is the best way to do it. Not sure if it is best that i created new classes or I should have written some sort of plugin for OSMF to use to play bytearrays. And another thing is that, what I really need is it to contiually appendbytes in the player in case needed. That's why Im still not using this and for the mean time Ill stick with my custom made "ByteStream player" until I figure this out.

Respondido el 14 de enero de 11 a las 07:01

Could you provide all the code you used for archieve that result? - Marcelo Asís

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.