r70213 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r70212‎ | r70213 | r70214 >
Date:02:26, 31 July 2010
Author:dale
Status:deferred
Tags:
Comment:
sequencer debug undo redo
minor resource loader fix for ; or \n resource loader request line break
improved error messages
minor fixes to embedPlayer
Modified paths:
  • /branches/MwEmbedStandAlone/ResourceLoader.php (modified) (history)
  • /branches/MwEmbedStandAlone/includes/NamedResourceLoader.php (modified) (history)
  • /branches/MwEmbedStandAlone/modules/EmbedPlayer/loader.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayer.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayerNative.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/EmbedPlayer/skins/mw.PlayerControlBuilder.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/Playlist/loader.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/Playlist/mw.Playlist.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/Sequencer/mw.Sequencer.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerActionsEdit.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTimeline.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/SmilPlayer/mw.Smil.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBody.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBuffer.js (modified) (history)
  • /branches/MwEmbedStandAlone/mwEmbed.js (modified) (history)
  • /branches/MwEmbedStandAlone/tests/selenium_tests/EmbedPlayerLoadsTest.php (modified) (history)
  • /branches/MwEmbedStandAlone/tests/selenium_tests/audio-player-menu.html (modified) (history)
  • /branches/MwEmbedStandAlone/tests/selenium_tests/audio-player-playback-progress.html (modified) (history)
  • /branches/MwEmbedStandAlone/tests/selenium_tests/player-themable-display.html (modified) (history)

Diff [purge]

Index: branches/MwEmbedStandAlone/mwEmbed.js
@@ -1216,7 +1216,6 @@
12171217 * string String to output to console
12181218 */
12191219 mw.log = function( string ) {
1220 -
12211220 // Add any prepend debug strings if necessary
12221221 if ( mw.getConfig( 'pre-append-log' ) ){
12231222 string = mw.getConfig( 'pre-append-log' ) + string;
@@ -1227,17 +1226,18 @@
12281227 } else {
12291228 /**
12301229 * Old IE and non-Firebug debug: ( commented out for now )
1231 - */
1232 - /*
1233 - * var log_elm = document.getElementById('mv_js_log'); if(!log_elm) {
1234 - * document.getElementsByTagName("body")[0].innerHTML =
1235 - * document.getElementsByTagName("body")[0].innerHTML + '<div
1236 - * style="position:absolute;z-index:500;bottom:0px;left:0px;right:0px;height:200px;">'+ '<textarea
1237 - * id="mv_js_log" cols="120" rows="12"></textarea>'+ '</div>';
1238 - *
1239 - * var log_elm = document.getElementById('mv_js_log'); } if(log_elm) {
1240 - * log_elm.value+=string+"\n"; }
1241 - */
 1230+ */
 1231+ /*var log_elm = document.getElementById('mv_js_log');
 1232+ if(!log_elm) {
 1233+ document.getElementsByTagName("body")[0].innerHTML += '<div ' +
 1234+ 'style="position:absolute;z-index:500;bottom:0px;left:0px;right:0px;height:200px;">' +
 1235+ '<textarea id="mv_js_log" cols="120" rows="12"></textarea>' +
 1236+ '</div>';
 1237+ }
 1238+ var log_elm = document.getElementById('mv_js_log');
 1239+ if(log_elm) {
 1240+ log_elm.value+=string+"\n";
 1241+ }*/
12421242 }
12431243 }
12441244
@@ -2417,7 +2417,7 @@
24182418 /**
24192419 * Set DOM-ready call We copy jQuery( document ).ready here since sometimes
24202420 * mwEmbed.js is included without jQuery and we need our own "ready" system so
2421 - * that mwEmbed interfaces can support async built out and the inclution of
 2421+ * that mwEmbed interfaces can support async built out and the include of
24222422 * jQuery.
24232423 */
24242424 var mwDomIsReady = false;
Index: branches/MwEmbedStandAlone/tests/selenium_tests/audio-player-menu.html
@@ -18,7 +18,7 @@
1919 </tr>
2020 <tr>
2121 <td>waitForElementPresent</td>
22 - <td>//div[@class='interface_wrap k-player']</td>
 22+ <td>//div[@class='mwplayer_interface k-player']</td>
