2015-12-24 50 views
-1

我正在使用jwplayer,其中我想添加高清切換像720p,360p,260p,因爲我使用下面的代碼,但它給我錯誤,如「無法播放源發現」,jwplayer獲取錯誤「找不到可播放的源代碼」

<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 

誰能告訴我是什麼問題呢?我嘗試了谷歌搜索,但沒有得到任何解決方案

回答

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

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/