r59172 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r59171‎ | r59172 | r59173 >
Date:14:33, 17 November 2009
Author:dale
Status:deferred
Tags:
Comment:
* added sequence render example
* added kdp kaltrua player fallback support
Modified paths:
  • /trunk/phase3/js2/mwEmbed/binPlayers/kaltura-player (added) (history)
  • /trunk/phase3/js2/mwEmbed/binPlayers/kaltura-player/README (added) (history)
  • /trunk/phase3/js2/mwEmbed/binPlayers/kaltura-player/kdp.swf (added) (history)
  • /trunk/phase3/js2/mwEmbed/binPlayers/kaltura-player/wrapper.swf (added) (history)
  • /trunk/phase3/js2/mwEmbed/example_usage/Sequence_Render.html (added) (history)
  • /trunk/phase3/js2/mwEmbed/libEmbedVideo/embedVideo.js (modified) (history)
  • /trunk/phase3/js2/mwEmbed/libEmbedVideo/kplayerEmbed.js (modified) (history)
  • /trunk/phase3/js2/mwEmbed/mv_embed.js (modified) (history)

Diff [purge]

Index: trunk/phase3/js2/mwEmbed/example_usage/Sequence_Render.html
@@ -0,0 +1,68 @@
 2+<!doctype html>
 3+<html>
 4+<head>
 5+ <title>Seeking Render Example</title>
 6+ <script type="text/javascript" src="../mv_embed.js?debug=true"></script>
 7+ <style>
 8+ #render_box {
 9+ position:absolute;
 10+ width:320px;
 11+ height:240px;
 12+ }
 13+
 14+ </style>
 15+ <script>
 16+mwAddOnloadHook(function(){
 17+
 18+ $j('#render_player').firefoggRender({
 19+ 'render_options':{
 20+ "framerate" : 30
 21+ },
 22+ 'target_startRender':'#buttonStart',
 23+ 'target_stopRender': '#buttonStop',
 24+ 'target_timeStatus': '#time_status'
 25+
 26+ },function( foggRender ){
 27+ $j('#loading_text').hide();
 28+ if( foggRender.enabled ){
 29+ $j('#info_control').show();
 30+ }else{
 31+ $j('#info_control').html(
 32+ foggRender.myFogg.getTargetHtml('target_please_install')
 33+ );
 34+ if(!($j.browser.mozilla && $j.browser.version >= '1.9.1')) {
 35+ $j('#info_control').html(
 36+ foggRender.myFogg.getTargetHtml('target_use_latest_fox')
 37+ );
 38+ }
 39+ }
 40+ });
 41+
 42+});
 43+ </script>
 44+</head>
 45+<body>
 46+<playlist id="render_player" src="media/sample_smil.xml" controls="false" width="320" height="240"></playlist>
 47+
 48+<!-- <video id="render_player"
 49+ durationHint="27"
 50+ src="http://upload.wikimedia.org/wikipedia/commons/4/41/Panthera_tigris8.ogg"
 51+ style="width:320px;height:240px;"
 52+ controls="false"
 53+ poster="http://upload.wikimedia.org/wikipedia/commons/thumb/4/41/Panthera_tigris8.ogg/mid-Panthera_tigris8.ogg.jpg">
 54+</video>
 55+-->
 56+
 57+
 58+<span id="loading_text" style="position:absolute; top:320px;">
 59+loading render system <blink>...</blink>
 60+</span>
 61+<div id="info_control" style="display:none;">
 62+ <button id="buttonStart">Do Render</button>
 63+ <button id="buttonStop">Stop</button>
 64+ Current Time: <input type="text" id="time_status" value="0.0" />
 65+ <span id="status"></span><br>
 66+</div>
 67+
 68+</body>
 69+</html>
