2

I'm trying to create a simple Kaltura Dynamic Player with a fallback-Function, so I can watch HTML5-Content if it is possible and if not it has to be Flash. This is my code and I think it is just pretty the Default Code from 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>          

What I get if I run the code is:

Uncaught ReferenceError: kWidget is not defined

The same code is working on the Kaltura Test Website:

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

double-beep
  • 3,889
  • 12
  • 24
  • 35
AccNeeder
  • 93
  • 13

1 Answers1

2

Why did you commented the script, its very crucial to play the dynamic embed.

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

replace this script src with src="http://player.kaltura.com/mwEmbedLoader.php" It should works, hope it helps you.

Shell
  • 6,460
  • 9
  • 34
  • 68
DevGo
  • 907
  • 1
  • 12
  • 38