1

I was just upgrading my app to the new videojs version 4.0, but it is now not working for iPad (works on all other browsers as far as I can tell).

The 4.0 skin doesn't appear, and the API appears to not work at all. The video is being used as a background and is controlled by buttons in the app. However, after the upgrade, the video causes all of the buttons to become un-clickable (or un-touchable if you will).

Here's the JS I'm working with.

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;
});
});

The video tag looks like this:

<video id="HumanBody" class="video-js vjs-default-skin" width="1024" height="748"></video>

Preview the URL here: http://pidcgr.com/lobby/humanbody/

4

2 回答 2

5

您似乎可以设置一个新的(尚未记录的?)选项,它将禁用 iPad 和 Android 设备上的默认控件并显示 videojs 皮肤:customControlsOnMobile

所以设置videojs:

$( '#main' ).on( 'pageshow',function(event){
videojs("HumanBody", {"preload":"metadata","poster":"http://pidcgr.com/lobby/humanbody/vid/poster.png","controls":true, "customControlsOnMobile": true}, function(){
});

问候,菲利普

于 2013-05-14T19:54:09.643 回答
0

在最新版本中,该选项已更改为“nativeControlsForTouch”。对于试图在源代码中找到 customControlsOnMobile 的人。

于 2014-01-09T07:54:25.243 回答