播放视频可以在模拟器上播放,但不能在 ipad 上播放 (2)

发布于 2024-11-25 12:16:00 字数 3455 浏览 3 评论 0原文

我一直在尝试播放使用 http://www.mirovideoconverter.com/ 转换为 mp4 的视频文件,它在模拟器上工作正常,但在 ipad 上我看不到视频。

我该如何修复?

附上视频代码:

    package com.view.generic
{


import com.constants.Dimentions;

    import com.view.AbstractScreen;
    import com.view.IScreen;
    import com.view.gui.Btn;

    import flash.errors.IOError;
    import flash.events.IOErrorEvent;
    import flash.events.MouseEvent;
    import flash.events.NetStatusEvent;
    import flash.media.Video;
    import flash.net.NetConnection;
    import flash.net.NetStream;

    import org.osflash.signals.natives.NativeSignal;

    public class VideoMode extends AbstractScreen implements IScreen
    {
        private var _player:Video;
        private var _stream:NetStream;
        public function VideoMode()
        {

        }
        override public function start():void{
            super.start();
            var conn:NetConnection = new NetConnection();
            conn.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler)
            conn.addEventListener(IOErrorEvent.NETWORK_ERROR, netStatusError)
            conn.connect(null);
            layoutPlayer();
            layoutMenu();

        }

        override public function stop():void{
            _stream.pause();
        }



        private function layoutMenu():void{
            var playBtn:Btn = new Btn("video_play_button.png");
            addChild(playBtn);
            playBtn.x = (Dimentions.HEIGHT -playBtn.width)/2;
            playBtn.y = _player.y+_player.height+20;
            var clickSignal:NativeSignal = new NativeSignal(playBtn,MouseEvent.CLICK);
            clickSignal.add(play);

            var fullScrBtn:Btn = new Btn("full_screen.png");
            addChild(fullScrBtn);
            fullScrBtn.x = _player.width -fullScrBtn.width+_player.x;;
            fullScrBtn.y = _player.y+_player.height+20;
            var fullScrSignal:NativeSignal = new NativeSignal(fullScrBtn,MouseEvent.CLICK);
            fullScrSignal.add(goFullScreen);
        }

        private function layoutPlayer():void{
            _player.width = 400;
            _player.height = 300;
            _player.x = (Dimentions.HEIGHT -_player.width)/2;
            _player.y = 200;
            _stream.play("../../../assets/drum_ny.flv");
            _stream.pause();

        }

        private function goFullScreen(e:MouseEvent):void{
            if(_player.x == 0){
                layoutPlayer()
            }else{
                _player.x = 0;
                _player.y = 0;
                _player.width = stage.fullScreenWidth;
                _player.height = stage.fullScreenHeight;
            }

        }
        private function play(e:MouseEvent):void{
            _stream.resume()
        }

        private function netStatusHandler(e:NetStatusEvent):void{
            if(e.info.code=="NetConnection.Connect.Success"){
                _stream = new NetStream(NetConnection(e.target));
                _stream.client = this;
                _player = new Video();
                addChild(_player);

                _player.attachNetStream(_stream)

            }
        }
        private function netStatusError(e:IOError):void{
            trace(e)
        }

        override public function destroy():void{

        }
        public function onMetaData(info:Object):void {

        }

    }
}

谢谢!

I have been trying to play a video that was converted using http://www.mirovideoconverter.com/ to mp4 file , it is woking fine on the simulator but on the ipad i don't see the video.

How can I fix??

attaching Video code :

    package com.view.generic
{


import com.constants.Dimentions;

    import com.view.AbstractScreen;
    import com.view.IScreen;
    import com.view.gui.Btn;

    import flash.errors.IOError;
    import flash.events.IOErrorEvent;
    import flash.events.MouseEvent;
    import flash.events.NetStatusEvent;
    import flash.media.Video;
    import flash.net.NetConnection;
    import flash.net.NetStream;

    import org.osflash.signals.natives.NativeSignal;

    public class VideoMode extends AbstractScreen implements IScreen
    {
        private var _player:Video;
        private var _stream:NetStream;
        public function VideoMode()
        {

        }
        override public function start():void{
            super.start();
            var conn:NetConnection = new NetConnection();
            conn.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler)
            conn.addEventListener(IOErrorEvent.NETWORK_ERROR, netStatusError)
            conn.connect(null);
            layoutPlayer();
            layoutMenu();

        }

        override public function stop():void{
            _stream.pause();
        }



        private function layoutMenu():void{
            var playBtn:Btn = new Btn("video_play_button.png");
            addChild(playBtn);
            playBtn.x = (Dimentions.HEIGHT -playBtn.width)/2;
            playBtn.y = _player.y+_player.height+20;
            var clickSignal:NativeSignal = new NativeSignal(playBtn,MouseEvent.CLICK);
            clickSignal.add(play);

            var fullScrBtn:Btn = new Btn("full_screen.png");
            addChild(fullScrBtn);
            fullScrBtn.x = _player.width -fullScrBtn.width+_player.x;;
            fullScrBtn.y = _player.y+_player.height+20;
            var fullScrSignal:NativeSignal = new NativeSignal(fullScrBtn,MouseEvent.CLICK);
            fullScrSignal.add(goFullScreen);
        }

        private function layoutPlayer():void{
            _player.width = 400;
            _player.height = 300;
            _player.x = (Dimentions.HEIGHT -_player.width)/2;
            _player.y = 200;
            _stream.play("../../../assets/drum_ny.flv");
            _stream.pause();

        }

        private function goFullScreen(e:MouseEvent):void{
            if(_player.x == 0){
                layoutPlayer()
            }else{
                _player.x = 0;
                _player.y = 0;
                _player.width = stage.fullScreenWidth;
                _player.height = stage.fullScreenHeight;
            }

        }
        private function play(e:MouseEvent):void{
            _stream.resume()
        }

        private function netStatusHandler(e:NetStatusEvent):void{
            if(e.info.code=="NetConnection.Connect.Success"){
                _stream = new NetStream(NetConnection(e.target));
                _stream.client = this;
                _player = new Video();
                addChild(_player);

                _player.attachNetStream(_stream)

            }
        }
        private function netStatusError(e:IOError):void{
            trace(e)
        }

        override public function destroy():void{

        }
        public function onMetaData(info:Object):void {

        }

    }
}

Thank you!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

九八野马 2024-12-02 12:16:00

这可能是您的问题:

 _stream.play("../../../assets/drum_ny.flv");

将应用程序编译成 .ipa 文件后,该文件不存在。尝试将其更改为您可以将其上传到的某个网址,如果有效,那么这就是您的问题。

This is likely your problem :

 _stream.play("../../../assets/drum_ny.flv");

That file doesn't exist once you compile your app into a .ipa file. Try changing that to a web address of somewhere you can upload it to and if it works, then that's your prob.

痴者 2024-12-02 12:16:00

通过替换 FLV 文件解决了该问题,但我仍然不确定为什么一个 flv 文件有效而另一个无效。

如果您遇到这样的问题(视频可以在模拟器上运行,但不能在设备上运行),您的第一个选择应该是更换视频源。

The issue was resolved by replacing the FLV file, however I am still not sure why one flv file works and the other does not.

If you encounter such a problem (video works on simulator but not on device) your first bet should be replacing the video source.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文