从JWPlayer切换到Flowplayer

时间:2012-10-13 05:05:48

标签: javascript html video jwplayer flowplayer

我正在尝试为Subsonic构建一个Web界面,并试图将其JWPlayer的默认实现切换为Flowplayer。

我尝试了在JWPlayer和Flowplayer中加载视频的默认方法,但都没有用,所以我查看了使用下面相关代码的现有界面:

var player;
var position;
var maxBitRate = 1000;
var timeOffset = 0;

function init() {
    var flashvars = {
        id:"player1",
        skin:"flash/whotube.zip",
        screencolor:"000000",
        controlbar:"over",
        autostart:"false",
        bufferlength:3,
        backcolor:"EFEFEF",
        frontcolor:"000000",
        provider:"video"
    };
    var params = {
        allowfullscreen:"true",
        allowscriptaccess:"always"
    };
    var attributes = {
        id:"player1",
        name:"player1"
    };

    var width = "100%";
    var height = "85%";
    swfobject.embedSWF("flash/jw-player-5.6.swf", "placeholder1", width, height, "9.0.0", false, flashvars, params, attributes);
}

function playerReady(thePlayer) {
    player = $("player1");
    player.addModelListener("TIME", "timeListener");
    play();    
}

function play() {
    var list = new Array();
    list[0] = {
        file:"http://domain.com:4040/rest/stream.view?u=username&p=password&v=1.6.0&c=appname&id=number",
        duration:9999 - timeOffset, //testing value for duration
        provider:"video"
    };
    player.sendEvent("LOAD", list);
    player.sendEvent("PLAY");
}

我甚至不能在flowplayer下运​​行任何东西。有任何想法吗?我被困在:

  1. 获得与playerReady();
  2. 等效的内容
  3. 使用以下方式加载视频:

    flowplayer.addClip({ 'URL':videoURL},0); flowplayer.play({ 'URL':videoURL},0);

  4. 这给了我:没有方法'addClip'并且没有方法'play'

    我的JS包括FlowPlayer和JWPlayer: 的Flowplayer-3.2.11.min.js jQuery的 原型 swfobject的 和我自己的JS文件,上面是一个片段。

    非常感谢帮助。

    谢谢,

1 个答案:

答案 0 :(得分:0)

flowplayer("player", "flowplayer-3.2.15.swf", {
            clip: {
                scaling: 'orig'
            },
            plugins: {
                controls: null
            },
            // player events are defined directly to "root" (not inside a clip)
            onLoad: function() {
                $f().play({url: "http://pseudo01.hddn.com/vod/demo.flowplayervod/Extremists.flv"});
            }
        });