Index: trunk/phase3/js2/mwEmbed/binPlayers/kaltura-player/kdp.swf
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes on: trunk/phase3/js2/mwEmbed/binPlayers/kaltura-player/kdp.swf
___________________________________________________________________
Name: svn:mime-type
170 + application/octet-stream
Name: svn:executable
271 + *
Index: trunk/phase3/js2/mwEmbed/binPlayers/kaltura-player/README
@@ -0,0 +1,11 @@
 2+This Kaltura Dynamic Player +Playlist (KDP) is a sub package of the taken Kaltura Community Edition (CE) Built from Kaltura.org source.
 3+
 4+The full Kaltura Community Edition is licensed under the (GNU Affero General Public License v3)
 5+
 6+And the source code is available on the kaltura.org site:
 7+http://www.kaltura.org/project/kalturaCE
 8+
 9+More info about the KDP:
 10+http://www.kaltura.org/kdp-dynamic-player-and-playlist-widget
 11+
 12+
Index: trunk/phase3/js2/mwEmbed/binPlayers/kaltura-player/wrapper.swf
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes on: trunk/phase3/js2/mwEmbed/binPlayers/kaltura-player/wrapper.swf
___________________________________________________________________
Name: svn:mime-type
113 + application/octet-stream
Name: svn:executable
214 + *
Index: trunk/phase3/js2/mwEmbed/mv_embed.js
@@ -526,8 +526,8 @@
527527 * This is not feature complete but we need a way to get at template properties
528528 *
529529 *
530 - * @param wikiText the wikitext to be parsed
531 - * @return parserObj returns a parser object that has methods for getting at
 530+ * @param {String} wikiText the wikitext to be parsed
 531+ * @return {Object} parserObj returns a parser object that has methods for getting at
