HTML5 loading video from Assets directory


For Flash target I can to use

_netStream.appendBytesAction("action"); _netStream.appendBytes(data);

for load video file from Assets directory.

How to load video (flv, mp4) from assets directory for html5 target?


Is it possible to use a URL that’s a relative location, based on your asset directory structure?

Yes, I want to load from path, as “assets/video/MyVideo.flv”.

I think it looks like this:

var netConnection = new NetConnection ();
netConnection.connect (null);

var netStream = new NetStream (netConnection);

var video = new Video (640, 480);
addChild (video);

video.attachNetStream (netStream); ("assets/video/MyVideo.mp4");

…something like that. You’ll have to use a different video format that is compatible with the user’s browser. I used Adobe Media Encoder to transcode some FLV files to H.264 MP4 video for HTML5 on a recent project

Thanks, I used invalid codecs, so didn’t play on Safari.