How do I load a MOV file into Flash 9

我是研究僧i 提交于 2019-12-11 18:09:16

问题


I am having issues loading an MOV file into Flash 9. When I google the question, I get alot of people say sure you can do it, but nobody provides working sample code.


回答1:


The following is from http://en.wikipedia.org/wiki/Adobe_Flash#Flash_Video

Flash Video

Flash Video (.flv files) is a container format, meaning that it is not a video format in itself, but can contain other formats. The video in Flash is encoded in H.263, and starting with Flash player 8, it may alternatively be encoded in VP6. The audio is in MP3. The use of VP6 is common in many companies, because of the large adoption rates of Flash Player 8 and Flash Player 9.[16]

On August 20, 2007, Adobe announced on its blog that with Update 3 of Flash Player 9, Flash Video will also support the MPEG-4 international standard.[31] Specifically, Flash Player will have support for video compressed in H.264 (MPEG-4 Part 10), audio compressed using AAC (MPEG-4 Part 3), the MP4, M4V, M4A, 3GP and MOV multimedia container formats (MPEG-4 Part 14), 3GPP Timed Text specification (MPEG-4 Part 17) which is a standardized subtitle format and partial parsing support for the 'ilst' atom which is the ID3 equivalent iTunes uses to store metadata. Adobe also announced that they will be gradually moving away from the proprietary FLV format to the standard MP4 format owing to functional limits with the FLV structure when streaming H.264. The final release of the Flash Player supporting MPEG-4 had become available in Fall 2007.[32]

package com.yourdomain.packageName
{
    import flash.display.Sprite;
    import flash.media.Video;
    import flash.net.NetConnection;
    import flash.net.NetStream;

    public class DocumentClass extends Sprite
    {
        private var _video:Video;
        private var _nc:NetConnection;
        private var _ns:NetStream;

        public function DocumentClass():void
        {
            _video = new Video(800, 600);
            addChild(_video);

            _nc = new NetConnection();
            _nc.connect(null);

            _ns = new NetStream(nc);
            _video.attachNetStream(_ns);
           _ns.play("path/to/file.extension");
        }
    }
}

-This is a very basic implementation and does not include handling of meta-data.

First, we instantiate a Video object that is 800 wide and 600 tall and add it to the display list.

Second, we instantiate a NetConnection object and call it's connect method passing null as a parameter. (This is required)

Third, we create a NetStream object, passing the previously made NetConnection object to it's constructor.

Fourth, we set attachNetStream of the Video object to _ns, the NetStream we instantiated.

Finally, we call the play method of the NetStream object, _ns, and pass it a string to where our media is located. (The FLV/F4V/MOV/etc.)

Hope this helps.




回答2:


Same as with any FLV, using NetStream (I don't recommend it, it's very hard to handle) or any AS3 video playback component you can find, like FLVPlayback, etc... as long as you target FP 9.0.115.0, and the file is encoded in h264 and in a MPEG-4 container like mov, mp4, f4v, etc...



来源:https://stackoverflow.com/questions/840213/how-do-i-load-a-mov-file-into-flash-9

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!