532532 * things you would want
533533 */
534534 $.parser = { };
Index: trunk/phase3/js2/mwEmbed/libEmbedVideo/kplayerEmbed.js
@@ -11,58 +11,119 @@
1212 },
1313 getEmbedHTML : function () {
1414 var embed_code = this.getEmbedObj();
15 - // setTimeout('$j(\'#' + this.id + '\').get(0).postEmbedJS()', 2000);
 15+ var _this = this;
 16+ setTimeout(function(){
 17+ _this.postEmbedJS();
 18+ }, 50);
1619 js_log( "return embed html" );
1720 return this.wrapEmebedContainer( embed_code );
1821 },
19 - getEmbedObj:function() {
20 - var player_path = mv_embed_path + 'binPlayers/kaltura-player/player.swf';
21 - return '<object id="' + this.pid + '" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ' +
22 - 'width="' + this.width + '" height="' + this.height + '">' +
23 - '<param name="movie" value="' + player_path + '" />' +
24 - '<param name="allowfullscreen" value="true" />' +
25 - '<param name="allowscriptaccess" value="always" />' +
26 - '<param name="flashvars" value="file=video.flv&image=preview.jpg" />' +
27 - '<embed ' +
28 - 'type="application/x-shockwave-flash" ' +
29 - 'id="' + this.pid + '" ' +
30 - 'src="' + player_path + '" ' +
31 - 'width="' + this.width + '" ' +
32 - 'height="' + this.height + '" ' +
33 - 'allowscriptaccess="always" ' +
34 - 'allowfullscreen="true" ' +
35 - 'flashvars="autostart=true&file=' + escape( this.getSrc() ) + '" ' +
36 - '/>' +
37 - '</object>';
38 - /*return '<object id="'+this.pid+'" type="application/x-shockwave-flash"'+
39 - 'allowScriptAccess="always" allowNetworking="all" allowFullScreen="true" '+
40 - 'height="'+ parseInt(this.height) + '" ' +
41 - 'width="' + parseInt(this.width) + '" ' +
42 - 'data="http://www.kaltura.com/index.php/kwidget/wid/_309/uiconf_id/1000106">'+
43 - '<param name="allowScriptAccess" value="always"/>'+
44 - '<param name="allowNetworking" value="all"/>'+
45 - '<param name="allowFullScreen" value="true"/>'+
46 - '<param name="bgcolor" value="#000000"/>'+
47 - '<param name="movie" value="http://www.kaltura.com/index.php/kwidget/wid/_0/uiconf_id/1000106"/>'+
48 - '<param name="flashVars" value="emptyF=onKdpEmpty&readyF=onKdpReady&'+
49 - //set the url:
50 - 'entryId=' + escape( this.getSrc() ) + '"/>'+
51 - '<param name="wmode" value="opaque"/>'+
52 - '</object>'; */
 22+ getEmbedObj:function() {
 23+ var player_path = mv_embed_path + 'binPlayers/kaltura-player';
 24+ return '<object width="' + this.width + '" height="' + this.height + '" '+
 25+ 'data="' + player_path + '/wrapper.swf" allowfullscreen="true" '+
 26+ 'allownetworking="all" allowscriptaccess="always" '+
 27+ 'type="application/x-shockwave-flash" '+
 28+ 'id="' + this.pid + '" name="' + this.pid + '">'+
 29+ '<param value="always" name="allowScriptAccess"/>'+
 30+ '<param value="all" name="allowNetworking"/>'+
 31+ '<param value="true" name="allowFullScreen"/>'+
 32+ '<param value="#000000" name="bgcolor"/>'+
 33+ '<param value="wrapper.swf" name="movie"/>'+
 34+ '<param value="' +
 35+ 'kdpUrl=' + player_path + '/kdp.swf' +
 36+ '&ks=dummy&partner_id=0&subp_id=0' +
 37+ '&uid=0&emptyF=onKdpEmpty&readyF=onKdpReady' +
 38+ '" ' +
 39+ 'name="flashVars"/>'+
 40+ '<param value="opaque" name="wmode"/>'+
 41+ '</object>';
5342 },
5443 postEmbedJS:function() {
55 - this.monitor();
 44+ var _this = this;
 45+ this.getKDP();
 46+ if( this.kdp && this.kdp.insertMedia){
 47+
 48+ // Add KDP listeners
 49+
 50+ //this.kdp.addJsListener("doPlay","kdpDoOnPlay");
 51+ //this.kdp.addJsListener("doStop","kdpDoOnStop");
 52+ //myKdp.addJsListener("fastForward","kdpDoOnFF");
 53+
 54+ _this.bindKdpFunc( 'doPause', 'kdpPause' );
 55+ _this.bindKdpFunc( 'doPlay', 'play' );
 56+ _this.bindKdpFunc( 'playerPlayEnd', 'onClipDone' );
 57+
 58+ // Insert the src:
 59+ this.kdp.insertMedia("-1",'http://192.168.192.90/kskin/kplayer-examples/media/bbb.flv','true');
 60+ this.kdp.dispatchKdpEvent('doPlay');
 61+
 62+ // Start the monitor
 63+ this.monitor();
 64+ }else{
 65+ setTimeout( function(){
 66+ _this.postEmbedJS();
 67+ }, 25);
 68+ }
5669 },
 70+ /**
 71+ * bindKdpFunc
 72+ *
 73+ * @param {String} flash binding name
 74+ * @param {String} function callback name
 75+ */
 76+ bindKdpFunc:function( bName, fName ){
 77+ var cbid = fName + '_cb_' + this.id.replace(' ', '_');
 78+ eval( 'window[ \'' + cbid +'\' ] = function(){$j(\'#' + this.id + '\').get(0).'+ fName +'();}' );
 79+ this.kdp.addJsListener( bName , cbid);
 80+ },
 81+ kdpPause:function(){
 82+ this.parent_pause();
 83+ },
 84+ play:function() {
 85+ if( this.kdp && this.kdp.dispatchKdpEvent )
 86+ this.kdp.dispatchKdpEvent('doPlay');
 87+ this.parent_play();
 88+ },
5789 pause:function() {
58 - this.stop();
 90+ this.kdp.dispatchKdpEvent('doPause');
 91+ this.parent_pause();
5992 },
60 - monitor:function() {
61 - // this.parent_monitor();
 93+ doSeek:function( prec ){
 94+ var _this = this;
 95+ if( this.kdp ){
 96+ var seek_time = prec * this.getDuration();
 97+ this.kdp.dispatchKdpEvent('doSeek', seek_time);
 98+ // Kdp is missing seek done callback
 99+ setTimeout(function(){
 100+ _this.seeking= false;
 101+ },500);
 102+ }
 103+ this.monitor();
 104+ },
 105+ updateVolumen:function( perc ) {
 106+ if( this.kdp && this.kdp.dispatchKdpEvent )
 107+ this.kdp.dispatchKdpEvent('volumeChange', perc);
 108+ },
 109+ monitor:function() {
 110+ if( this.kdp && this.kdp.getMediaSeekTime ){
 111+ this.currentTime = this.kdp.getMediaSeekTime();
 112+ }
 113+ this.parent_monitor();
 114+ },
 115+ // get the embed fla object
 116+ getKDP: function () {
 117+ this.kdp = document.getElementById( this.pid );
62118 }
63119 }
64120
 121+function kdpDoOnPause( player ){
 122+ var cat = player
 123+ debugger;
 124+}
 125+
65126 function onKdpReady( playerId ) {
66 - js_log( "IN THEORY PLAYER IS READY" );
 127+ js_log( "IN THEORY PLAYER IS READY:" + playerId);
67128 /*
68129 window.myKdp=get(playerId);
69130 get("Player_State").innerHTML="<br>&nbsp; READY (Id=" + playerId + ")";
Index: trunk/phase3/js2/mwEmbed/libEmbedVideo/embedVideo.js
@@ -41,6 +41,7 @@
4242 "mwe-ogg-player-quicktime-activex" : "QuickTime ActiveX",
4343 "mwe-ogg-player-cortado" : "Java Cortado",
4444 "mwe-ogg-player-flowplayer" : "Flowplayer",
 45+ "mwe-ogg-player-kplayer" : "Kaltura player",
4546 "mwe-ogg-player-selected" : "(selected)",
4647 "mwe-ogg-player-omtkplayer" : "OMTK Flash Vorbis",
4748 "mwe-generic_missing_plugin" : "You browser does not appear to support the following playback type: <b>$1<\/b><br \/>Visit the <a href=\"http:\/\/commons.wikimedia.org\/wiki\/Commons:Media_help\">Playback Methods<\/a> page to download a player.<br \/>",
@@ -877,14 +878,9 @@
878879 this.duration = parseFloat( this.duration );
879880 js_log( "duration is: " + this.duration );
880881
881 - // Get defaults
882 - var dwh = mw.conf['video_size'].split( 'x' );
883 - this.width = element.style.width ? element.style.width : dwh[0];
884 - if ( element.tagName == 'AUDIO' ) {
885 - this.height = element.style.height ? element.style.height : 0;
886 - } else {
887 - this.height = element.style.height ? element.style.height : dwh[1];
888 - }
 882+
 883+ this.setDimSize( element, 'width' );
 884+ this.setDimSize( element, 'height' );
889885
890886 // Set the plugin id
891887 this.pid = 'pid_' + this.id;
@@ -908,6 +904,17 @@
909905 // Load skin:
910906 loadExternalCss( mv_embed_path + 'skins/' + this.skin_name + '/playerSkin.css' );
911907 },
 908+ // Function for set width height from attributes or by default value
 909+ setDimSize:function( element, dim ){
 910+ var dcss = parseInt( $j(element).css( dim ).replace( 'px' , '' ) );
 911+ var dattr = parseInt( $j(element).attr( dim ) );
 912+ this[ dim ] = ( dcss )? dcss : dattr;
 913+ if(!this[ dim ]){
 914+ // Grab width/height from default value
 915+ var dwh = mw.conf['video_size'].split( 'x' );
 916+ this[ dim ] = ( dim == 'width' )? dwh[0] : dwh[1];
 917+ }
 918+ },
912919 on_dom_swap: function() {
913920 js_log( 'f:on_dom_swap' );
914921 // Process the provided ROE file... if we don't yet have sources
@@ -2010,14 +2017,16 @@
20112018 * must be overwritten by embed object to support this functionality.
20122019 */
20132020 pause: function() {
 2021+ var _this = this;
20142022 var eid = ( this.pc != null ) ? this.pc.pp.id:this.id;
20152023 // js_log('mv_embed:do pause');
20162024 // (playing) do pause
20172025 this.paused = true;
 2026+ var $pt = $j( '#' + eid);
20182027 // update the ctrl "paused state"
2019 - $j( '#' + eid + ' .play-btn span' ).removeClass( 'ui-icon-pause' ).addClass( 'ui-icon-play' );
2020 - $j( '#' + eid + ' .play-btn' ).unbind().btnBind().click( function() {
2021 - $j( '#' + eid ).get( 0 ).play();
 2028+ $pt.find('.play-btn span' ).removeClass( 'ui-icon-pause' ).addClass( 'ui-icon-play' );
 2029+ $pt.find('.play-btn' ).unbind().btnBind().click( function() {
 2030+ _this.play();
20222031 } ).attr( 'title', gM( 'mwe-play_clip' ) );
20232032 },
20242033 /**
@@ -2337,8 +2346,8 @@
23382347 /* players and supported mime types
23392348 @@note ideally we query the plugin to get what mime types it supports in practice not always reliable/avaliable
23402349 */
2341 -var flowPlayer = new mediaPlayer( 'flowplayer', ['video/x-flv', 'video/h264'], 'flowplayer' );
2342 -// var kplayer = new mediaPlayer('kplayer', ['video/x-flv', 'video/h264'], 'kplayer');
 2350+//var flowPlayer = new mediaPlayer( 'flowplayer', ['video/x-flv', 'video/h264'], 'flowplayer' );
 2351+var kplayer = new mediaPlayer('kplayer', ['video/x-flv', 'video/h264'], 'kplayer');
23432352
23442353 var omtkPlayer = new mediaPlayer( 'omtkplayer', ['audio/ogg'], 'omtk' );
23452354
@@ -2377,8 +2386,8 @@
23782387 this.loadPreferences();
23792388
23802389 // set up default players order for each library type
2381 - this.default_players['video/x-flv'] = ['flowplayer', 'vlc'];
2382 - this.default_players['video/h264'] = ['flowplayer', 'vlc'];
 2390+ this.default_players['video/x-flv'] = ['kplayer', 'vlc'];
 2391+ this.default_players['video/h264'] = ['kplayer', 'vlc'];
23832392
23842393 this.default_players['video/ogg'] = ['native', 'vlc', 'java', 'generic'];
23852394 this.default_players['application/ogg'] = ['native', 'vlc', 'java', 'generic'];
@@ -2560,8 +2569,8 @@
25612570 // flowplayer has pretty good compatiablity
25622571 // (but if we wanted to be fancy we would check for version of flash and update the mp4/h.264 support
25632572
2564 - // this.players.addPlayer( kplayer );
2565 - this.players.addPlayer( flowPlayer );
 2573+ this.players.addPlayer( kplayer );
 2574+ //this.players.addPlayer( flowPlayer );
25662575 }
25672576 // VLC
25682577 if ( this.testActiveX( 'VideoLAN.VLCPlugin.2' ) )
@@ -2649,8 +2658,8 @@
26502659 }*/
26512660 if ( type == 'application/x-shockwave-flash' ) {
26522661
2653 - // this.players.addPlayer( kplayer );
2654 - this.players.addPlayer( flowPlayer );
 2662+ this.players.addPlayer( kplayer );
 2663+ //this.players.addPlayer( flowPlayer );
26552664
26562665 // check version to add omtk:
26572666 var flashDescription = navigator.plugins["Shockwave Flash"].description;

Status & tagging log