0
由於Firefox不允許我在<video>
標籤中使用.mp4文件,因此我必須在我的VideoJS player上使用Flash後備。配置VideoJS Flash後備
對於Chrome,Safari和IE,我可以使用javascript配置我的VideoJS播放器來完成任何操作。例如,我喜歡循環播放5次,隱藏控件並將視頻靜音。對於HTML5版本沒有問題:
// Initialize the video with some settings
videojs(videoID, {
"controls": false,
"autoplay": false,
"preload": "auto",
});
var myVideo = videojs(videoID);
// Set the counter
var loop_count = 1;
// Function to loop the video exaclty 5 times
var loopInstagramVideo = function() {
if (loop_count <= 5) {
myVideo.play();
loop_count++;
} else {
loop_count = 1;
}
};
// Function to manipulatie the playing video (mute, no controls,...)
var setVideoOptions = function() {
myVideo.muted(1);
myVideo.controls(0);
};
// Set functions on the video
myVideo.on("play", setVideoOptions);
myVideo.on("ended", loopInstagramVideo);
所以我想爲Flash版本做同樣的事情。
上面的代碼在videojs
-call產生錯誤與錯誤:
TypeError: The element or ID supplied is not valid. (videojs)
就如何解決這個問題有什麼想法?