Skip to main content
Participant
April 29, 2014
Question

Can`t play mp4 byte array as3

  • April 29, 2014
  • 3 replies
  • 2758 views

i`m getting mp4 as byte array from Socket server

I`m using append bytes to play video

netStream.play(null);
netStream.appendBytesAction(NetStreamAppendBytesAction.RESET_BEGIN);

netStream.appendBytes(recordByteArray);

But video wont play and even no meta data received.

If i play same video directly from url, there is no problem, but when i receive it from socket as byte array... didn`t work. With FLV byte array there is no problems.

Any help pls

This topic has been closed for replies.

3 replies

Participant
April 30, 2014

Do you know how to create a FLV File Header to mp4.

I`m using ffmpeg to convert avi to mp4, but can`t find nothing about 'creating flv file header'... Is there any tool or some..?

And my second question is,.. is there any way to play mp4 file from user localhost drive in flash player? I have installed service on user computer and can have file path or what necessary is.

If i can... i will skip part with appendBytes

Thanks for helping me.

Inspiring
April 30, 2014

1. If you want to play video via appendBytes easy way - you should encode it as flv and your current flow may work off the bat.

2. There is no way one can teach you in a forum post about flv file specs and how to deal with it. Please understand this is like asking to teach foreign language in few words.

Here are flv continer specifications if you want to learn them:

http://download.macromedia.com/f4v/video_file_format_spec_v10_1.pdf - as you can see there are 90 pages of dense information.

Again, by reverse engineering of the code in OSMF http adaptive streaming package you can learn how to construct correct FLV header, etc.

3. One can play mp4 from anywhere using NetStream conventional capabilities.

Inspiring
April 29, 2014

It is not that easy.

In very general (not very academic) terms you first need to trick Flash into thinking that it plays FLV by creating an FLV file header. Only after that you can start filling video buffer with video data. Actually this aspect is vaguely described in the appenBytes() documentation:

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/NetStream.html#appendBytes()

I suggest you look into OSMF HTTP dynamic streaming package to see how it is done. I would not expect finding much help here or on Internet - this is a very specific process that few had a chance (or need) to accomplish.

kglad
Community Expert
Community Expert
April 29, 2014

do you have a cross-domain issue?

ie, test with a local flv.

Participant
April 29, 2014

Is not a cross-domain issue because as i said, with flv there is no problem.. via socket.

I`m receiving all of mp4 data and stored in byteArray, then append it to NetStream... but when i play, nothing shown..