2323 <td>9000</td>
2424 </tr>
2525 <tr>
Index: branches/MwEmbedStandAlone/tests/selenium_tests/player-themable-display.html
@@ -18,12 +18,12 @@
1919 </tr>
2020 <tr>
2121 <td>waitForElementPresent</td>
22 - <td>//div[@class=&quot;interface_wrap k-player&quot;]</td>
 22+ <td>//div[@class=&quot;mwplayer_interface k-player&quot;]</td>
2323 <td>9000</td>
2424 </tr>
2525 <tr>
2626 <td>waitForElementPresent</td>
27 - <td>//div[@class=&quot;interface_wrap mv-player&quot;]</td>
 27+ <td>//div[@class=&quot;mwplayer_interface mv-player&quot;]</td>
2828 <td>9000</td>
2929 </tr>
3030 <tr>
Index: branches/MwEmbedStandAlone/tests/selenium_tests/EmbedPlayerLoadsTest.php
@@ -20,8 +20,8 @@
2121
2222 $this->waitForPageToLoad(10000);
2323
24 - $this->isElementPresent("//div[@class='interface_wrap k-player']", 10000);
25 - $this->isElementPresent("//div[@class='interface_wrap mv-player']", 10000);
 24+ $this->isElementPresent("//div[@class='mwplayer_interface k-player']", 10000);
 25+ $this->isElementPresent("//div[@class='mwplayer_interface mv-player']", 10000);
2626 $this->isElementPresent("//div[@class='ui-state-default play-btn-large']", 10000);
2727
2828 }
Index: branches/MwEmbedStandAlone/tests/selenium_tests/audio-player-playback-progress.html
@@ -18,7 +18,7 @@
1919 </tr>
2020 <tr>
2121 <td>waitForElementPresent</td>
22 - <td>//div[@class='interface_wrap k-player']</td>
 22+ <td>//div[@class='mwplayer_interface k-player']</td>
2323 <td>9000</td>
2424 </tr>
2525 <tr>
Index: branches/MwEmbedStandAlone/ResourceLoader.php
@@ -101,7 +101,7 @@
102102 try {
103103 NamedResourceLoader::loadResourcePaths();
104104 } catch( Exception $e ) {
105 - $this->errorMsg .= $e->getMessage() ;
 105+ $this->errorMsg .= "loadResourcePaths:" . $e->getMessage() ;
106106 }
107107
108108 // Reset the requestKey:
@@ -182,7 +182,7 @@
183183 if ( $wgUseFileCache && !$this->debug ) {
184184 $status = $this->sFileCache->saveToFileCache( $this->output );
185185 if ( $status !== true ) {
186 - $this->errorMsg .= $status;
 186+ $this->errorMsg .= "Could not save file to cache::" . $status;
187187 }
188188 }
189189
@@ -190,7 +190,7 @@
191191 if ( $this->errorMsg != '' ) {
192192 //just set the content type (don't send cache header)
193193 header( 'Content-Type: text/javascript' );
194 - echo 'if(console.log)console.log(\'Error With ScriptLoader ::' .
 194+ echo 'if(console.log)console.log(\'Error With ResourceLoader ::' .
195195 str_replace( "\n", '\'+"\n"+' . "\n'",
196196 xml::escapeJsString( $this->errorMsg )
197197 ) . '\');'."\n";
@@ -728,7 +728,7 @@
729729 try {
730730 NamedResourceLoader::loadResourcePaths();
731731 } catch( Exception $e ) {
732 - $this->errorMsg .= $e->getMessage() ;
 732+ $this->errorMsg .= "getPathFromClass: " . $e->getMessage() ;
733733 }
734734
735735 if ( isset( $wgResourceLoaderNamedPaths[ $reqClass ] ) ) {
Index: branches/MwEmbedStandAlone/includes/NamedResourceLoader.php
@@ -17,7 +17,7 @@
1818 private static $combinedLoadersJs = '';
1919
2020 // Reg Exp that supports extracting classes from loaders
21 - private static $classReplaceExp = '/mw\.addResourcePaths\s*\(\s*{(.*)}\s*\)\s*\;/siU';
 21+ private static $classReplaceExp = '/mw\.addResourcePaths\s*\(\s*{(.*)}\s*\)\s*[\;\n]/siU';
2222
2323 // Flag to specify if the javascript resource paths have been loaded.
2424 private static $classesLoaded = false;
Index: branches/MwEmbedStandAlone/modules/Playlist/loader.js
@@ -30,6 +30,7 @@
3131
3232 // Module loader ( right now its just a stub for mw.MediaRss )
3333 mw.addModuleLoader( 'Playlist', [ "mw.Playlist", "mw.PlaylistHandlerMediaRss" ] );
 34+
3435
3536 } )( window.mw );
3637
Index: branches/MwEmbedStandAlone/modules/Playlist/mw.Playlist.js
@@ -31,9 +31,17 @@
3232 }
3333
3434 // Set the sourceHandler if provided
35 - if( options.sourceHandler )
 35+ if( options.sourceHandler ) {
3636 this.sourceHandler = options.sourceHandler;
 37+ }
