0
votes

I want to play the local mp4 file in adobe flash player, the source code show following:

package
        {
           import flash.display.Sprite;
           import flash.net.NetConnection;
           import flash.net.NetStream;
           import flash.text.TextField;
           import flash.media.Video;

           public class Exploit extends Sprite
           {

              public function Exploit()
              {
                 greeting = new TextField();
                 super();
                 greeting.text = "Loading...";
                 greeting.x = 100;
                 greeting.y = 100;
                 addChild(greeting);
                 MyVideo = new Video();
                 addChild(MyVideo);
                 MyNC = new NetConnection();
                 MyNC.connect(null);
                 MyNS = new NetStream(MyNC);
                 MyVideo.attachNetStream(MyNS);
                 MyNS.play("http://techslides.com/demos/sample-videos/small.mp4");
              }

              public var MyNC:NetConnection;

              public var MyNS:NetStream;

              private var greeting:TextField;

              public var MyVideo:Video;
           }
        }

then I use mxmlc.exe to generate .swf file. Open the swf file, it works. But when I modify MyNS.play("http://techslides.com/demos/sample-videos/small.mp4") to MyNs.play("small.mp4"), and then use mxmlc.exe to generate .swf file. Open it, it cannot play the small.mp4 file.(Note: small.mp4 locates the same directory with swf file).

Anyone give me suggestion?
1
For anyone with same problem. Try setting your swf output options from "access network files only" to being "access local files only" then test again. - VC.One

1 Answers

-1
votes

I don't think flash supports MP4 natively. I would suggest looking at a codec

Here is the list of natively supported codecs by the Flash Player:

http://kb2.adobe.com/cps/402/kb402866.html

If you need to play something not natively supported, there are external API's that will allow you to do so, just chose a Flash Sound API:

http://www.google.com.br/search?q=flash+sound+API