-1

我正在使用 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

谁能告诉我其中有什么问题?我尝试谷歌搜索,但没有得到任何解决方案

4

2 回答 2

0

源的媒体类型。仅当文件属性不包含可识别的文件扩展名(如 mp4 的 .mp4)时才需要。媒体格式参考列出了所有支持的类型。

因此,将类型添加到每个视频。

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.

于 2015-12-24T22:30:39.860 回答
0

这是您的解决方案的工作演示。正如 zer00ne 所指出的,您需要包含类型(不是 mime 类型)“webm”

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/

于 2016-01-26T17:58:25.133 回答