I build a view-base mobile project in Flash Builder 4.6, which aims to play a video on remote machine. The project works well in Flash Builder. When exported, installed on iPad and iPhone 4S, the aim failed. I tried to output the relevant event and found that the project could recieve the meta data of the video but failed to play the video data.
I am stuck.
The code is like this:
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;
}
}