【发布时间】:2013-05-13 21:11:00
【问题描述】:
我刚刚将我的应用升级到新的 videojs 4.0 版,但它现在不适用于 iPad(据我所知,它适用于所有其他浏览器)。
4.0 皮肤没有出现,API 似乎根本不起作用。视频被用作背景,并由应用程序中的按钮控制。但是,升级后,视频会导致所有按钮无法点击(或者如果您愿意,也无法触摸)。
这是我正在使用的 JS。
var $curTime = 0;
var $setPause = "Go";
var $timeOutTime = 1000;
$( '#main' ).on( 'pageshow',function(event){
videojs("HumanBody", {"preload":"metadata","poster":"http://pidcgr.com/lobby/humanbody/vid/poster.png","controls":true}, function(){
console.log("Initialized");
});
var myPlayer = videojs("HumanBody");
myPlayer.ready(function(){
myPlayer.src([
{ type: "video/mp4", src: "http://pidcgr.com/lobby/humanbody/vid/bodyapp.mp4" },
{ type: "video/ogg", src: "http://pidcgr.com/lobby/humanbody/vid/bodyapp.ogv" }
]);
setTimeout(function() {
if($setPause=="Paused") {
myPlayer.pause();
}
else {
myPlayer.play();
}
myPlayer.on('loadedmetadata', function() {
myPlayer.currentTime($curTime.toFixed(1));
});
}, $timeOutTime);
$(".video-nav").click(function() {
myPlayer.pause();
$curTime = myPlayer.currentTime();
$setPause = "Paused";
});
$("a.start-over").click(function() {
myPlayer.pause();
$curTime = 0;
$setPause = "Go";
});
myPlayer.on('pause', function() {
myPlayer.posterImage.show();
});
myPlayer.on('ended', function() {
myPlayer.currentTime(myPlayer.duration()-1+0.99);
myPlayer.pause();
myPlayer.posterImage.hide();
});
myPlayer.on('error', function() {
console.log("Error");
});
$timeOutTime = 500;
});
});
视频标签如下所示:
<video id="HumanBody" class="video-js vjs-default-skin" width="1024" height="748"></video>
【问题讨论】: