jwplayer收到错误“找不到可播放的来源”

时间:2015-12-24 12:20:22

标签: jwplayer jwplayer6 jwplayer7

我正在使用jwplayer,其中我想添加高清切换,如720p,360p,260p,因为我使用下面的代码,但它给我一个错误,如“找不到可播放的源”,

<html>
<head>
    <script type="text/javascript" src='http://content.jwplatform.com/libraries/vHksukSC.js'></script>

</head>
<body>
<div id="container">Loading the player...</div>
<script>
var playerInstance = jwplayer("container");
playerInstance.setup({
    image: "https://testvideoout.s3.amazonaws.com/Videos/Thumb/Thumb_Videos_29_1446555606635_00001.png",
    sources: [{
      file: "https://testvideoout.s3.amazonaws.com/Videos/Streaming/webm_Videos_66_1450099348116",
      label: "720p HD"
    },{
      file: "https://testvideoout.s3.amazonaws.com/Videos/Streaming/webm_Videos_66_1450099348116",
      label: "360p SD",
      "default": "true"
    },{
      file: "https://testvideoout.s3.amazonaws.com/Videos/Streaming/webm_Videos_66_1450099348116",
      label: "180p Web"
    }]
  });
</script>
</body>
</html>

供参考我正在使用此网址

https://support.jwplayer.com/customer/portal/articles/1428524-hd-quality-toggling

有谁能告诉我它的问题是什么?我试过谷歌搜索但没有得到任何解决方案

2 个答案:

答案 0 :(得分:0)

  

来源的媒体类型。仅在文件属性不包含可识别的文件扩展名(例如mp4的.mp4)时才需要。 Media Formats Reference列出了所有支持的类型。

因此,请为每个视频添加类型。

playerInstance.setup({
    image: "https://testvideoout.s3.amazonaws.com/Videos/Thumb/Thumb_Videos_29_1446555606635_00001.png",
    sources: [{
      file: "https://testvideoout.s3.amazonaws.com/Videos/Streaming/webm_Videos_66_1450099348116",
      label: "720p HD",
      type: "video/webm"
    },{
      file: "https://testvideoout.s3.amazonaws.com/Videos/Streaming/webm_Videos_66_1450099348116",
      label: "360p SD",
      "default": "true",
      type: "video/webm"
    },{
      file: "https://testvideoout.s3.amazonaws.com/Videos/Streaming/webm_Videos_66_1450099348116",
      label: "180p Web",
      type: "video/webm"
    }]
  });

文档没有具体说明应该用作type的确切内容,因此如果video/webm不起作用,请尝试webm

答案 1 :(得分:0)

以下是您的解决方案的工作演示。正如zer00ne所说,你需要包括类型(不是mime类型),&#34; webm&#34;

jwplayer('player').setup({
image: "https://testvideoout.s3.amazonaws.com/Videos/Thumb/Thumb_Videos_29_1446555606635_00001.png",
    sources: [{
      file: "https://testvideoout.s3.amazonaws.com/Videos/Streaming/webm_Videos_66_1450099348116",
      label: "720p HD",
      type: "webm"
    },{
      file: "https://testvideoout.s3.amazonaws.com/Videos/Streaming/webm_Videos_66_1450099348116",
      label: "360p SD",
      "default": "true",
      type: "webm"
    },{
      file: "https://testvideoout.s3.amazonaws.com/Videos/Streaming/webm_Videos_66_1450099348116",
      label: "180p Web",
      type: "webm"
    }],
      width: 720,
      height: 406
    });

http://jsfiddle.net/simsketch/5n5qcLca/