我在運行videojs('vid')
時無法使用video.js。我的目標是創建一個video.js對象,以便我可以讀取當前時間(myPlayer.currentTime
)。Video.js:設置視頻後出錯src
HTML:
<video id="vid" class="video-js" controls autoplay data-setup="{}">
<source id="src1">
</video>
的Javascript:
$(document).ready(function() {
videojs('vid').ready(function() {
var myPlayer = this;
myPlayer.src({ type: 'video/mp4', src: '/uploads/365.mp4' });
});
});
這給了我一個錯誤:
VIDEOJS: ERROR: (CODE:4 MEDIA_ERR_SRC_NOT_SUPPORTED) The media could not be loaded, either because the server or network failed or because the format is not supported.
重要:當設置SRC不執行videojs('vid')
,相同的視頻工作正常。這就像運行videojs('vid')
重置所有來源並且未能通過Javascript設置src
。
爲什麼你無法從'
那是不可能的。 –
爲什麼?如果你真的想要這個,你可以在源代碼中添加一個虛擬url,然後按照你喜歡的方式改變它。 '