Skip to main content
Inspiring
Mar 29, 2017 12:13 PM UTC
Question

loading mp4 file in to ipad

dear frieds,

I want to load mp4 file in ios, its loading in desktop while testing, not loading in ipad. pls help me iam using following code:

var nc: NetConnection = new NetConnection();
nc.connect(null);

var ns: NetStream = new NetStream(nc);
ns.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);
ns.play("video.mp4");
function asyncErrorHandler(event: AsyncErrorEvent): void {
trace(event);
// ignore error
}

var vid: Video = new Video();
vid.attachNetStream(ns);
vid.width = 640;
vid.height = 360;
addChild(vid);

Thanks and Regards,

Syed Abdul Rahim

This topic is closed to new replies. Start a new post to keep the conversation going.

2 replies

itlancer
Inspiring
Mar 29, 2017 4:16 PM UTC

Here is bug report: Tracker

It's AIR limitation for iOS. You can use StageVideo or VideoTexture with Stage3D to play mp4 video with iOS.

Translate
Colin Holgate
Inspiring
Mar 29, 2017 4:33 PM UTC

The code for using StageVideo is basically the same as you're already doing. To attach the netstream to StageVideo is done like (where _ns is your netstream):

private var _stageVideo: StageVideo;

private function _enableStageVideo(): void {

  if (_stageVideo == null) {

  _stageVideo = _stage.stageVideos[0];

  _stageVideo.viewPort = _rect;

  }

  _stageVideo.attachNetStream(_ns);

  }

StageVideo appears in the background, and you can put regular buttons on top of it without affecting performance.

Translate