我在 Flash Builder 4.6 中构建了一个基于视图的移动项目,旨在在远程机器上播放视频。该项目在 Flash Builder 中运行良好。当导出,安装在 iPad 和 iPhone 4S 上时,瞄准失败。我尝试输出相关事件,发现该项目可以接收视频的元数据,但无法播放视频数据。
我被困住了。
代码是这样的:
private var netConnection:NetConnection
private var netStream:NetStream;
private var video:Video;
protected function onInit():void{
netConnection = new NetConnection();
netConnection.addEventListener(NetStatusEvent.NET_STATUS,netConnectStatus);
netConnection.connect(null);
netStream = new NetStream(netConnection);
netStream.client = new Object();
netStream.client.onMetaData = function (info:Object):void{
for(var str:String in info){
trace(str + " "+info[str]);
}
}
netStream.bufferTime = 4;
netStream.addEventListener(NetStatusEvent.NET_STATUS, netStreamStatus);
netStream.play("http://192.168.0.101/video/video.mp4");
video = new Video();
video.attachNetStream(netStream);
video.width = stage.stageWidth;
video.height = stage.stageHeight;
stage.addChild(video);
}
public function netConnectStatus(e:NetStatusEvent):void{
}
private function netStreamStatus(e:NetStatusEvent):void {
switch(e.info.code)
{
case "NetStream.Buffer.Empty":
break;
case "NetStream.Buffer.Full":
break;
}
}