r68490 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r68489‎ | r68490 | r68491 >
Date:22:35, 23 June 2010
Author:dale
Status:deferred
Tags:
Comment:
improved smil timed playback
sync with localization updates
Modified paths:
  • /branches/MwEmbedStandAlone/ResourceLoader.php (modified) (history)
  • /branches/MwEmbedStandAlone/loader.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/ClipEdit/ClipEdit.i18n.php (modified) (history)
  • /branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayer.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/SmilPlayer/mw.EmbedPlayerSmil.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/SmilPlayer/mw.Smil.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilAnimate.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBody.js (modified) (history)

Diff [purge]

Index: branches/MwEmbedStandAlone/loader.js
@@ -52,7 +52,7 @@
5353 'Sequencer',
5454 'TimedText',
5555 'SmilPlayer',
56 - 'MediaRss',
 56+ 'MediaRss',
5757 'SwarmTransport'
5858 ];
5959
Index: branches/MwEmbedStandAlone/ResourceLoader.php
@@ -378,7 +378,7 @@
379379 if( $fileContents ){
380380 // Add the file name if debug is enabled
381381 if ( $this->debug ){
382 - $output .= "\n/**\n* File: " . xml::escapeJsString( $filePath ) . "\n*/\n";
 382+ $output .= "\n\n/**\n* File: " . xml::escapeJsString( $filePath ) . "\n*/\n";
383383 }
384384 // Transform the css output if the file is css
385385 $output.= ( $ext == 'css' ) ?
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBody.js
@@ -126,11 +126,11 @@
127127 if( nodeType == 'par'|| nodeType == 'seq' ) {
128128 if( $node.children().length ) {
129129 $node.children().each( function( inx, childNode ){
130 - mw.log(" recurse:: startOffset:" + nodeType + ' start offset:' + startOffset );
 130+ //mw.log(" recurse:: startOffset:" + nodeType + ' start offset:' + startOffset );
131131 var childDur = _this.getElementsForTimeRecurse( $j( childNode ), time, startOffset);
132132 // If element parent is a 'seq' increment startOffset:
133133 if( nodeType == 'seq' ) {
134 - mw.log(" Parent Seq:: add child dur: " + childDur );
 134+ //mw.log(" Parent Seq:: add child dur: " + childDur );
135135 startOffset += childDur;
136136 }
137137 });
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilAnimate.js
@@ -91,12 +91,12 @@
9292 $j( smilImgElement ).find( 'animate' ).each( function( inx, animateElement ){
9393 var begin = _this.smil.parseTime( $j( animateElement ).attr( 'begin') );
9494 var duration = _this.smil.parseTime( $j( animateElement ).attr( 'dur') );
95 - mw.log( "b:" + begin +" < " + animateTime + " && b+d: " + ( begin + duration ) + " > " + animateTime );
 95+ //mw.log( "b:" + begin +" < " + animateTime + " && b+d: " + ( begin + duration ) + " > " + animateTime );
9696
9797 // Check if the animate element is in range
9898 var cssTransform = {};
9999 if( begin <= animateTime && ( begin + duration ) >= animateTime ) {
100 - // Get the transform type:
 100+ // Get the transform type:
101101 switch( $j( animateElement ).attr('attributeName') ){
102102 case 'panZoom':
103103 // Get the pan zoom css for "this" time
@@ -107,7 +107,7 @@
108108 $j( animateElement ).attr('attributeName') );
109109
110110 }
111 - mw.log("b:transformImageForTime: " + $j( animateElement ).attr( 'values' ) );
 111+ //mw.log("b:transformImageForTime: " + $j( animateElement ).attr( 'values' ) );
112112 //$j( smilImgElement ).css( cssTransform );
113113 }
114114
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.Smil.js
@@ -169,7 +169,7 @@
170170
171171
172172 /**
173 - * Get the duration form the
 173+ * Get the duration form the smil body
174174 */
175175 getDuration: function(){
176176 // return 0 while we don't have the $dom loaded
@@ -182,9 +182,10 @@
183183 }
184184 return this.duration;
185185 },
 186+
186187 /**
187188 * maps a smil element id to a html safe id
188 - * as a decendent subname of the embedPlayer parent
 189+ * as a decedent subname of the embedPlayer parent
189190 *
190191 * @param {Object} smilElement Element to get id for
191192 */
@@ -195,6 +196,7 @@
196197 }
197198 return this.embedPlayer.id + '_' + $j( smilElement ).attr('id');
198199 },
 200+
199201 /**
200202 * Get an absolute path to asset based on the smil URL
201203 * @param {string} assetPath Path to asset to be transformed into url
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.EmbedPlayerSmil.js
@@ -14,14 +14,19 @@
1515 // The jQuery target location to render smil html
1616 $renderTarget: null,
1717
 18+ // Store the actual play time
 19+ smilPlayTime: 0,
 20+
 21+ // Store the pause time
 22+ smilPauseTime: 0,
 23+
1824 // Player supported feature set
1925 supports: {
2026 'playHead' : true,
2127 'pause' : true,
2228 'fullscreen' : true,
2329 'timeDisplay' : true,
24 - 'volumeControl' : true,
25 -
 30+ 'volumeControl' : true,
2631 'overlays' : true
2732 },
2833
@@ -84,12 +89,13 @@
8590
8691 play: function(){
8792 mw.log(" EmbedPlayerSmil::play " );
88 - // call the parent
 93+ // update the interface
8994 this.parent_play();
90 -
91 - this.clockStartTime = new Date().getTime();
92 -
9395
 96+ // Set start clock time:
 97+ this.clockStartTime = new Date().getTime();
 98+
 99+
94100 this.getSmil( function( smil ){
95101 this.smil = smil;
96102 })
@@ -97,33 +103,37 @@
98104 this.monitor();
99105 },
100106
 107+ stop: function(){
 108+ this.smilPlayTime = 0;
 109+ this.smilPauseTime = 0;
 110+ this.parent_stop();
 111+ },
 112+
101113 /**
102114 * Preserves the pause time across for timed playback
103115 */
104 - pause:function() {
105 - mw.log( 'EmbedPlayerSmil::pause at time' + this.currentTime);
106 - var ct = new Date();
107 - this.pauseTime = this.currentTime;
108 - mw.log( 'pause time: ' + this.pauseTime );
 116+ pause: function() {
 117+ mw.log( 'EmbedPlayerSmil::pause at time' + this.smilPlayTime );
 118+ this.smilPauseTime = this.smilPlayTime;
 119+ // Update the interface
 120+ this.parent_pause();
109121 },
110122
111123 /**
112124 * Get the embed player time
113125 */
114126 getPlayerElementTime: function() {
115 - mw.log('html:monitor: '+ this.currentTime + ' ct:' + new Date().getTime() + ' - ' + this.clockStartTime);
116 - this.currentTime = ( ( new Date().getTime() - this.clockStartTime ) / 1000 ) + this.pauseTime;
117 - return this.currentTime;
 127+ return this.smilPlayTime;
118128 },
119129
120130 /**
121131 * Monitor function render a given time
122132 */
123133 monitor: function(){
124 - mw.log("time::" + this.getPlayerElementTime());
125 - /*this.smil.renderTime( , function(){
126 -
127 - });*/
 134+ // Update the smilPlayTime
 135+ if( !this.isPaused() ){
 136+ this.smilPlayTime = this.smilPauseTime + ( ( new Date().getTime() - this.clockStartTime ) / 1000 );
 137+ }
128138 this.parent_monitor();
129139 },
130140
@@ -148,12 +158,15 @@
149159 /**
150160 * Get the duration of smil document.
151161 */
152 - getDuration: function(){
153 - if( this.smil ){
154 - return this.smil.getDuration();
155 - } else {
156 - return this.parent_getDuration();
 162+ getDuration: function(){
 163+ if( !this.duration ){
 164+ if( this.smil ){
 165+ this.duration = this.smil.getDuration();
 166+ } else {
 167+ this.duration = this.parent_getDuration();
 168+ }
157169 }
 170+ return this.duration;
158171 },
159172
160173 /**
Index: branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayer.js
@@ -1750,8 +1750,10 @@
17511751 selectPlayer: function( player ) {
17521752 var _this = this;
17531753 if ( this.selectedPlayer.id != player.id ) {
1754 - this.selectedPlayer = player;
 1754+ this.selectedPlayer = player;
17551755 this.inheritEmbedPlayer( function(){
 1756+ // Hide / remove track container
 1757+ _this.$interface.find( '.track' ).remove();
17561758 // We have to re-bind hoverIntent ( has to happen in this scope )
17571759 if( _this.controls && _this.controlBuilder.checkOverlayControls() ){
17581760 _this.controlBuilder.showControlBar();
@@ -2879,8 +2881,10 @@
28802882 if( _this.volume != _this.previousVolume ) {
28812883 _this.setInterfaceVolume( _this.volume );
28822884 }
 2885+
28832886 // Update the previus volume
2884 - _this.previousVolume = _this.volume;
 2887+ _this.previousVolume = _this.volume;
 2888+
28852889 // Update the volume from the player element
28862890 _this.volume = this.getPlayerElementVolume();
28872891
@@ -2888,9 +2892,9 @@
28892893 if( _this.muted != _this.getPlayerElementMuted() ){
28902894 mw.log("monitor:: muted does not mach embed player" );
28912895 this.toggleMute();
2892 - }
2893 -
2894 - //mw.log(' ct: ' + this.currentTime + ' dur: ' + ( parseInt( this.duration ) + 1 ) + ' is seek: ' + this.seeking );
 2896+ }
 2897+
 2898+ //mw.log( 'Monitor:: ' + this.currentTime + ' duration: ' + ( parseInt( this.getDuration() ) + 1 ) + ' is seek: ' + this.seeking );
28952899 if ( this.currentTime && this.currentTime > 0 && this.duration ) {
28962900 if ( !this.userSlide && !this.seeking ) {
28972901 if ( parseInt( this.startOffset ) != 0 ) {
@@ -2936,12 +2940,17 @@
29372941 $j( this ).trigger( 'progress', this.progressEventData );
29382942 }
29392943
2940 - // Call monitor at 250ms interval.
 2944+ // Call monitor at 250ms interval. ( use setInterval to avoid stacking monitor requests )
29412945 if( ! this.isStoped() ) {
2942 - setTimeout( function(){
2943 - _this.monitor();
2944 - }, 250 )
2945 - }
 2946+ if( !this.monitorInterval ){
 2947+ this.monitorInterval = setInterval( function(){
 2948+ _this.monitor();
 2949+ }, 250 )
 2950+ }
 2951+ } else {
 2952+ // If stoped "stop" monitor:
 2953+ clearInterval( this.monitorInterval );
 2954+ }
29462955
29472956 //mw.log('trigger:monitor:: ' + this.currentTime );
29482957 $j( this ).trigger( 'monitorEvent' );
Index: branches/MwEmbedStandAlone/modules/ClipEdit/ClipEdit.i18n.php
@@ -437,7 +437,9 @@
438438 'mwe-clipedit-layout_left' => 'Disposición da imaxe do lado esquerdo',
439439 );
440440
441 -/** Swiss German (Alemannisch) */
 441+/** Swiss German (Alemannisch)
 442+ * @author Als-Holder
 443+ */
442444 $messages['gsw'] = array(
443445 'mwe-clipedit-crop' => 'Bild zueschnyde',
444446 'mwe-clipedit-apply_crop' => 'Bild zueschnyde',
@@ -446,6 +448,7 @@
447449 'mwe-clipedit-insert_into_sequence' => 'In dr Abschnitt yyfiege',
448450 'mwe-clipedit-preview_insert' => 'Vorschau vu dr Yyfiegig',
449451 'mwe-clipedit-cancel_image_insert' => 'S Yyfiege ruckgängig mache',
 452+ 'mwe-clipedit-sc_attributes' => 'Videoclip-Detail bearbeite',
450453 'mwe-clipedit-sc_inoutpoints' => 'Aa-Uus-Pinkt setze',
451454 'mwe-clipedit-sc_overlays' => 'Overlays',
452455 'mwe-clipedit-sc_audio' => 'Audioyystellige',
@@ -463,6 +466,9 @@
464467 'mwe-clipedit-inline-description' => 'Bschryybig',
465468 'mwe-clipedit-edit-video-tools' => 'Video-Bearbeitigswärchzyyg:',
466469 'mwe-clipedit-duration' => 'Duur:',
 470+ 'mwe-clipedit-layout' => 'Uusrichtig',
 471+ 'mwe-clipedit-layout_right' => 'Bild uf dr rächte Syte',
 472+ 'mwe-clipedit-layout_left' => 'Bild uf dr linke Syte',
467473 );
468474
469475 /** Hebrew (עברית) */
@@ -720,16 +726,20 @@
721727 'mwe-clipedit-insert_into_sequence' => "An d'Sequenz drasetzen",
722728 'mwe-clipedit-preview_insert' => 'Drasetze kucken ouni ze späicheren',
723729 'mwe-clipedit-cancel_image_insert' => 'Drasetzen ofbriechen',
 730+ 'mwe-clipedit-sc_attributes' => 'Detailer vum Videclip änneren',
 731+ 'mwe-clipedit-sc_inoutpoints' => 'Eran-Eraus Punkte festleeën',
724732 'mwe-clipedit-sc_audio' => 'Audiosteierung',
725733 'mwe-clipedit-sc_duration' => 'Dauer',
726734 'mwe-clipedit-template_properties' => 'Eegeschafte vun der Schabloun',
727735 'mwe-clipedit-custom_title' => 'Personaliséierten Titel',
728736 'mwe-clipedit-edit_properties' => 'Eegeschaften änneren',
729737 'mwe-clipedit-other_properties' => 'Aner Eegeschaften',
 738+ 'mwe-clipedit-set_in_out_points' => 'Eran-Eraus Punkte festleeën',
730739 'mwe-clipedit-start_time' => 'Ufankszäit',
731740 'mwe-clipedit-end_time' => 'Schlusszäit',
732741 'mwe-clipedit-edit-tools' => "Handwierksgeschir fir z'änneren",
733742 'mwe-clipedit-inline-description' => 'Beschreiwung',
 743+ 'mwe-clipedit-edit-video-tools' => 'Video-Tools änneren:',
734744 'mwe-clipedit-duration' => 'Dauer:',
735745 'mwe-clipedit-layout' => 'Layout',
736746 );
@@ -900,6 +910,16 @@
901911 'mwe-clipedit-duration' => 'Czas trwania',
902912 );
903913
 914+/** Pashto (پښتو)
 915+ * @author Ahmed-Najib-Biabani-Ibrahimkhel
 916+ */
 917+$messages['ps'] = array(
 918+ 'mwe-clipedit-sc_duration' => 'موده',
 919+ 'mwe-clipedit-start_time' => 'د پيل وخت',
 920+ 'mwe-clipedit-end_time' => 'د پای وخت',
 921+ 'mwe-clipedit-duration' => 'موده:',
 922+);
 923+
904924 /** Portuguese (Português)
905925 * @author Hamilton Abreu
906926 */
@@ -934,8 +954,12 @@
935955 'mwe-clipedit-layout_left' => 'Imagem posicionada à esquerda',
936956 );
937957
938 -/** Brazilian Portuguese (Português do Brasil) */
 958+/** Brazilian Portuguese (Português do Brasil)
 959+ * @author Giro720
 960+ */
939961 $messages['pt-br'] = array(
 962+ 'mwe-clipedit-crop' => 'Recortar imagem',
 963+ 'mwe-clipedit-apply_crop' => 'Aplicar corte à imagem',
940964 'mwe-clipedit-reset_crop' => 'Reiniciar corte',
941965 'mwe-clipedit-insert_image_page' => 'Inserir na página',
942966 'mwe-clipedit-insert_into_sequence' => 'Inserir na sequência',
@@ -1056,6 +1080,38 @@
10571081 'mwe-clipedit-layout_left' => 'Изглед с леве стране слике',
10581082 );
10591083
 1084+/** Serbian Latin ekavian (Srpski (latinica)) */
 1085+$messages['sr-el'] = array(
 1086+ 'mwe-clipedit-crop' => 'Iseci sliku',
 1087+ 'mwe-clipedit-apply_crop' => 'Primeni isecanje slike',
 1088+ 'mwe-clipedit-reset_crop' => 'Poništi isecanje',
 1089+ 'mwe-clipedit-insert_image_page' => 'Ubaci u stranicu',
 1090+ 'mwe-clipedit-insert_into_sequence' => 'Ubaci u niz',
 1091+ 'mwe-clipedit-preview_insert' => 'Pretpregled umetka',
 1092+ 'mwe-clipedit-cancel_image_insert' => 'Poništi umetak',
 1093+ 'mwe-clipedit-sc_attributes' => 'Uredi podatke snimka',
 1094+ 'mwe-clipedit-sc_inoutpoints' => 'Postavi u-van tačke',
 1095+ 'mwe-clipedit-sc_overlays' => 'Preklapanja',
 1096+ 'mwe-clipedit-sc_audio' => 'Audio kontrola',
 1097+ 'mwe-clipedit-sc_duration' => 'Trajanje',
 1098+ 'mwe-clipedit-template_properties' => 'Svojstva šablona',
 1099+ 'mwe-clipedit-custom_title' => 'Prilagođeni naslov',
 1100+ 'mwe-clipedit-edit_properties' => 'Izmeni svojstva',
 1101+ 'mwe-clipedit-other_properties' => 'Ostala svojstva',
 1102+ 'mwe-clipedit-resource_page' => 'Izvorna stranica:',
 1103+ 'mwe-clipedit-set_in_out_points' => 'Postavi u-van tačke',
 1104+ 'mwe-clipedit-start_time' => 'Početno vreme',
 1105+ 'mwe-clipedit-end_time' => 'Završno vreme',
 1106+ 'mwe-clipedit-preview_inout' => 'Pregledaj u-van tačke',
 1107+ 'mwe-clipedit-edit-tools' => 'Uredi alatke',
 1108+ 'mwe-clipedit-inline-description' => 'Naslov',
 1109+ 'mwe-clipedit-edit-video-tools' => 'Uredi video alatke:',
 1110+ 'mwe-clipedit-duration' => 'Trajanje:',
 1111+ 'mwe-clipedit-layout' => 'Izgled',
 1112+ 'mwe-clipedit-layout_right' => 'Izgled s desne strane slike',
 1113+ 'mwe-clipedit-layout_left' => 'Izgled s leve strane slike',
 1114+);
 1115+
10601116 /** Swedish (Svenska)
10611117 * @author Dafer45
10621118 */

Status & tagging log