views:

282

answers:

4

Hi,

I need to play on my .swf a movie (h264) from the users' hard drive.

Unfortunately the as3 components only read from URLs or streams, and you can't set the data or load from your c:/ path as the security sandbox stops you. Here is what each component loads:

  • Video >> netStream
  • VideoDisplay >> URL
  • VideoPlayer >> URL

I tried attaching a fileReference.data (byteArray) to all of them but nothing seems to work.

-

my question: Is there a way of doing this without actually uploading the videos (h254) to the server?

-

I have read that it is possible to do a javascript that can upload the data to it and then pass it to the netstream but I can't figure out how to do it myself.

Any hint, hack, idea is welcome.

Many thanks.

+2  A: 

That actually depends on the compile settings of the swf. The rule is that a swf can either read files from a server or it can read files locally. Further, a swf cannot load another swf which has the alternative access.

To get a swf to read off of the hard drive through Flash CS3, open the FLA, go to "Publish settings" and then click "Flash". At the bottom there is a select box which will let you choose whether you want to read local or network files.

The Flex instructions are a bit more involved but they are located here: http://livedocs.adobe.com/flex/3/html/help.html?content=05B%5FSecurity%5F04.html

Christopher W. Allen-Poole
I need it to read from both the local and network files. Also, even if I can read the files using "file://" the path is still unknown, unless the user manually types it. Cheers for your help.
StfnoPad
Then probably, you need an AIR app.
bhups
there must be a way of doing it without it being an air app. I'm sure someone out there knows, I added a bounty to sweeten the deal :-D
StfnoPad
+5  A: 

With flash 10 you can load files into the player without having to bounce them off the server. Here's a quick tutorial on the subject: http://www.thedesilva.com/2008/11/flash-10-file-reference/

greg
Yes I'm using gumbo and I did try using fileReference. You can load the movie file (h.264) easily but the fileReference only return a byteArray which I can't figure out how to load to either a video, videoDisplay or videoPlayer Object. Any Ideas?
StfnoPad
+1  A: 

You're running into the Flash Player sandbox security policies here. The only way I can think of to load something locally is to run a separate app that acts as a HTTP server, so you can load the local files through the loopback interface (URL with http://127.0.0.1/)

Phil Hayward
Yeah, You could do this with something like EASYPHP (http://www.easyphp.org/index.php)
sthg
Yes if you install an http server on the users machines then that defeats the whole purpose of having an online application written in as3.
StfnoPad
A: 

There is no way of doing this...

Only possible solution is to have an air app.

StfnoPad