【问题标题】:Streaming MP4 to iOS not working with JWPlayer and CloudFront将 MP4 流式传输到 iOS 不适用于 JWPlayer 和 CloudFront
【发布时间】:2013-09-18 15:27:41
【问题描述】:

尝试设置一个测试页面来访问托管在 S3 上并使用 CloudFront 流式传输的视频。我使用的播放器是 JWPlayer,它应该也适用于 iOS 设备。

不幸的是,当我在 iPhone 上打开它时,什么也没有发生……我确信答案是显而易见的,但在过去的一个小时里,我一直没有发现它。这是代码(主要是来自http://aws.amazon.com/articles/4101?_encoding=UTF8&jiveRedirect=1 的复制/粘贴):

<!--     THIS IS A BASIC HTML FILE TO PLAY MP4's USING JW PLAYER 
The following code is from longtailvideo.com's 'Setup Wizard', found at http://www.longtailvideo.com/support/jw-player-setup-wizard -->
<HTML>
<HEAD>
<TITLE>  
Streaming Video with JW Player
</TITLE>    
</HEAD>
<BODY>
<!-- Put a header above your video, if you like
-->
<H1>This is my header</H1>
<script type='text/javascript' src='http://s3.amazonaws.com/intrinseque-video/swfobject.js'></script>   
<div id='mediaspace'>This text will be replaced</div>
<script type='text/javascript'>
var so = new SWFObject('http://s3.amazonaws.com/intrinseque-video/player.swf','mpl','470','290','9');
     so.addParam('allowfullscreen','true');
     so.addParam('allowscriptaccess','always');
     so.addParam('wmode','opaque');
     so.addVariable('file','mp4:oceans-clip.ipad.mp4'); 
         so.addVariable('streamer','rtmp://s1m21pqfl8vlrl.cloudfront.net/cfx/st/'); 
     so.write('mediaspace');
</script>
</BODY>
</HTML>

<!--Common problems:
-   You cannot have any spaces in any of your URL's (including your 'rtmp://...'  URL)              (i.e.,  http:// thereisaspaceatthebeginninghere.xxx) 
-   Be sure you are calling the correctly numbered version of the flowplayer objects/players (i.e. flowplayer-3.2.2.swf
-   You cannot have duplicates of 's3.amazonaws.com' or 'cloudfront.net' in the same address (i.e. (http://s3.amazonaws.com/s3.amazonaws.com/YOUR_BUCKET/player.swf)
-   There is a different naming protocol for mp4 vs flv files. For .mp4 files, YOU MUST write it as 'mp4:YOUR_VIDEO_FILE_WITHOUT_THE _MP4_SUFFIX'. For .flv files, you simply write the name of the file, 'YOUR_VIDEO_FILE_WITHOUT_THE_FLV_SUFFIX'.
-->

【问题讨论】:

    标签: ios amazon-s3 audio-streaming jwplayer amazon-cloudfront


    【解决方案1】:

    查看http://www.longtailvideo.com/support/jw-player/jw-player-for-flash-v5/49/using-cloudfront

    您需要添加以下内容:

         modes: [{
            type: "flash",
            src: "/assets/player.swf"
        },{
            type: "html5"
            config: {
                file: "http://dXXXXXXXXXXXX.cloudfront.net/example.mp4"
                provider: "video"
            }
        }],
    

    为它正确处理 flash 和 html5 的代码。

    【讨论】:

    • 还没来得及实际尝试,但既然这是唯一的答案而且似乎是合理的,我会接受它。谢谢!
    【解决方案2】:

    实际上,并非所有 mp4 文件都是生而平等的。用奇怪的编码器/编解码器转换的那些有时在 IOS 上不起作用。我有一个案例,handbreak 编码的 mp4 无法播放,而 ffmpeg 编码的相同视频完美流式传输。

    我一直不明白到底有什么区别。也许可以在您将视频元数据放入文件的地方做些什么。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-02-11
      • 1970-01-01
      • 1970-01-01
      • 2012-04-14
      • 2011-11-19
      • 1970-01-01
      • 1970-01-01
      • 2012-08-20
      相关资源
      最近更新 更多