Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilLayout.js |
— | — | @@ -518,6 +518,8 @@ |
519 | 519 | ); |
520 | 520 | } |
521 | 521 | }) |
| 522 | + // Strip any links for thumbs of player |
| 523 | + $htmlLayout.find('a').attr('href', '#'); |
522 | 524 | } |
523 | 525 | |
524 | 526 | |
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilAnimate.js |
— | — | @@ -50,12 +50,13 @@ |
51 | 51 | // var relativeTime = time - smilElement.parentTimeOffset; |
52 | 52 | var relativeTime = time - $j( smilElement ).data ( 'startOffset' ); |
53 | 53 | switch( _this.smil.getRefType( smilElement ) ){ |
| 54 | + case 'auido': |
54 | 55 | case 'video': |
55 | | - var vid = $j ( '#' + _this.smil.getSmilElementPlayerID( smilElement ) ).get( 0 ); |
56 | | - var vidTime = ( !vid || !vid.currentTime )? 0 : vid.currentTime; |
57 | | - //mw.log( "getPlaybackSyncDelta:: video time should be: " + relativeTime + ' video time is: ' + vidTime ); |
| 56 | + var media = $j ( '#' + _this.smil.getSmilElementPlayerID( smilElement ) ).get( 0 ); |
| 57 | + var mediaTime = ( !media || !media.currentTime )? 0 : media.currentTime; |
| 58 | + //mw.log( "getPlaybackSyncDelta:: mediaeo time should be: " + relativeTime + ' video time is: ' + vidTime ); |
58 | 59 | |
59 | | - var syncOffset = ( relativeTime -vidTime ); |
| 60 | + var syncOffset = ( relativeTime -mediaTime ); |
60 | 61 | if( syncOffset > maxOutOfSync ){ |
61 | 62 | maxOutOfSync = syncOffset; |
62 | 63 | } |
— | — | @@ -92,7 +93,8 @@ |
93 | 94 | // Check for special playback types that for playback animation action: |
94 | 95 | if( this.smil.getRefType( smilElement ) == 'video' |
95 | 96 | || |
96 | | - this.smil.getRefType( smilElement ) == 'audio' ){ |
| 97 | + this.smil.getRefType( smilElement ) == 'audio' ) |
| 98 | + { |
97 | 99 | this.transformMediaForPlayback( smilElement, animateTime ); |
98 | 100 | } |
99 | 101 | |
— | — | @@ -186,13 +188,17 @@ |
187 | 189 | * Transform Element in an inner animation loop |
188 | 190 | */ |
189 | 191 | transformAnimateFrame: function( smilElement, animateTime ){ |
190 | | - // Video has no inner animation per-frame transforms |
191 | | - if( this.smil.getRefType( smilElement ) != 'video' ){ |
| 192 | + // Audio / Video has no inner animation per-frame transforms |
| 193 | + if( this.smil.getRefType( smilElement ) != 'video' |
| 194 | + && |
| 195 | + this.smil.getRefType( smilElement ) != 'audio' |
| 196 | + ){ |
192 | 197 | this.transformElement( smilElement, animateTime ); |
193 | 198 | } |
194 | 199 | // Update the smil Element transition: |
195 | 200 | this.smil.getTransitions().transformTransitionOverlay( smilElement, animateTime ); |
196 | 201 | }, |
| 202 | + |
197 | 203 | /** |
198 | 204 | * Transform a smil element for a requested time. |
199 | 205 | * |
— | — | @@ -209,7 +215,8 @@ |
210 | 216 | this.transformImageForTime( smilElement, animateTime ); |
211 | 217 | break; |
212 | 218 | case 'video': |
213 | | - this.transformVideoForTime( smilElement, animateTime ); |
| 219 | + case 'audio': |
| 220 | + this.transformMediaForTime( smilElement, animateTime ); |
214 | 221 | break; |
215 | 222 | } |
216 | 223 | }, |
— | — | @@ -219,24 +226,24 @@ |
220 | 227 | * @param {Element} smilElement Smil video element to be transformed |
221 | 228 | * @param {time} animateTime Relative time to be transformed |
222 | 229 | */ |
223 | | - transformVideoForTime: function( smilElement, animateTime, callback ){ |
| 230 | + transformMediaForTime: function( smilElement, animateTime, callback ){ |
224 | 231 | // Get the video element |
225 | 232 | var assetId = this.smil.getSmilElementPlayerID( smilElement ); |
226 | 233 | var vid = $j ( '#' + assetId ).get( 0 ); |
227 | 234 | |
228 | | - var videoSeekTime = animateTime; |
| 235 | + var mediaSeekTime = animateTime; |
229 | 236 | //Add the clipBegin if set |
230 | 237 | if( $j( smilElement ).attr( 'clipBegin') && |
231 | 238 | this.smil.parseTime( $j( smilElement ).attr( 'clipBegin') ) ) |
232 | 239 | { |
233 | | - videoSeekTime += this.smil.parseTime( $j( smilElement ).attr( 'clipBegin') ); |
| 240 | + mediaSeekTime += this.smil.parseTime( $j( smilElement ).attr( 'clipBegin') ); |
234 | 241 | } |
235 | 242 | |
236 | | - //mw.log( "SmilAnimate::transformVideoForTime:" + assetId + " ct:" +vid.currentTime + ' should be: ' + videoSeekTime ); |
| 243 | + //mw.log( "SmilAnimate::transformMediaForTime:" + assetId + " ct:" +vid.currentTime + ' should be: ' + mediaSeekTime ); |
237 | 244 | |
238 | 245 | // Register a buffer ready callback |
239 | | - this.smil.getBuffer().mediaBufferSeek( smilElement, videoSeekTime, function() { |
240 | | - //mw.log( "transformVideoForTime:: seek complete ") |
| 246 | + this.smil.getBuffer().mediaBufferSeek( smilElement, mediaSeekTime, function() { |
| 247 | + //mw.log( "transformMediaForTime:: seek complete ") |
241 | 248 | if( callback ) |
242 | 249 | callback(); |
243 | 250 | }); |
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.Smil.js |
— | — | @@ -396,9 +396,9 @@ |
397 | 397 | ); |
398 | 398 | // Links go to a new window and are disable when smaller than player size |
399 | 399 | $html.find('a').each( function(inx, link ){ |
400 | | - // escape link output as to not include scirpt execution |
| 400 | + // Escape link output as to not include scirpt execution |
401 | 401 | $j(link).attr('href', |
402 | | - mw.escapeQuotesHTML( $j(link).attr('href') ) |
| 402 | + mw.escapeQuotesHTML( $j(link).attr('href') ) |
403 | 403 | ) |
404 | 404 | }); |
405 | 405 | |
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.EmbedPlayerSmil.js |
— | — | @@ -49,7 +49,7 @@ |
50 | 50 | /** |
51 | 51 | * Put the embed player into the container |
52 | 52 | */ |
53 | | - doEmbedPlayer: function() { |
| 53 | + doEmbedHTML: function() { |
54 | 54 | var _this = this; |
55 | 55 | |
56 | 56 | // check if we have already embed the player: |
— | — | @@ -57,10 +57,10 @@ |
58 | 58 | return; |
59 | 59 | } |
60 | 60 | this.smilPlayerEmbedded = true; |
61 | | - mw.log("EmbedPlayerSmil::doEmbedPlayer: " + this.id + " time:" + this.smilPlayTime ) ; |
| 61 | + mw.log("EmbedPlayerSmil::doEmbedHTML: " + this.id + " time:" + this.smilPlayTime ) ; |
62 | 62 | |
63 | 63 | this.setCurrentTime( this.smilPlayTime, function(){ |
64 | | - mw.log("EmbedPlayerSmil::doEmbedPlayer:: render callback ready " ); |
| 64 | + mw.log("EmbedPlayerSmil::doEmbedHTML:: render callback ready " ); |
65 | 65 | }); |
66 | 66 | }, |
67 | 67 | |
— | — | @@ -148,10 +148,7 @@ |
149 | 149 | */ |
150 | 150 | play: function( playSegmentEndTime ){ |
151 | 151 | var _this = this; |
152 | | - mw.log(" EmbedPlayerSmil::play " + _this.smilPlayTime + ' to ' + playSegmentEndTime + ' pause time: ' + this.smilPauseTime ); |
153 | | - |
154 | | - // Set thumbnail_disp to false |
155 | | - this.thumbnail_disp = false; |
| 152 | + mw.log(" EmbedPlayerSmil::play " + _this.smilPlayTime + ' to ' + playSegmentEndTime + ' pause time: ' + this.smilPauseTime ); |
156 | 153 | |
157 | 154 | // Update clock start time |
158 | 155 | _this.clockStartTime = new Date().getTime() |
— | — | @@ -184,6 +181,9 @@ |
185 | 182 | // Zero out the pause time: |
186 | 183 | _this.smilPauseTime = 0; |
187 | 184 | |
| 185 | + // Set thumbnail_disp to false |
| 186 | + this.thumbnail_disp = false; |
| 187 | + |
188 | 188 | // Start up monitor: |
189 | 189 | _this.monitor(); |
190 | 190 | }); |
— | — | @@ -236,7 +236,7 @@ |
237 | 237 | */ |
238 | 238 | monitor: function(){ |
239 | 239 | // Get a local variable of the new target time: |
240 | | - //mw.log("smilPlayer::monitor: isPlaying:" + this.isPlaying() + ' pausedForBuffer:' + this.pausedForBuffer + ' playtime:' + this.smilPlayTime); |
| 240 | + //mw.log("smilPlayer::monitor: isPlaying:" + this.isPlaying() + ' is stoped: ' + this.isStopped() + ' pausedForBuffer:' + this.pausedForBuffer + ' playtime:' + this.smilPlayTime); |
241 | 241 | |
242 | 242 | // Check if we reached playSegmentEndTime and pause playback |
243 | 243 | if( this.playSegmentEndTime && this.smilPlayTime >= this.playSegmentEndTime ) { |
— | — | @@ -289,8 +289,7 @@ |
290 | 290 | // Issue an animate time request with monitorDelta |
291 | 291 | this.smil.animateTime( this.smilPlayTime, this.monitorRate ); |
292 | 292 | } |
293 | | - |
294 | | - |
| 293 | + |
295 | 294 | this.parent_monitor(); |
296 | 295 | }, |
297 | 296 | |
— | — | @@ -350,7 +349,7 @@ |
351 | 350 | return ; |
352 | 351 | } |
353 | 352 | // If no thumb could be found use the first frame of smil: |
354 | | - this.doEmbedPlayer(); |
| 353 | + this.doEmbedHTML(); |
355 | 354 | }, |
356 | 355 | |
357 | 356 | /** |
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBuffer.js |
— | — | @@ -129,7 +129,7 @@ |
130 | 130 | // Loop on loading until all elements are loaded |
131 | 131 | setTimeout( function(){ |
132 | 132 | if( _this.getBufferedPercent() == 1 ){ |
133 | | - mw.log( "smilBuffer::continueBufferLoad:: done loading buffer "); |
| 133 | + mw.log( "smilBuffer::continueBufferLoad:: done loading buffer for " + bufferTime); |
134 | 134 | return ; |
135 | 135 | } |
136 | 136 | // get the percentage buffered, translated into buffer time and call continueBufferLoad with a timeout |
— | — | @@ -159,24 +159,25 @@ |
160 | 160 | // Start "loading" the asset (for now just video ) |
161 | 161 | // but in theory we could set something up with large images / templates etc. |
162 | 162 | switch( this.smil.getRefType( smilElement ) ){ |
| 163 | + case 'audio': |
163 | 164 | case 'video': |
164 | | - var vid = $j( '#' + this.smil.getSmilElementPlayerID( smilElement ) ).get(0); |
165 | | - if( !vid ){ |
| 165 | + var media = $j( '#' + this.smil.getSmilElementPlayerID( smilElement ) ).get(0); |
| 166 | + if( !media ){ |
166 | 167 | break; |
167 | 168 | } |
168 | 169 | // The load request does not work very well instead .play() then .pause() and seek when on display |
169 | | - // vid.load(); |
| 170 | + // media.load(); |
170 | 171 | // Since we can't use "load" across html5 implementations do some hacks: |
171 | | - if( vid.paused && this.getVideoPercetLoaded( smilElement ) == 0 ){ |
| 172 | + if( media.paused && this.getMediaPercetLoaded( smilElement ) == 0 ){ |
172 | 173 | // Issue the load / play request |
173 | | - vid.play(); |
174 | | - vid.volume = 0; |
| 174 | + media.play(); |
| 175 | + media.volume = 0; |
175 | 176 | // XXX seek to clipBegin if provided ( we don't need to load before that point ) |
176 | 177 | } else { |
177 | 178 | //mw.log("loadElement:: pause video: " + this.smil.getSmilElementPlayerID( smilElement )); |
178 | 179 | // else we have some percentage loaded pause playback |
179 | 180 | //( should continue to load the asset ) |
180 | | - vid.pause(); |
| 181 | + media.pause(); |
181 | 182 | } |
182 | 183 | break; |
183 | 184 | } |
— | — | @@ -188,11 +189,12 @@ |
189 | 190 | getElementPercentLoaded: function( smilElement ){ |
190 | 191 | switch( this.smil.getRefType( smilElement ) ){ |
191 | 192 | case 'video': |
192 | | - return this.getVideoPercetLoaded( smilElement ); |
| 193 | + case 'audio': |
| 194 | + return this.getMediaPercetLoaded( smilElement ); |
193 | 195 | break; |
194 | 196 | } |
195 | 197 | // for other ref types check if element is in the dom |
196 | | - // xxx todo hook into image loader hook |
| 198 | + // xxx todo hook into image / template loaders |
197 | 199 | if( $j( '#' + this.smil.getSmilElementPlayerID( smilElement ) ).length == 0 ){ |
198 | 200 | return 0; |
199 | 201 | } else { |
— | — | @@ -203,7 +205,7 @@ |
204 | 206 | /** |
205 | 207 | * Get the percentage of a video asset that has been loaded |
206 | 208 | */ |
207 | | - getVideoPercetLoaded: function ( smilElement ){ |
| 209 | + getMediaPercetLoaded: function ( smilElement ){ |
208 | 210 | var _this = this; |
209 | 211 | var assetId = this.smil.getSmilElementPlayerID( smilElement ); |
210 | 212 | var $vid = $j( '#' + assetId ); |
— | — | @@ -362,7 +364,7 @@ |
363 | 365 | } |
364 | 366 | // Check if _this.videoLoadedPercent is in range of duration |
365 | 367 | // xxx might need to take into consideration startOfsset |
366 | | - if( _this.getVideoPercetLoaded( smilVideoElement ) > vid.duration / time ){ |
| 368 | + if( _this.getMediaPercetLoaded( smilVideoElement ) > vid.duration / time ){ |
367 | 369 | return true; |
368 | 370 | } |
369 | 371 | // not likely that the video is loaded for the requested time, return false |
Index: branches/MwEmbedStandAlone/modules/EmbedPlayer/loader.js |
— | — | @@ -128,7 +128,6 @@ |
129 | 129 | if ( $j( element ).attr( "id" ) == '' ) { |
130 | 130 | $j( element ).attr( "id", 'v' + ( rewriteElementCount++ ) ); |
131 | 131 | } |
132 | | - |
133 | 132 | // Add an absolute positioned loader |
134 | 133 | $j( element ) |
135 | 134 | .getAbsoluteOverlaySpinner() |
— | — | @@ -163,10 +162,10 @@ |
164 | 163 | 'mw.style.EmbedPlayer', |
165 | 164 | '$j.cookie', |
166 | 165 | // Add JSON lib if browsers does not define "JSON" natively |
167 | | - 'JSON' |
| 166 | + 'JSON', |
| 167 | + '$j.widget' |
168 | 168 | ], |
169 | | - [ |
170 | | - '$j.widget', |
| 169 | + [ |
171 | 170 | '$j.ui.mouse', |
172 | 171 | '$j.fn.menu', |
173 | 172 | 'mw.style.jquerymenu', |
Index: branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayer.js |
— | — | @@ -167,6 +167,9 @@ |
168 | 168 | //( Global default via config EmbedPlayer.OverlayControls in module loader.js) |
169 | 169 | "overlayControls" : true, |
170 | 170 | |
| 171 | + // Attribute to use 'native' controls |
| 172 | + "usenativecontrols" : false, |
| 173 | + |
171 | 174 | // ROE url ( for xml based metadata ) |
172 | 175 | // also see: http://wiki.xiph.org/ROE |
173 | 176 | "roe" : null, |
— | — | @@ -302,7 +305,7 @@ |
303 | 306 | var height = ( attributes.height )? attributes.height : '100%'; |
304 | 307 | } |
305 | 308 | |
306 | | - mw.log('EmbedPlayer:: set loading background img' + posterSrc); |
| 309 | + mw.log('EmbedPlayer:: set loading background: ' + posterSrc); |
307 | 310 | $j( playerElement ).append( |
308 | 311 | $j( '<img />' ) |
309 | 312 | .attr( 'src', posterSrc) |
— | — | @@ -332,9 +335,10 @@ |
333 | 336 | // Make sure we have user preference setup ( for setting preferences on video selection ) |
334 | 337 | mw.setupUserConfig( function() { |
335 | 338 | // Add each selected element to the player manager: |
336 | | - $j( playerSelect ).each( function( index, playerElement) { |
| 339 | + $j( playerSelect ).each( function( index, playerElement) { |
337 | 340 | // Make sure the video tag was not generated by our library: |
338 | 341 | if( $j( playerElement ).hasClass( 'nativeEmbedPlayerPid' ) ){ |
| 342 | + $j('#loadingSpinner_' + $j( playerElement ).attr('id') ).hide(); |
339 | 343 | mw.log( 'EmbedPlayer::$j.embedPlayer skip embedPlayer gennerated video: ' + playerElement ); |
340 | 344 | } else { |
341 | 345 | addedToPlayerManager = true; |
— | — | @@ -519,7 +523,8 @@ |
520 | 524 | */ |
521 | 525 | waitForMetaCheck: function( playerElement ){ |
522 | 526 | var waitForMeta = false; |
523 | | - |
| 527 | + if( !playerElement ) |
| 528 | + return ; |
524 | 529 | // If we don't have a native player don't wait for metadata |
525 | 530 | if( !mw.EmbedTypes.players.isSupportedPlayer( 'oggNative') && |
526 | 531 | !mw.EmbedTypes.players.isSupportedPlayer( 'h264Native' ) ) |
— | — | @@ -603,8 +608,7 @@ |
604 | 609 | } |
605 | 610 | |
606 | 611 | // Check if we are using native controls ( should keep the video embed around ) |
607 | | - // "wrap" the player interface |
608 | | - if( playerInterface.useNativeControls() ) { |
| 612 | + if( playerInterface.shouldUseNativeControls() ) { |
609 | 613 | $j( targetElement ) |
610 | 614 | .attr('id', playerInterface.pid ) |
611 | 615 | .after( |
— | — | @@ -623,7 +627,7 @@ |
624 | 628 | |
625 | 629 | // If we don't already have a loadSpiner add one: |
626 | 630 | if( $j('#loadingSpinner_' + playerInterface.id ).length == 0 ){ |
627 | | - if( playerInterface.useNativeControls() ) { |
| 631 | + if( playerInterface.shouldUseNativeControls() ) { |
628 | 632 | $j( targetElement ) |
629 | 633 | .getAbsoluteOverlaySpinner() |
630 | 634 | .attr('id', 'loadingSpinner_' + playerInterface.id ) |
— | — | @@ -1419,7 +1423,7 @@ |
1420 | 1424 | } |
1421 | 1425 | |
1422 | 1426 | // Hide "controls" if using native player controls: |
1423 | | - if( this.useNativeControls() ){ |
| 1427 | + if( this.shouldUseNativeControls() ){ |
1424 | 1428 | _this.controls = false; |
1425 | 1429 | } |
1426 | 1430 | |
— | — | @@ -1580,7 +1584,7 @@ |
1581 | 1585 | */ |
1582 | 1586 | resizePlayer: function( size , animate){ |
1583 | 1587 | this.width = size.width; |
1584 | | - this.hegith = size.height; |
| 1588 | + this.height = size.height; |
1585 | 1589 | if( animate ){ |
1586 | 1590 | $j(this).animate(size); |
1587 | 1591 | this.$interface.animate( size ); |
— | — | @@ -1978,56 +1982,9 @@ |
1979 | 1983 | */ |
1980 | 1984 | setCurrentTime: function( time, callback ) { |
1981 | 1985 | mw.log( 'Error: base embed setCurrentTime can not frame serve (override via plugin)' ); |
1982 | | - }, |
| 1986 | + }, |
1983 | 1987 | |
1984 | 1988 | /** |
1985 | | - * Setup the embed player |
1986 | | - * issues a loading request |
1987 | | - */ |
1988 | | - doEmbedPlayer: function() { |
1989 | | - mw.log( 'EmbedPlayer::doEmbedPlayer::' + this.selectedPlayer.id ); |
1990 | | - //mw.log( 'thum disp:' + this.thumbnail_disp ); |
1991 | | - var _this = this; |
1992 | | - |
1993 | | - var doEmbedPlayerLocal = function(){ |
1994 | | - // Set "loading" here ( if displaying controls ) |
1995 | | - if( ! _this.useNativeControls() ){ |
1996 | | - $j( _this ).html( |
1997 | | - $j( '<div />' ) |
1998 | | - .css({ |
1999 | | - 'color' : 'black', |
2000 | | - 'width' : _this.width + 'px', |
2001 | | - 'height' : _this.height + 'px' |
2002 | | - }) |
2003 | | - ); |
2004 | | - } |
2005 | | - |
2006 | | - // Reset some play state flags: |
2007 | | - _this.bufferStartFlag = false; |
2008 | | - _this.bufferEndFlag = false; |
2009 | | - |
2010 | | - // Make sure the player is |
2011 | | - mw.log( 'EmbedPlayer::performing embed for ' + _this.id ); |
2012 | | - }; |
2013 | | - |
2014 | | - // If no binded events, run the local doEmbedPlayer function directly: |
2015 | | - if( $j( this ).data('events').length == 0 ){ |
2016 | | - doEmbedPlayerLocal(); |
2017 | | - } else { |
2018 | | - // Trigger the doEmbedPlayer event / hook with callback |
2019 | | - $j( this ).trigger( 'doEmbedPlayerEvent', function(){ |
2020 | | - //done |
2021 | | - doEmbedPlayerLocal(); |
2022 | | - }); |
2023 | | - } |
2024 | | - |
2025 | | - // mw.log('should embed:' + embed_code); |
2026 | | - _this.doEmbedHTML() |
2027 | | - }, |
2028 | | - |
2029 | | - |
2030 | | - |
2031 | | - /** |
2032 | 1989 | * On clip done action. Called once a clip is done playing |
2033 | 1990 | */ |
2034 | 1991 | onClipDone: function() { |
— | — | @@ -2100,7 +2057,7 @@ |
2101 | 2058 | this.controlBuilder.addControlBindings(); |
2102 | 2059 | |
2103 | 2060 | // Once the thumbnail is shown run the mediaReady trigger (if not using native controls) |
2104 | | - if( !this.useNativeControls() ){ |
| 2061 | + if( !this.shouldUseNativeControls() ){ |
2105 | 2062 | mw.log("mediaLoaded"); |
2106 | 2063 | $j( this ).trigger( 'mediaLoaded' ); |
2107 | 2064 | } |
— | — | @@ -2378,7 +2335,7 @@ |
2379 | 2336 | var style_atr = ''; |
2380 | 2337 | |
2381 | 2338 | |
2382 | | - if( this.useNativeControls() ){ |
| 2339 | + if( this.shouldUseNativeControls() ){ |
2383 | 2340 | this.showNativePlayer(); |
2384 | 2341 | return ; |
2385 | 2342 | } |
— | — | @@ -2419,7 +2376,11 @@ |
2420 | 2377 | * @returns boolean true if the mwEmbed player interface should be used |
2421 | 2378 | * false if the mwEmbed player interface should not be used |
2422 | 2379 | */ |
2423 | | - useNativeControls: function() { |
| 2380 | + shouldUseNativeControls: function() { |
| 2381 | + if( this.usenativecontrols === true ){ |
| 2382 | + return true; |
| 2383 | + } |
| 2384 | + |
2424 | 2385 | if( mw.getConfig('EmbedPlayer.NativeControls') === true ) { |
2425 | 2386 | return true; |
2426 | 2387 | } |
— | — | @@ -2447,31 +2408,31 @@ |
2448 | 2409 | // Remove the player loader spinner if it exists |
2449 | 2410 | $j('#loadingSpinner_' + this.id ).remove(); |
2450 | 2411 | |
| 2412 | + |
2451 | 2413 | // Check if we need to refresh mobile safari |
2452 | | - /*var mobileSafairNeedsRefresh = false; |
2453 | | - if( $j( '#' + this.pid ).attr('controls') === false ){ |
2454 | | - mobileSafairNeedsRefresh = true; |
2455 | | - }*/ |
| 2414 | + var mobileSafairNeedsRefresh = false; |
2456 | 2415 | |
2457 | | - // For now always refersh ( buggy display control behavior in iPad ) |
2458 | | - mobileSafairNeedsRefresh = true; |
2459 | 2416 | |
2460 | 2417 | // Unhide the original video element |
2461 | | - $j( '#' + this.pid ) |
2462 | | - .css( { |
2463 | | - 'position' : 'absolute' |
2464 | | - } ) |
2465 | | - .show() |
2466 | | - .attr('controls', 'true'); |
| 2418 | + if( !$j( '#' + this.pid ).hasClass('PlayerThemer') ){ |
| 2419 | + $j( '#' + this.pid ) |
| 2420 | + .css( { |
| 2421 | + 'position' : 'absolute' |
| 2422 | + } ) |
| 2423 | + .show() |
| 2424 | + .attr('controls', 'true'); |
| 2425 | + |
| 2426 | + mobileSafairNeedsRefresh = true; |
| 2427 | + } |
2467 | 2428 | |
2468 | 2429 | // iPad does not handle video tag update for attributes like "controls" |
2469 | 2430 | // so we have to do a full replace ( if controls are not included initially ) |
2470 | 2431 | if( mw.isMobileSafari() && mobileSafairNeedsRefresh ) { |
2471 | 2432 | var source = this.mediaElement.getSources( 'video/h264' )[0]; |
2472 | | - if( ! source.src ){ |
| 2433 | + if( source && ! source.src ){ |
2473 | 2434 | mw.log( 'Error: should have caught no playable sources for mobile safari earlier' ); |
2474 | | - } |
2475 | | - |
| 2435 | + } |
| 2436 | + |
2476 | 2437 | var videoAttribues = { |
2477 | 2438 | 'id' : _this.pid, |
2478 | 2439 | 'poster': _this.poster, |
— | — | @@ -2693,7 +2654,8 @@ |
2694 | 2655 | */ |
2695 | 2656 | play: function() { |
2696 | 2657 | var _this = this; |
2697 | | - mw.log( "EmbedPlayer:: play" ); |
| 2658 | + mw.log( "EmbedPlayer:: play" ); |
| 2659 | + |
2698 | 2660 | // Hide any overlay: |
2699 | 2661 | this.controlBuilder.closeMenuOverlay(); |
2700 | 2662 | |
— | — | @@ -2702,17 +2664,24 @@ |
2703 | 2665 | if ( !this.selectedPlayer ) { |
2704 | 2666 | mw.log( 'no selectedPlayer' ); |
2705 | 2667 | this.showPluginMissingHTML(); |
| 2668 | + return; |
2706 | 2669 | } else { |
2707 | 2670 | this.thumbnail_disp = false; |
2708 | | - this.paused = false; |
2709 | | - this.doEmbedPlayer(); |
| 2671 | + this.doEmbedHTML(); |
2710 | 2672 | } |
2711 | 2673 | } else { |
2712 | 2674 | // the plugin is already being displayed |
2713 | | - this.paused = false; // make sure we are not "paused" |
2714 | 2675 | this.seeking = false; |
2715 | 2676 | } |
2716 | 2677 | |
| 2678 | + // Run play hook (if we were previously in paused state ) |
| 2679 | + if( this.paused ){ |
| 2680 | + this.paused = false; |
| 2681 | + mw.log("trigger play event::"); |
| 2682 | + $j( this ).trigger( 'play' ); |
| 2683 | + } |
| 2684 | + |
| 2685 | + |
2717 | 2686 | this.$interface.find('.play-btn span') |
2718 | 2687 | .removeClass( 'ui-icon-play' ) |
2719 | 2688 | .addClass( 'ui-icon-pause' ); |
— | — | @@ -2724,15 +2693,8 @@ |
2725 | 2694 | _this.pause(); |
2726 | 2695 | } ) |
2727 | 2696 | .attr( 'title', gM( 'mwe-embedplayer-pause_clip' ) ); |
2728 | | - |
2729 | | - |
2730 | | - // Run play hook: |
2731 | | - mw.log("playEvent"); |
2732 | | - $j( this ).trigger( 'playEvent' ); |
| 2697 | + |
2733 | 2698 | |
2734 | | - // Start monitor |
2735 | | - this.monitor(); |
2736 | | - |
2737 | 2699 | // If we previously finished playing this clip run the "replay hook" |
2738 | 2700 | if( this.donePlayingCount > 0 ) { |
2739 | 2701 | mw.log("replayEvent"); |
— | — | @@ -2758,12 +2720,12 @@ |
2759 | 2721 | */ |
2760 | 2722 | pause: function( event ) { |
2761 | 2723 | var _this = this; |
| 2724 | + // only trigger the pause event if not already in paused state: |
2762 | 2725 | if( this.paused === false ){ |
2763 | 2726 | this.paused = true; |
2764 | 2727 | mw.log('EmbedPlayer:trigger pause'); |
2765 | 2728 | $j( this ).trigger('pause'); |
2766 | | - } |
2767 | | - mw.log('mwEmbed:embedPlayer::pause() '); |
| 2729 | + } |
2768 | 2730 | |
2769 | 2731 | // update the ctrl "paused state" |
2770 | 2732 | this.$interface.find('.play-btn span' ) |
— | — | @@ -2813,8 +2775,6 @@ |
2814 | 2776 | this.showThumbnail(); |
2815 | 2777 | this.bufferedPercent = 0; // reset buffer state |
2816 | 2778 | this.controlBuilder.setStatus( this.getTimeRange() ); |
2817 | | - // stop monitor: |
2818 | | - this.monitorInterval = null; |
2819 | 2779 | |
2820 | 2780 | // Reset the playhead |
2821 | 2781 | mw.log("EmbedPlayer::Stop:: Reset play head") |
— | — | @@ -2869,7 +2829,8 @@ |
2870 | 2830 | // Update the playerElement volume |
2871 | 2831 | this.setPlayerElementVolume( percent ); |
2872 | 2832 | |
2873 | | - //mw.log(" setVolume:: " + percent + ' this.volume is: ' + this.volume); |
| 2833 | + //mw.log(" setVolume:: " + percent + ' this.volume is: ' + this.volume); |
| 2834 | + $j( this ).trigger('volumeChanged', percent ); |
2874 | 2835 | }, |
2875 | 2836 | |
2876 | 2837 | /** |
— | — | @@ -2998,7 +2959,7 @@ |
2999 | 2960 | |
3000 | 2961 | // Update currentTime via embedPlayer |
3001 | 2962 | _this.currentTime = _this.getPlayerElementTime(); |
3002 | | - |
| 2963 | + |
3003 | 2964 | // Update any offsets from server seek |
3004 | 2965 | if( _this.serverSeekTime && _this.supportsURLTimeEncoding ){ |
3005 | 2966 | _this.currentTime = _this.serverSeekTime + _this.getPlayerElementTime() |
— | — | @@ -3010,8 +2971,9 @@ |
3011 | 2972 | |
3012 | 2973 | // Check if volume was set outside of embed player function |
3013 | 2974 | //mw.log( ' this.volume: ' + _this.volume + ' prev Volume:: ' + _this.previousVolume ); |
3014 | | - if( _this.volume != _this.previousVolume ) { |
| 2975 | + if( _this.volume != _this.previousVolume ) { |
3015 | 2976 | _this.setInterfaceVolume( _this.volume ); |
| 2977 | + $j( this ).trigger('volumeChanged', _this.volume ); |
3016 | 2978 | } |
3017 | 2979 | |
3018 | 2980 | // Update the previous volume |
— | — | @@ -3022,7 +2984,7 @@ |
3023 | 2985 | |
3024 | 2986 | // update the mute state from the player element |
3025 | 2987 | if( _this.muted != _this.getPlayerElementMuted() ){ |
3026 | | - mw.log("monitor:: muted does not match embed player" ); |
| 2988 | + mw.log("monitor:: muted does not mach embed player" ); |
3027 | 2989 | _this.toggleMute(); |
3028 | 2990 | // Make sure they match: |
3029 | 2991 | _this.muted = _this.getPlayerElementMuted(); |
— | — | @@ -3075,17 +3037,21 @@ |
3076 | 3038 | } |
3077 | 3039 | |
3078 | 3040 | // Call monitor at 250ms interval. ( use setInterval to avoid stacking monitor requests ) |
3079 | | - if( ! this.isStopped() ) { |
| 3041 | + //mw.log("EmbedPlayer::monitor: continue?:" + !this.isStopped() + ' monitorInterval: ' + this.monitorInterval ); |
| 3042 | + if( ! this.isStopped() ) { |
3080 | 3043 | if( !this.monitorInterval ){ |
| 3044 | + |
3081 | 3045 | this.monitorInterval = setInterval( function(){ |
3082 | | - if( _this.monitor ) |
| 3046 | + mw.log("monitorInterval!!"); |
| 3047 | + if( _this.monitor ){ |
3083 | 3048 | _this.monitor(); |
| 3049 | + } |
3084 | 3050 | }, this.monitorRate ) |
3085 | 3051 | } |
3086 | 3052 | } else { |
3087 | | - //mw.log("EmbedPlayer::monitor: player is stoped, stop monitor") |
3088 | 3053 | // If stopped "stop" monitor: |
3089 | 3054 | clearInterval( this.monitorInterval ); |
| 3055 | + this.monitorInterval = 0; |
3090 | 3056 | } |
3091 | 3057 | |
3092 | 3058 | //mw.log('trigger:monitor:: ' + this.currentTime ); |
— | — | @@ -3116,6 +3082,7 @@ |
3117 | 3083 | $buffer.css({ |
3118 | 3084 | "width" : ( this.bufferedPercent * 100 ) + '%' |
3119 | 3085 | }); |
| 3086 | + $j( this ).trigger( 'updateBufferPercent', this.bufferedPercent ); |
3120 | 3087 | } else { |
3121 | 3088 | $buffer.css( "width", '0px' ); |
3122 | 3089 | } |
— | — | @@ -3139,12 +3106,14 @@ |
3140 | 3107 | * |
3141 | 3108 | * @param {Float} perc Value between 0 and 1 for position of playhead |
3142 | 3109 | */ |
3143 | | - updatePlayHead: function( perc ) { |
| 3110 | + updatePlayHead: function( perc ) { |
3144 | 3111 | $playHead = this.$interface.find( '.play_head' ); |
3145 | 3112 | if ( this.controls && $playHead.length != 0 ) { |
3146 | 3113 | var val = parseInt( perc * 1000 ); |
3147 | 3114 | $playHead.slider( 'value', val ); |
3148 | | - } |
| 3115 | + } |
| 3116 | + // @@todo should fix this name: |
| 3117 | + $j(this).trigger('updatePlayHeadPercent', perc); |
3149 | 3118 | }, |
3150 | 3119 | |
3151 | 3120 | /** |
Index: branches/MwEmbedStandAlone/modules/EmbedPlayer/skins/kskin/mw.style.PlayerSkinKskin.css |
— | — | @@ -319,7 +319,7 @@ |
320 | 320 | height: 15px; |
321 | 321 | overflow: hidden; |
322 | 322 | padding-left: 2px; |
323 | | - width: 100%; |
| 323 | + width: 95%; |
324 | 324 | } |
325 | 325 | |
326 | 326 | .menu-screen.menu-share button { |
Index: branches/MwEmbedStandAlone/modules/EmbedPlayer/skins/mw.PlayerControlBuilder.js |
— | — | @@ -1604,11 +1604,10 @@ |
1605 | 1605 | 'w' : 100, |
1606 | 1606 | 'o' : function( ctrlObj ) { |
1607 | 1607 | return $j( '<div />' ) |
1608 | | - .addClass( "ui-widget time-disp" ) |
1609 | | - .append( |
1610 | | - ctrlObj.embedPlayer.getTimeRange() |
1611 | | - ) |
1612 | | - |
| 1608 | + .addClass( "ui-widget time-disp" ) |
| 1609 | + .append( |
| 1610 | + ctrlObj.embedPlayer.getTimeRange() |
| 1611 | + ) |
1613 | 1612 | } |
1614 | 1613 | }, |
1615 | 1614 | |
Index: branches/MwEmbedStandAlone/modules/EmbedPlayer/binPlayers/kaltura-player/kdp3.swf |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Index: branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayerNative.js |
— | — | @@ -57,10 +57,14 @@ |
58 | 58 | doEmbedHTML : function () { |
59 | 59 | var _this = this; |
60 | 60 | |
| 61 | + // Reset some play state flags: |
| 62 | + _this.bufferStartFlag = false; |
| 63 | + _this.bufferEndFlag = false; |
| 64 | + |
61 | 65 | mw.log( "native play url:" + this.getSrc() + ' startOffset: ' + this.start_ntp + ' end: ' + this.end_ntp ); |
62 | 66 | |
63 | 67 | // Check if using native controls and already the "pid" is already in the DOM |
64 | | - if( this.useNativeControls && $j( '#' + this.pid ).length && |
| 68 | + if( this.shouldUseNativeControls() && $j( '#' + this.pid ).length && |
65 | 69 | typeof $j( '#' + this.pid ).get(0).play != 'undefined' ) { |
66 | 70 | _this.postEmbedJS(); |
67 | 71 | return ; |
— | — | @@ -435,7 +439,7 @@ |
436 | 440 | // No vid loaded |
437 | 441 | mw.log( 'native::load() ... doEmbed' ); |
438 | 442 | this.onlyLoadFlag = true; |
439 | | - this.doEmbedPlayer(); |
| 443 | + this.doEmbedHTML(); |
440 | 444 | this.onLoadedCallback = callback; |
441 | 445 | } else { |
442 | 446 | // Should not happen offten |
Index: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerServer.js |
— | — | @@ -142,7 +142,7 @@ |
143 | 143 | 'pageStart' : pageText.substring(0, pageText.indexOf( startKey ) ), |
144 | 144 | 'sequenceXML' : pageText.substring( pageText.indexOf( startKey ) + startKey.length, |
145 | 145 | pageText.indexOf(endKey ) ), |
146 | | - 'pageEnd' : pageText.substring( pageText.indexOf(endKey) ) |
| 146 | + 'pageEnd' : pageText.substring( pageText.indexOf(endKey) + endKey.length ) |
147 | 147 | } |
148 | 148 | }, |
149 | 149 | |