Flash中播放视频和音频流(rtmp协议)

在Flash中播放red5的视频和音频流,代码如下:

import flash.net.NetConnection;
import flash.events.NetStatusEvent;
import flash.media.Camera;
import flash.net.NetStream;

var netConnect2:NetConnection=new NetConnection();
netConnect2.addEventListener(NetStatusEvent.NET_STATUS,netConnectHandler2);
netConnect2.connect("rtmp://10.1.49.137/oflaDemo","codyy");

var receiveStream:NetStream 
function netConnectHandler2(evt:NetStatusEvent):void
{
	trace(evt.info.code);
	switch (evt.info.code)
	{
		case "NetConnection.Connect.Success" :
			initRec();
			trace("链接成功2");
			break;
		case "NetConnection.Connect.Closed" :
			trace("链接失败2");
			break;
	}
}
function initRec()
{
	var cc = new Object();
	cc.onMetaData = onmd;
	var flvName:String=loaderInfo.parameters.xian;
	trace(flvName);
	receiveStream= new NetStream(netConnect2);
	receiveStream.client = cc;
	function onmd(o : Object):void{}
	receiveStream.play(flvName);
	rece_video.attachNetStream(receiveStream);
}


原文链接: http://blog.csdn.net/peijiangping1989/article/details/7002793

你可能感兴趣的:(Flash中播放视频和音频流(rtmp协议))