我正在尝试创建一个具有后备功能的简单Kaltura Dynamic Player,因此我可以观看HTML5-Content(如果可能),如果不能,则必须为Flash。这是我的代码,我认为这只是kaltura的默认代码:

<!DOCTYPE HTML>
<html>
<head>
<title>kWidget Player test</title>
<script type="text/javascript" src="http://www.kaltura.org/kalorg/html5video/trunk/mwEmbed/modules/KalturaSupport/tests/resources/qunit-kaltura-bootstrap.js"></script>
<script type="text/javascript" src="http://html5.medianac.nacamar.de/js/mwEmbedLoader.js"> </script>
<!--<script type="text/javascript" src="../../../mwEmbedLoader.php?debug=true">      </script>-->
<script type="text/javascript">
window.kWidgetCallbackWithID = false;
function jsKalturaPlayerTest( videoId ){

// Name this module
module( "kWidget Player" );

var $iframe = $('#' + videoId + '_ifp').contents();
var kdp =  $('#' + videoId ).get(0);

test( "Iframe in DOM", function() {
    ok( $('#' + videoId + '_ifp').length , 'iframe found' );
});

asyncTest("Inline readyCallback fired", function(){
    kalturaQunitWaitForPlayer(function(){
        equal( window.kWidgetCallbackWithID, videoId, " ReadyCallback fired with id:" + videoId );
        testAutoPlay();
        // done with async
        start();
    });
});

function testAutoPlay(){
    test("AutoPlay flashvar passing", function(){ok( kdp.evaluate('{configProxy.flashvars.autoPlay}') , 'AutoPlay flashvar set');
    });
}
}
function readyCallbackFired( playerId ){
window.kWidgetCallbackWithID = playerId;
}
</script>
<!-- qunit-kaltura must come after qunit-bootstrap.js and after mwEmbedLoader.php and after any jsCallbackReady stuff-->
<script type="text/javascript" src="http://www.kaltura.org/kalorg/html5video/trunk/mwEmbed/modules/KalturaSupport/tests/re sources/qunit-kaltura-bootstrap.js"></script>
</head>
<body>
<h2> kWidget Player test </h2>
<a href="?forceMobileHTML5"> Force Mobile HTML5</a> for testing with desktop chrome and safari.
<br />

<div id="kaltura_player" style="width:400px;height:330px;">
<!--  SEO and video metadata go here -->
<span property="dc:description" content="example"></span>
<span property="media:title" content="DFA_Imagefilm_deutsch.mp4"></span>
<span property="media:width" content="390"></span>
<span property="media:height" content="236"></span>
</div>
<script>
window['doPlayCallback'] = function( playerId ){
    console.log( 'kWidget doPlayCallback ' + playerId );
    //$('body').append( '<div>started playback</div>' );
};
kWidget.embed({
    'targetId': 'kaltura_player',
    'wid': '_593',
    'uiconf_id' : '1003463',
    'entry_id' : '0_9ufbiq19',
    'flashvars':{
        'externalInterfaceDisabled' : false,
        'autoPlay' : true
                    //'fooBar': 'cats'
    },
    'readyCallback': function( playerId ){
        console.log( "kWidget player ready: " + playerId );
        var kdp = $('#' + playerId ).get(0);
        kdp.addJsListener( 'doPlay', 'doPlayCallback');
        readyCallbackFired( playerId );
    }
});
</script>
</body>
</html>


如果运行代码,我将得到:


  未捕获的ReferenceError:未定义kWidget


相同的代码正在Kaltura测试网站上运行:

http://player.kaltura.com/docs/kwidget

最佳答案

您为什么评论脚本,脚本对于动态嵌入至关重要。

script type="text/javascript" src="../../../mwEmbedLoader.php?debug=true


将此脚本src替换为src="http://player.kaltura.com/mwEmbedLoader.php"
它应该起作用,希望对您有帮助。

08-08 05:22