开发者

trapping a jplayer error

Using jplayer 2. When a user comes to our website and trys to play a video, a 'media could not be loaded' error occurs if they are using an older version of IE and do not have Adobe Flash installed. I would like to be able to test for this condition and send them to the Flash site download site instead of allowing the generic error to occur.

Here is the video call开发者_运维问答:

$("#jquery_jplayer_1").jPlayer({
    errorAlerts: true,
    ready: function ()
    {
        $(this).jPlayer("setMedia", {
            m4v: "http://www.parrotsoftware.com/default/videos/parrotcamproj.m4v",
            poster: "http://www.parrotsoftware.com/default/videos/peopleall.png"
        });
    },
    swfPath: "js",
    solution: "html,flash",
    supplied: "m4v"
});

Here is the active link: http://www.parrotsoftware.com/default/default.aspx click the play button in the video player.


just bind an error callback.. and test 'event.jPlayer.error.type', see: http://www.jplayer.org/latest/developer-guide/#jPlayer-event-error-codes

$("#jquery_jplayer_1").jPlayer({
    errorAlerts: true,
    ready: function ()
    {
        $(this).jPlayer("setMedia", {
            m4v: "http://www.parrotsoftware.com/default/videos/parrotcamproj.m4v",
            poster: "http://www.parrotsoftware.com/default/videos/peopleall.png"
        });
    },
    error: function (event) {
        console.log(event.jPlayer.error);
        console.log(event.jPlayer.error.type);
    },
    swfPath: "js",
    solution: "html,flash",
    supplied: "m4v"
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