开发者

ActionScript - load video from users hard drives without server

开发者 https://www.devze.com 2022-12-09 23:44 出处:网络
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 se

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.


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/


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_Security_04.html


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/)


There is no way of doing this...

Only possible solution is to have an air app.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号