1

According to the NetStream API, Flash can play LOCAL RAW video by calling ns.play("raw:filename");.

My question is how can Flash play RAW video data from a ByteArray? I have basically set my NetStream object to data generation mode by calling play(null), but whenever I call ns.appendBytes(byteArray) nothing is happening because apparently, appendBytes only support FLV data.

So now I hope that someone has also encountered this before, how can I make Flash play raw video data from a ByteArray?

Anne
  • 26,765
  • 9
  • 65
  • 71
Code.Blodded
  • 231
  • 1
  • 19

1 Answers1

2

Essentially, you can't use appendBytes for a RAW file type.

You should be able to play your video using ns.play("raw:filename").

In terms of Flash Media Encoding, RAW is a FLV file fragment, published from the Flash Media server (usually).

If it's not acceptable to play the filename, you may need to convert the RAW file (i.e. FFmpeg) to encode the video into FLV format and then stream. However, I don't believe RAW files can be converted, or will require Flash Media Encoding to change: http://help.adobe.com/en_US/flashmediaserver/devguide/WSecdb3a64785bec8751534fae12a16ad0277-8000.html

Dominic Tancredi
  • 41,134
  • 7
  • 34
  • 50
  • On a slightly different note... is there a way to do the same for audio? I mean using the sound object and then calling its PLAY method while listening to its SampleDataEvent.SAMPLE_DATA, i should be able to pass raw byte data to that sound object right? I'm doing this on my SAMPLE_DATA event listener but no sound is coming out event.data.writeBytes(soundBA, soundBA.position); – Code.Blodded Nov 18 '11 at 07:24
  • The best you can do for Sound I've found is the SoundLoaderContext (http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/media/SoundLoaderContext.html). Basically, set a time for pre-streaming before playing. – Dominic Tancredi Nov 25 '11 at 15:22