0

I need to create a custom communication between server and flash client. For example I want to write UDP protocol using error correction. It is much faster than TCP and does not suffer from routing problem. Unfortunately I absolutely cannot think of how to replace the existing way:

_stream = new NetStream(_connection);
_video.attachNetStream(_stream);

This encloses all communication and I do not have a control over it. I understand that I can use appendBytes, but not sure what exactly to pass to this function. I can do anything on the server side. My video is H.264 and audio is ACC.

Sam DeHaan
  • 10,246
  • 2
  • 40
  • 48
sergman
  • 171
  • 1
  • 2
  • 12

2 Answers2

0

Unless it's a AIR application, you can't. It's native API which already handling application layer (OSI model).

If you want make your own, using flash.net.DatagramSocket class (available in AIR 2+) for your application layer and NetStream.appendBytes for audio/video stream decoding & playback (feeded with FLV/F4V chunks)

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/DatagramSocket.html

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/NetStream.html#appendBytes%28%29

mems
  • 1,224
  • 1
  • 19
  • 27
  • I tried to use DatagramSocket but it just does not exist in the library. Can I use AIR library in flash player that will run on client machine's browser? Or maybe it is not possible by definition of AIR. – sergman Apr 27 '12 at 04:30
  • "Unless it's a AIR application, you can't". You can't use AIR library for web applications (executed by FlashPlayer WebBrowser Plugin) – mems May 02 '12 at 12:32
0

I was betting on UDP, but never got it working in Flash. I'll explain it:

In your browser, there is really no way to make usage of UDP!!! Flash applications there run in a sandbox, which only talk TCP!

Air is used for desktop applications, which after compilation run in a desktop wrapper, which itself has direct access to the socket and other possibilities.

That's it! You have to use TCP.

Fab1n
  • 2,103
  • 18
  • 32