我试图创建一个带有后备功能的简单Kaltura动态播放器,因此我可以观看HTML5内容(如果可能的话),如果不是,则必须是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测试网站上工作:
答案 0 :(得分:1)
为什么你评论了剧本,这对于动态嵌入非常重要。
script type="text/javascript" src="../../../mwEmbedLoader.php?debug=true
将此脚本src替换为src="http://player.kaltura.com/mwEmbedLoader.php"
它应该有效,希望它可以帮助你。