Reading a flash stream with HTML5
I know that we can publish a flash rtmfp stream with this piece of code:
private const CirrusAddress:String = "rtmfp://p2p.rtmfp.net";
private const DeveloperKey:String = "your-developer-key";
private var netConnection:NetConnection;
netConnection = new NetConnection();
netConnection.addEventListener(NetStatusEvent.NET_STATUS,
开发者_JS百科netConnectionHandler);
netConnection.connect(CirrusAddress + "/" + DeveloperKey);
private var sendStream:NetStream;
sendStream = new NetStream(netConnection, NetStream.DIRECT_CONNECTIONS);
sendStream.addEventListener(NetStatusEvent.NET_STATUS,
netStreamHandler);
sendStream.publish("media");
sendStream.attachAudio(Microphone.getMicrophone());
sendStream.attachCamera(Camera.getCamera());
So, with this code, a receiver can read the published stream (sendStream.publish("media")
) with this code (recvStream.play("media")
):
private var recvStream:NetStream;
recvStream = new NetStream(netConnection, id_of_publishing_client);
recvStream.addEventListener(NetStatusEvent.NET_STATUS, netStreamHandler);
recvStream.play("media");
But, my question is: Is there an equivalent of the code above in HTML5? In other words, How can I read the published stream with HTML5?
Thanks,
Regards.
For being able to use it with HTML5s video support, you have to publish it as a file that's accessible over HTTP and that is, for example, in the webm format.
精彩评论