RTMP プロトコルを介してビデオを再生する必要があるプロトタイプに取り組んでいます。私のコードは次のとおりです。
private function init():void
{
streamID:String = "mp4:myVideo";
videoURL = "rtmp://fms.xstream.dk/*********.mp4";
vid = new video();
vid.width = 480;
vid.height = 320;
nc = new NetConnection();
nc.client = {onBWDone: function():void
{
}};
nc.addEventListener(NetStatusEvent.NET_STATUS, onConnectionStatus);
nc.connect(videoURL);
}
private function onConnectionStatus(e:NetStatusEvent):void
{
if (e.info.code == "NetConnection.Connect.Success")
{
trace("Creating NetStream");
netStreamObj = new NetStream(nc);
netStreamObj.client = new CustomClient();
netStreamObj.play(streamID);
vid.attachNetStream(netStreamObj);
addChild(vid);
intervalID = setInterval(playback, 1000);
}
}
private function playback():void
{
trace((++counter) + " Buffer length: " + netStreamObj.bufferLength);
}
class CustomClient
{
public function onMetaData(info:Object):void
{
trace("metadata: duration=" + info.duration + " width=" + info.width + " height=" + info.height + " framerate=" + info.framerate);
}
public function onCuePoint(info:Object):void
{
trace("cuepoint: time=" + info.time + " name=" + info.name + " type=" + info.type);
}
}
しかし、それは再生されず、エラーも発生せず、プライドもありません。