3738
 39+
 40+ // Set binding to disable "waitForMeta" for playlist items ( we know the size and length )
 41+ $j( mw ).bind( 'addElementWaitForMetaEvent', function(even, waitForMetaObject ){
 42+ if( $j( waitForMetaObject[ 'playerElement' ] ).hasClass( 'mwPlaylist') ){
 43+ waitForMetaObject[ 'waitForMeta' ] = false;
 44+ }
 45+ });
3846
3947 this.type = ( options.type ) ?
4048 options.type:
@@ -102,6 +110,7 @@
103111
104112 // Add the player
105113 _this.updatePlayer( _this.clipIndex, function(){
 114+
106115 // Update the list height ( vertical layout )
107116 if( _this.layout == 'vertical' ){
108117 var targetListHeight = ( $j( _this.target ).height() - $j( _this.target + ' .media-rss-video-player' ).height() );
@@ -170,6 +179,7 @@
171180
172181 // Build and output the title
173182 var $title = $j('<div />' )
 183+ .addClass( 'playlist-title')
174184 .css( {
175185 'height' : _this.titleHeight,
176186 'font-size' : '85%',
@@ -178,14 +188,10 @@
179189 .text(
180190 _this.sourceHandler.getClipTitle( clipIndex )
181191 )
182 - .addClass( 'ui-state-default ui-widget-header' )
183 -
184 - $j( _this.target + ' .media-rss-video-player' )
185 - .empty()
186 - .append(
187 - $title
188 - );
 192+ .addClass( 'ui-state-default ui-widget-header' )
189193
 194+ $j( _this.target + ' .media-rss-video-player' ).find('.playlist-title').remove( );
 195+ $j( _this.target + ' .media-rss-video-player' ).prepend( $title );
190196
191197 // Update the player list if present:
192198 $j( _this.target + ' .clipItemBlock')
@@ -200,47 +206,79 @@
201207 'id' : 'mrss_' + this.id + '_' + clipIndex,
202208 'poster' : _this.sourceHandler.getClipPoster( clipIndex )
203209 })
 210+ .addClass( 'mwPlaylist' )
204211 .css(
205212 playerSize
206213 )
207214 // Add custom attributes:
208215 .attr( _this.sourceHandler.getCustomClipAttributes( clipIndex ) );
209216
210 - // if we don't have an api based lookup ( kentryid ) lookup the sources from the
211 - // playlist provider:
212 - if( ! $video.attr( 'kentryid' ) ){
213 - this.sourceHandler.getClipSources( clipIndex, function( clipSources ){
214 -
215 - if( clipSources ){
216 - for( var i =0; i < clipSources.length; i++ ){
217 - var $source = $j('<source />')
218 - .attr( clipSources[i] );
219 - $video.append( $source );
220 - }
 217+ // lookup the sources from the playlist provider:
 218+ this.sourceHandler.getClipSources( clipIndex, function( clipSources ){
 219+ if( clipSources ){
 220+ for( var i =0; i < clipSources.length; i++ ){
 221+ var $source = $j('<source />')
 222+ .attr( clipSources[i] );
 223+ $video.append( $source );
221224 }
222 - _this.addVideoPlayer( $video , callback);
223 - });
224 - } else {
225 - this.addVideoPlayer( $video , callback);
226 - }
 225+ }
 226+ _this.addVideoPlayer( $video , callback);
 227+ });
227228 },
228229
229230 addVideoPlayer: function( $video , callback){
230231 var _this = this;
231 - $j( _this.target + ' .media-rss-video-player' ).append( $video );
 232+ // If on mobile safari just swap the sources ( don't replace the video )
 233+ // ( mobile safari can't javascript start the video )
 234+ // see: http://developer.apple.com/iphone/search/search.php?simp=1&num=10&Search=html5+autoplay
 235+ var addVideoPlayerToDom = true;
 236+ if( mw.isMobileSafari() ){
 237+ // Check for a current video:
 238+ var $inDomVideo = $j( _this.target + ' .media-rss-video-player video' );
 239+ if( $inDomVideo.length == 0 ){
 240+ addVideoPlayerToDom= true;
 241+ } else {
 242+ addVideoPlayerToDom = false;
 243+ // Update the inDomVideo object:
 244+ // NOTE: this hits a lot of internal stuff should !
 245+ // XXX Should refactor to use embedPlayer interfaces!
 246+ var vidInterface = $j( _this.target + ' .media-rss-video-player' ).find('.mwplayer_interface div').get(0)
 247+ vidInterface.id = $video.attr('id');
 248+ vidInterface.pid = 'pid_' + $video.attr('id');
 249+ vidInterface.duration = null;
 250+ if( $video.attr('kentryid') ){
 251+ vidInterface.kentryid = $video.attr('kentryid');
 252+ }
 253+ // Update the current video target source
 254+ $inDomVideo.attr({
 255+ 'id' : 'pid_' + $video.attr('id'),
 256+ 'src': $video.find( 'source').attr('src')
 257+ });
 258+
 259+ }
 260+ } else {
 261+ // Remove the old video player ( non-mobile safari )
 262+ // xxx NOTE: need to check fullscreen support might be better to universally swap the src )
 263+ $j( _this.target + ' .media-rss-video-player' ).remove( 'video' );
 264+ }
232265
 266+ if( addVideoPlayerToDom ) {
 267+ // replace the video:
 268+ $j( _this.target + ' .media-rss-video-player' ).append( $video );
 269+ }
 270+
233271 // Update the video tag with the embedPlayer
234272 $j.embedPlayers( function(){
235273 // Setup ondone playing binding to play next clip
236 - $j( '#mrss_' + _this.id + '_' + _this.clipIndex ).bind( 'ended', function(event, onDoneActionObject ){
 274+ $j( '#mrss_' + _this.id + '_' + _this.clipIndex ).unbind('ended').bind( 'ended', function(event, onDoneActionObject ){
237275 // Play next clip
238276 if( _this.clipIndex + 1 < _this.sourceHandler.getClipCount() ){
239277 // Update the onDone action object to not run the base control done:
240278 onDoneActionObject.runBaseControlDone = false;
241279 _this.clipIndex++;
242280
243 - // ( if on ipad update the src and don't refresh )
244 - _this.updatePlayer( _this.clipIndex, function(){
 281+ // update the player and play the next clip
 282+ _this.updatePlayer( _this.clipIndex, function(){
245283 _this.play();
246284 })
247285
@@ -249,8 +287,7 @@
250288 // Update the onDone action object to not run the base control done:
251289 onDoneActionObject.runBaseControlDone = true;
252290 }
253 - })
254 -
 291+ })
255292 // Run the callback if its set
256293 if( callback ){
257294 callback();
@@ -340,8 +377,10 @@
341378 */
342379 play: function(){
343380 // Get the player and play:
344 - var vid = $j( this.target + ' .media-rss-video-player .interface_wrap').children().get(0);
345 - if( vid && vid.play ){
 381+ var vid = $j('#mrss_' + this.id + '_' + this.clipIndex ).get(0);
 382+ //alert( 'play: '+ )
 383+ if( vid && vid.play ){
 384+ vid.load();
346385 vid.play();
347386 }
348387 },
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBody.js
@@ -50,13 +50,16 @@
5151 if( !$node.attr('id')
5252 && !$node.attr( 'xml:id' )
5353 ){
 54+ var idString = _this.getNodeSmilType( $node ) + '_' + _this.idIndex;
5455 // Make sure the id does not already exist ( should be a rare case )
55 - var idString = _this.getNodeSmilType( $node ) + '_' + _this.idIndex;
56 - if( this.$dom.find( '#' + idString ).length != 0 ){
57 - idString+= '_' + Math.random();
 56+ while( this.$dom.find( '#' + idString ).length != 0 ){
 57+ _this.idIndex++;
 58+ idString = _this.getNodeSmilType( $node ) + '_' + _this.idIndex;
5859 }
 60+ // Apply the unique id attribute
5961 $node.attr('id', idString);
6062 mw.log('SmilBody:: gave: ' + $node.get(0).nodeName + ' id: ' + $node.attr('id') );
 63+ // Increment the index:
6164 _this.idIndex++;
6265 }
6366
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.Smil.js
@@ -91,7 +91,7 @@
9292 this.$dom = $j( smilXmlString );
9393
9494 mw.log("Smil::loadFromString: loaded smil dom: " + this.$dom.length + "\n" + smilXmlString );
95 -
 95+ /*
9696 // Clear out the layout
9797 this.layout = null;
9898
@@ -103,10 +103,11 @@
104104
105105 // Clear out the "buffer" object
106106 this.buffer = null;
 107+ */
107108 },
108109 updateFromString: function( smilXmlString ){
109 - var tmpDom = $j( smilXmlString );
110 - // merge in xml changes?
 110+ delete this.$dom;
 111+ this.$dom = $j( smilXmlString );
111112 },
112113 /**
113114 * Internal function to get the jQuery smil dom
@@ -269,6 +270,7 @@
270271 }
271272 return this.duration;
272273 },
 274+
273275 removeById: function ( smilElementId ) {
274276 var $smilElement = this.$dom.find( '#' + smilElementId );
275277
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBuffer.js
@@ -403,7 +403,7 @@
404404
405405 var $vid = $j ( '#' + assetId);
406406 var vid = $vid.get(0);
407 - // Add the asset to the loading set
 407+ // Add the asset to the loading set (if not there already )
408408 _this.addAssetLoading( $vid.attr('id' ) );
409409 var seekCallbackDone = false;
410410 var runSeekCallback = function(){
Index: branches/MwEmbedStandAlone/modules/EmbedPlayer/loader.js
@@ -54,7 +54,7 @@
5555 // "videojs" will include the source javascript and video tag to
5656 // rewrite the player on the remote page DOM
5757 // Video tag embedding is much more mash-up friendly but exposes
58 - // the remote site to the mwEmbed js.
 58+ // the remote site to the mwEmbed javascript and can be a xss issue.
5959 "EmbedPlayer.ShareEmbedMode" : 'object',
6060
6161 // Default player skin name
Index: branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayer.js
@@ -192,7 +192,7 @@
193193 * The base source attribute checks
194194 * also see: http://dev.w3.org/html5/spec/Overview.html#the-source-element
195195 */
196 -mw.setConfig( 'embedPlayerSourceAttributes', [
 196+mw.setDefaultConfig( 'embedPlayerSourceAttributes', [
197197 // source id
198198 'id',
199199
@@ -325,23 +325,29 @@
326326 // Run the global hooks that mw.playerManager is ready
327327 mw.log( 'EmbedPlayer::trigger: EmbedPlayerManagerReady');
328328 $j( mw ).trigger( 'EmbedPlayerManagerReady' );
329 - }
330 -
331 - // Add the embedPlayer ready callback
332 - if( typeof callback == 'function' ){
333 - mw.playerManager.addCallback( callback );
334 - }
 329+ }
 330+ var addedToPlayerManager = false;
335331 // Make sure we have user preference setup ( for setting preferences on video selection )
336332 mw.setupUserConfig( function() {
337333 // Add each selected element to the player manager:
338334 $j( playerSelect ).each( function( index, playerElement) {
339 - // Make sure the video tag was not generated by our own native player:
 335+ // Make sure the video tag was not generated by our library:
340336 if( $j( playerElement ).hasClass( 'nativeEmbedPlayerPid' ) ){
341 - mw.log( 'EmbedPlayer::$j.embedPlayer skip embedPlayer gennerated video: ' + playerElement );
 337+ mw.log( 'EmbedPlayer::$j.embedPlayer skip embedPlayer gennerated video: ' + playerElement );
342338 } else {
 339+ addedToPlayerManager = true;
 340+ // Add the embedPlayer ready callback
 341+ mw.playerManager.addCallback( callback );
 342+ // Add the player
343343 mw.playerManager.addElement( playerElement, attributes);
344 - }
345 - } );
 344+ }
 345+
 346+ } );
 347+ // run the callback directly if no players were added to the playerManager
 348+ if( !addedToPlayerManager && callback ){
 349+ callback();
 350+ }
 351+
346352 })
347353 };
348354
@@ -376,7 +382,9 @@
377383 * @param {Function} callback Function to be called once players are ready
378384 */
379385 addCallback: function( callback ) {
380 - this.callbackFunctions.push( callback );
 386+ if( typeof callback == 'function' ){
 387+ this.callbackFunctions.push( callback );
 388+ }
381389 },
382390
383391 /**
@@ -477,8 +485,13 @@
478486 $j( '#' + playerInterface.id ).get(0).checkPlayerSources();
479487 }
480488
481 - if( waitForMeta ) {
482 - mw.log('EmbedPlayer::WaitForMeta ( video missing height (' + $j( playerElement ).attr('height') + '), width (' + $j( playerElement ).attr('width') + ') or duration' );
 489+ if( waitForMeta ) {
 490+ mw.log('EmbedPlayer::WaitForMeta ( video missing height (' +
 491+ $j( playerElement ).attr('height') + '), width (' +
 492+ $j( playerElement ).attr('width') + ') or duration: ' +
 493+ $j( playerElement ).attr('duration')
 494+ );
 495+
483496 playerElement.removeEventListener( "loadedmetadata", runPlayerSwap, true );
484497 playerElement.addEventListener( "loadedmetadata", runPlayerSwap, true );
485498
@@ -655,7 +668,7 @@
656669 mw.log( "EmbedPlayer::All on-page players ready run playerMannager callbacks" );
657670 // Run queued functions
658671 if( _this.callbackFunctions ) {
659 - while ( _this.callbackFunctions.length ) {
 672+ while ( _this.callbackFunctions.length ) {
660673 _this.callbackFunctions.shift()();
661674 }
662675 }
@@ -2085,13 +2098,13 @@
20862099 // Set-up the local controlBuilder instance:
20872100 this.controlBuilder = new mw.PlayerControlBuilder( this );
20882101 var _this = this;
2089 - // Make sure we have interface_wrap
2090 - if( $j( this ).parent( '.interface_wrap' ).length == 0 ) {
 2102+ // Make sure we have mwplayer_interface
 2103+ if( $j( this ).parent( '.mwplayer_interface' ).length == 0 ) {
20912104 // Select "player"
20922105 $j( this )
20932106 .wrap(
20942107 $j('<div>')
2095 - .addClass( 'interface_wrap ' + this.controlBuilder.playerClass )
 2108+ .addClass( 'mwplayer_interface ' + this.controlBuilder.playerClass )
20962109 .css({
20972110 'width' : parseInt( this.width ) + 'px',
20982111 'height' : parseInt( this.height ) + 'px',
@@ -2100,8 +2113,8 @@
21012114 )
21022115 }
21032116
2104 - //Set up local jQuery object reference to "interface_wrap"
2105 - this.$interface = $j( this ).parent( '.interface_wrap' );
 2117+ //Set up local jQuery object reference to "mwplayer_interface"
 2118+ this.$interface = $j( this ).parent( '.mwplayer_interface' );
21062119
21072120 // Update Thumbnail for the "player"
21082121 this.updatePosterHTML();
@@ -2810,7 +2823,7 @@
28112824 this.preMuteVolume = this.volume;
28122825 var percent = 0;
28132826 }
2814 - this.setVolume( percent );
 2827+ this.setVolume( percent );
28152828 // Update the interface
28162829 this.setInterfaceVolume( percent );
28172830 },
@@ -2963,8 +2976,8 @@
29642977 this.checkForCurrentTimeSeek();
29652978
29662979 // Update currentTime via embedPlayer
2967 - _this.currentTime = _this.getPlayerElementTime();
2968 -
 2980+ _this.currentTime = _this.getPlayerElementTime();
 2981+
29692982 // Update the previousTime ( so we can know if the user-javascript changed currentTime )
29702983 _this.previousTime = _this.currentTime;
29712984
@@ -2984,7 +2997,9 @@
29852998 // update the mute state from the player element
29862999 if( _this.muted != _this.getPlayerElementMuted() ){
29873000 mw.log("monitor:: muted does not mach embed player" );
2988 - this.toggleMute();
 3001+ _this.toggleMute();
 3002+ // Make sure they match:
 3003+ _this.muted = _this.getPlayerElementMuted();
29893004 }
29903005
29913006 //mw.log( 'Monitor:: ' + this.currentTime + ' duration: ' + ( parseInt( this.getDuration() ) + 1 ) + ' is seek: ' + this.seeking );
Index: branches/MwEmbedStandAlone/modules/EmbedPlayer/skins/mw.PlayerControlBuilder.js
@@ -65,7 +65,7 @@
6666 this.embedPlayer = embedPlayer;
6767
6868 // Check for skin overrides for controlBuilder
69 - var skinClass = embedPlayer.skinName[0].toUpperCase() + embedPlayer.skinName.substr( 1 );
 69+ var skinClass = embedPlayer.skinName.substr(0,1).toUpperCase() + embedPlayer.skinName.substr( 1 );
7070 if ( mw['PlayerSkin' + skinClass ]) {
7171
7272 // Clone as to not override prototype with the skin config
Index: branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayerNative.js
@@ -312,12 +312,12 @@
313313 * Get the embed player time
314314 */
315315 getPlayerElementTime: function() {
316 - var _this = this;
 316+ var _this = this;
317317 // Make sure we have .vid obj
318318 this.getPlayerElement();
319319
320320 if ( !this.playerElement ) {
321 - mw.log( 'could not find video embed: ' + this.id + ' stop monitor' );
 321+ mw.log( 'Error: mwEmbedPlayer::getPlayerElementTime: missing ' + this.id + ' stop monitor' );
322322 return false;
323323 }
324324 // Return the playerElement currentTime
@@ -448,7 +448,7 @@
449449 /**
450450 * Get /update the playerElement value
451451 */
452 - getPlayerElement: function () {
 452+ getPlayerElement: function () {
453453 this.playerElement = $j( '#' + this.pid ).get( 0 );
454454 return this.playerElement;
455455 },
@@ -519,8 +519,8 @@
520520 */
521521 onloadedmetadata: function() {
522522 this.getPlayerElement();
523 - mw.log( 'f:onloadedmetadata metadata ready Update duration:' + this.playerElement.duration + ' old dur: ' + this.getDuration() );
524 - if ( ! isNaN( this.playerElement.duration ) ) {
 523+ if ( this.playerElement && ! isNaN( this.playerElement.duration ) ) {
 524+ mw.log( 'f:onloadedmetadata metadata ready Update duration:' + this.playerElement.duration + ' old dur: ' + this.getDuration() );
525525 this.duration = this.playerElement.duration;
526526 }
527527
Index: branches/MwEmbedStandAlone/modules/Sequencer/mw.Sequencer.js
@@ -96,17 +96,19 @@
9797 * Update the smil xml and then update the interface
9898 */
9999 updateSmilXML: function( smilXML ){
100 - mw.log("Sequencer::updateSmilXML");
 100+ mw.log("Sequencer::updateSmilXML" + smilXML);
101101 var _this = this;
102 -
 102+ alert( 'before update seq len: ' + this.getSmil().$dom.find('seq').children().length )
103103 // Update the embedPlayer smil:
104104 this.getSmil().updateFromString( smilXML );
105 -
 105+ alert( 'after update seq len: ' + this.getSmil().$dom.find('seq').children().length )
106106 // Get a duration ( forceRefresh to clear the cache )
107 - this.getEmbedPlayer().getDuration( true );
108 -
 107+ var dur = this.getEmbedPlayer().getDuration( true );
 108+ alert( 'restored dur should be: ' + dur);
 109+ /*
109110 // redraw the timeline
110111 this.getTimeline().drawTimeline();
 112+ */
111113 },
112114
113115 /**
@@ -133,8 +135,8 @@
134136 // Add the timeline
135137 _this.getTimeline().drawTimeline();
136138
137 - // initialize the edit actions ( stores the initial state for undo / redo actions )
138 - _this.getActionsEdit();
 139+ // initialize the edit stack to support undo / redo actions
 140+ _this.getActionsEdit().setupEditStack();
139141 });
140142 // Draw the top level menu
141143 this.getMenu().drawMenu();
Index: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTimeline.js
@@ -59,7 +59,8 @@
6060 this.trackLayout.resizeAll();
6161 }
6262 },
63 - //draw the timeline
 63+
 64+ // Draw the timeline
6465 drawTimeline: function(){
6566 // Empty the timeline container
6667 this.getTimelineContainer().empty();
@@ -67,7 +68,7 @@
6869 // Get the top level sequence tracks
6970 var seqTracks = this.sequencer.getSmil().getBody().getSeqElements();
7071 var trackType = 'video';
71 - // for now just two tracks first is video second is audio
 72+ // For now just two tracks first is video second is audio
7273 for( var trackIndex=0; trackIndex < seqTracks.length; trackIndex++){
7374
7475 if( trackType == 'audio' ){
@@ -83,8 +84,8 @@
8485 drawSequenceTrack: function( trackIndex, sequenceNode, trackType ){
8586 var _this = this;
8687 mw.log(" drawSequenceTrack: Track inx: " + trackIndex + ' trackType:' + trackType );
87 - // Check if we already have a container for this track set
88 -
 88+ // Check if we already have a container for this track set
 89+
8990 // Add a sequence track Name
9091 this.getTracksContainer().find('.trackNamesContainer').append(
9192 this.getTrackNameInterface( trackIndex, sequenceNode, trackType )
@@ -93,12 +94,12 @@
9495 // Add Sequence clips
9596 this.getTracksContainer().find('.clipTrackSetContainer').append(
9697 this.getTrackClipInterface( trackIndex ,sequenceNode , trackType )
97 - ).click(function(){
 98+ ).click( function(){
9899 // xxx todo catch de-select clicks in clipTrackSetContainer that are not a click in the timeline
99100 //_this.getTracksContainer().find('.timelineClip').removeClass( 'selectedClip' );
100101 })
101102 // Load and display all clip thumbnails
102 - this.drawTrackThumbs( trackIndex, sequenceNode, trackType );
 103+ this.drawTrackThumbs( trackIndex, sequenceNode, trackType );
103104 },
104105
105106 drawTrackThumbs: function( trackIndex, sequenceNode, trackType ){
Index: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerActionsEdit.js
@@ -23,9 +23,7 @@
2424 numberOfUndos : mw.getConfig( 'Sequencer.numberOfUndos' ),
2525
2626 init: function( sequencer ) {
27 - this.sequencer = sequencer;
28 - // Set the initial edit state:
29 - this.editStack.push( this.sequencer.getSmil().getXMLString() );
 27+ this.sequencer = sequencer;
3028 },
3129
3230 selectAll: function(){
@@ -35,6 +33,15 @@
3634 },
3735
3836 /**
 37+ * Set up the edit stack
 38+ */
 39+ setupEditStack: function(){
 40+ this.editStack = [];
 41+ // Set the initial edit state:
 42+ this.editStack.push( this.sequencer.getSmil().getXMLString() );
 43+ },
 44+
 45+ /**
3946 * Apply a smil xml transform state ( to support undo / redo )
4047 */
4148 registerEdit: function(){
@@ -55,9 +62,10 @@
5663 * Undo an edit action
5764 */
5865 undo: function(){
59 - this.editIndex--;
 66+ this.editIndex--;
 67+ mw.log("SequenceActionsEdit:: undo stack index:" + this.editIndex);
6068 // Change to previous state
61 - this.sequencer.updateSmilXML( this.editStack[ this.editIndex ] );
 69+ this.sequencer.updateSmilXML( this.editStack[ this.editIndex ] );
6270 },
6371
6472 /**

Status & tagging log