Link to home
Create AccountLog in
Avatar of Flash55
Flash55

asked on

Playing video from URL

Hi Experts,

I am creating a video loader in Flash for an android app and have been trying to load a video from a remote server. i tried bypassing the security domain (located at the top part of the code). the video loader works if i am loading videos(mp4) from local drives only, but not from a remote server (URL(.

import flash.system.*;
try {Security.allowDomain("*");}catch (e) { };


// flag for knowing if video has been loaded
var bolLoaded:Boolean = false;
// net connection object for net stream
var ncConnection:NetConnection;
// net stream object
var nsStream:NetStream;
// object holds all meta data
var objInfo:Object;
// url to video file
var strSource:String = "http://URL/S.mp4"

// create a new net connection, add event listener and connect
// to null because we don't have a media server
ncConnection = new NetConnection();
ncConnection.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
ncConnection.connect(null);

// create a new netstream with the net connection, add event
// listener, set client to this for handling meta data and
// set the buffer time to the value from the constant
nsStream = new NetStream(ncConnection);
nsStream.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
nsStream.client = this;
nsStream.bufferTime = BUFFER_TIME;

// attach net stream to video object on the stage
main_mc.vidDisplay.attachNetStream(nsStream);
// set the smoothing value from the constant
main_mc.vidDisplay.smoothing = SMOOTHING;


nsStream.play(strSource);

Open in new window


Thanks.
ASKER CERTIFIED SOLUTION
Avatar of dgofman
dgofman
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer