r76860 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r76859‎ | r76860 | r76861 >
Date:23:55, 16 November 2010
Author:hartman
Status:deferred
Tags:
Comment:
Follow up to r76689. Reapply whitespace cleanup from r75691
Modified paths:
  • /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/mw.IFramePlayerApiClient.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/EmbedPlayer/skins/mw.PlayerControlBuilder.js (modified) (history)
  • /branches/MwEmbedStandAlone/mwEmbed.js (modified) (history)
  • /branches/MwEmbedStandAlone/mwEmbedFrame.php (modified) (history)

Diff [purge]

Index: branches/MwEmbedStandAlone/mwEmbedFrame.php
@@ -35,7 +35,7 @@
3636 );
3737 var $playerIframeId = 'iframeVid';
3838 var $debug = false;
39 -
 39+
4040 // When used in direct source mode the source asset.
4141 // NOTE: can be an array of sources in cases of "many" sources set
4242 var $sources = array();
@@ -44,15 +44,15 @@
4545 //parse input:
4646 $this->parseRequest();
4747 }
48 -
 48+
4949 // Parse the embedFrame request and sanitize input
5050 private function parseRequest(){
51 - // Check for / attribute type request and update "REQUEST" global
 51+ // Check for / attribute type request and update "REQUEST" global
5252 // ( uses kaltura standard entry_id/{entryId} request )
5353 // normalize to the REQUEST object
54 - // @@FIXME: this should be moved over to a kaltura specific iframe implementation
 54+ // @@FIXME: this should be moved over to a kaltura specific iframe implementation
5555 if( $_SERVER['REQUEST_URI'] ){
56 - $kalturaUrlMap = Array(
 56+ $kalturaUrlMap = Array(
5757 'entry_id' => 'kentryid',
5858 'uiconf_id' => 'kuiconfid',
5959 'wid' => 'kwidgetid',
@@ -78,7 +78,7 @@
7979 if( isset( $_REQUEST['debug'] ) ){
8080 $this->debug = true;
8181 }
82 -
 82+
8383 // Process the special "src" attribute
8484 if( isset( $_REQUEST['src'] ) ){
8585 if( is_array( $_REQUEST['src'] ) ){
@@ -89,10 +89,10 @@
9090 $this->sources = array( htmlspecialchars( $_REQUEST['src'] ) );
9191 }
9292 }
93 -
 93+
9494 }
9595 private function getVideoTag( ){
96 - // Add default video tag with 100% width / height
 96+ // Add default video tag with 100% width / height
9797 // ( parent embed is responsible for setting the iframe size )
9898 $o = '<video id="' . htmlspecialchars( $this->playerIframeId ) . '" style="width:100%;height:100%"';
9999 foreach( $this->playerAttributes as $attributeKey){
@@ -110,12 +110,12 @@
111111 }
112112 $o.= '</video>';
113113 return $o;
114 - }
115 -
 114+ }
 115+
116116 function outputIFrame( ){
117117 // Setup the embed string based on attribute set:
118118 $embedResourceList = 'window.jQuery,mwEmbed,mw.style.mwCommon,$j.fn.menu,mw.style.jquerymenu,mw.EmbedPlayer,mw.EmbedPlayerNative,mw.EmbedPlayerJava,mw.PlayerControlBuilder,$j.fn.hoverIntent,mw.style.EmbedPlayer,$j.cookie,$j.ui,mw.style.ui_redmond,$j.widget,$j.ui.mouse,mw.PlayerSkinKskin,mw.style.PlayerSkinKskin,mw.TimedText,mw.style.TimedText,$j.ui.slider';
119 -
 119+
120120 if( isset( $this->kentryid ) ){
121121 $embedResourceList.= ',' . implode(',', array(
122122 'KalturaClientBase',
@@ -125,7 +125,7 @@
126126 'KalturaAccessControl',
127127 'MD5',
128128 'mw.KWidgetSupport',
129 - 'mw.KAnalytics',
 129+ 'mw.KAnalytics',
130130 'mw.KDPMapping',
131131 'mw.MobileAdTimeline',
132132 'mw.KAds'
@@ -145,18 +145,18 @@
146146 left:0px;
147147 bottom:0px;
148148 right:0px;
149 -
 149+
150150 }
151151 </style>
152 - <script type="text/javascript" src="<?php echo str_replace( 'mwEmbedFrame.php', '', $_SERVER['SCRIPT_NAME'] ); ?>ResourceLoader.php?class=<?php
153 - // @@TODO we should move this over to using the mwEmbedLoader.js so we don't have to mannage the resource list in two places.
154 - // ( this will matter less once we migrate to the new mediaWiki resource loader framework)
 152+ <script type="text/javascript" src="<?php echo str_replace( 'mwEmbedFrame.php', '', $_SERVER['SCRIPT_NAME'] ); ?>ResourceLoader.php?class=<?php
 153+ // @@TODO we should move this over to using the mwEmbedLoader.js so we don't have to mannage the resource list in two places.
 154+ // ( this will matter less once we migrate to the new mediaWiki resource loader framework)
155155 echo $embedResourceList;
156156 if( $this->debug ){
157157 echo '&debug=true';
158 - }
 158+ }
159159 ?>"></script>
160 -
 160+
161161 <script type="text/javascript">
162162 //Set some iframe embed config:
163163 // We can't support full screen in object context since it requires outer page DOM control
@@ -164,21 +164,21 @@
165165
166166 // Enable the iframe player server:
167167 mw.setConfig( 'EmbedPlayer.EnableIFramePlayerServer', true );
168 -
 168+
169169 mw.ready(function(){
170 - // Bind window resize to reize the player:
 170+ // Bind window resize to reize the player:
171171 $j(window).resize(function(){
172172 $j( '#<?php echo htmlspecialchars( $this->playerIframeId )?>' )
173173 .get(0).resizePlayer({
174174 'width' : $j(window).width(),
175175 'height' : $j(window).height()
176 - });
 176+ });
177177 });
178178 });
179179 </script>
180 -
 180+
181181 </head>
182 - <body>
 182+ <body>
183183 <?
184184 // Check if we have a way to get sources:
185185 if( isset( $this->apiTitleKey ) || isset( $this->kentryid ) || count( $this->sources ) != 0 ) {
@@ -186,7 +186,7 @@
187187 } else {
188188 echo "Error: mwEmbedFrame missing required parameter for video sources</body></html>";
189189 exit(1);
190 - }
 190+ }
191191 ?>
192192 </body>
193193 </html>
Index: branches/MwEmbedStandAlone/mwEmbed.js
@@ -84,7 +84,7 @@
8585 mwConfig[ name ] = value;
8686 };
8787 /**
88 - * Merge in a configuration value:
 88+ * Merge in a configuration value:
8989 */
9090 mw.mergeConfig = function( name, value ){
9191 if( typeof name == 'object' ) {
@@ -97,7 +97,7 @@
9898 if( typeof value == 'object' && typeof mwConfig[ name ] == 'object' ) {
9999 if ( value.constructor.toString().indexOf("Array") != -1 &&
100100 mwConfig[ name ].constructor.toString().indexOf("Array") != -1 ){
101 - // merge in the array
 101+ // merge in the array
102102 mwConfig[ name ] = $j.merge( mwConfig[ name ], value );
103103 } else {
104104 for( var i in value ){
@@ -109,7 +109,7 @@
110110 // else do a normal setConfig
111111 mwConfig[ name ] = value;
112112 };
113 -
 113+
114114 /**
115115 * Set a default config value Will only update configuration if no value is
116116 * present
@@ -1161,15 +1161,15 @@
11621162
11631163 /**
11641164 * Fallforward system by default prefers flash.
1165 - *
 1165+ *
11661166 * This is separate from the EmbedPlayer library detection to provide package loading control
11671167 * NOTE: should be phased out in favor of browser feature detection where possible
1168 - *
 1168+ *
11691169 */
11701170 mw.isHTML5FallForwardNative = function(){
11711171 // Check for a mobile html5 user agent:
11721172 if ( (navigator.userAgent.indexOf('iPhone') != -1) ||
1173 - (navigator.userAgent.indexOf('iPod') != -1) ||
 1173+ (navigator.userAgent.indexOf('iPod') != -1) ||
11741174 (navigator.userAgent.indexOf('iPad') != -1) ||
11751175 (navigator.userAgent.indexOf('Android 2.') != -1) ||
11761176 // to debug in chrome / desktop safari
@@ -1177,7 +1177,7 @@
11781178 ) {
11791179 return true;
11801180 }
1181 -
 1181+
11821182 // Check if the client does not have flash and has the video tag
11831183 if ( navigator.mimeTypes && navigator.mimeTypes.length > 0 ) {
11841184 for ( var i = 0; i < navigator.mimeTypes.length; i++ ) {
@@ -1192,8 +1192,8 @@
11931193 }
11941194 }
11951195 }
1196 -
1197 - // For IE:
 1196+
 1197+ // For IE:
11981198 var hasObj = true;
11991199 try {
12001200 var obj = new ActiveXObject( 'ShockwaveFlash.ShockwaveFlash' );
@@ -1212,7 +1212,7 @@
12131213 // No video tag or flash, return false ( normal "install flash" user flow )
12141214 return false;
12151215 }
1216 - // Android 2 has some restrictions vs other mobile platforms
 1216+ // Android 2 has some restrictions vs other mobile platforms
12171217 mw.isAndroid2 = function(){
12181218 if ( navigator.userAgent.indexOf('Android 2.') != -1) {
12191219 return true;
@@ -1583,7 +1583,7 @@
15841584
15851585 // Check for direct include of the mwEmbed.js
15861586 if ( src.indexOf( 'mwEmbed.js' ) !== -1 ) {
1587 - mwpath = src.substr( 0, src.indexOf( 'mwEmbed.js' ) );
 1587+ mwpath = src.substr( 0, src.indexOf( 'mwEmbed.js' ) );
15881588 }
15891589
15901590 // Check for scriptLoader include of mwEmbed:
@@ -1747,7 +1747,7 @@
17481748 var src = js_elements[i].getAttribute( "src" );
17491749 if ( src ) {
17501750 if ( // Check for mwEmbed.js ( debug mode )
1751 - ( src.indexOf( 'mwEmbed.js' ) !== -1 && src.indexOf( 'MediaWiki:Gadget') == -1 )
 1751+ ( src.indexOf( 'mwEmbed.js' ) !== -1 && src.indexOf( 'MediaWiki:Gadget') == -1 )
17521752 || // Check for resource loader
17531753 (
17541754 ( src.indexOf( 'mwResourceLoader.php' ) !== -1 || src.indexOf( 'ResourceLoader.php' ) !== -1 )
Index: branches/MwEmbedStandAlone/modules/EmbedPlayer/loader.js
@@ -31,7 +31,7 @@
3232 // The attribution button
3333 'EmbedPlayer.AttributionButton' :{
3434 'title' : 'Kaltura html5 video library',
35 - 'href' : 'http://www.kaltura.org/project/HTML5_Video_Media_JavaScript_Library',
 35+ 'href' : 'http://www.kaltura.org/project/HTML5_Video_Media_JavaScript_Library',
3636 // Style icon to be applied
3737 'class' : 'kaltura-icon',
3838 // An icon image url ( should be a 12x12 image or data url )
@@ -344,7 +344,7 @@
345345 if( !!document.createElement('video').canPlayType && !$j.browser.safari ) {
346346 dependencyRequest[0].push( 'mw.EmbedPlayerNative' )
347347 }
348 -
 348+
349349 // Check if the iFrame player server is enabled:
350350 if (mw.getConfig('EmbedPlayer.EnableIFramePlayerServer')) {
351351 dependencyRequest.push('mw.EmbedPlayerNative');
Index: branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayer.js
@@ -1,7 +1,7 @@
2 -/**
 2+/**
33 * embedPlayer is the base class for html5 video tag javascript abstraction library
44 * embedPlayer include a few subclasses:
5 -*
 5+*
66 * mediaPlayer Media player embed system ie: java, vlc or native.
77 * mediaElement Represents source media elements
88 * mw.PlayerControlBuilder Handles skinning of the player controls
@@ -10,7 +10,7 @@
1111 /**
1212 * Add the messages text:
1313 */
14 -
 14+
1515 mw.includeAllModuleMessages();
1616
1717
@@ -21,106 +21,106 @@
2222 mw.setDefaultConfig( 'EmbedPlayer.SourceAttributes', [
2323 // source id
2424 'id',
25 -
 25+
2626 // media url
2727 'src',
28 -
 28+
2929 // media codecs attribute ( if provided )
3030 'codecs',
31 -
 31+
3232 // Title string for the source asset
3333 'title',
34 -
 34+
3535 // boolean if we support temporal url requests on the source media
3636 'URLTimeEncoding',
37 -
 37+
3838 // Media has a startOffset ( used for plugins that
3939 // display ogg page time rather than presentation time
4040 'startOffset',
41 -
 41+
4242 // A hint to the duration of the media file so that duration
4343 // can be displayed in the player without loading the media file
4444 'durationHint',
45 -
 45+
4646 // Media start time
4747 'start',
48 -
 48+
4949 // Media end time
5050 'end',
51 -
 51+
5252 // If the source is the default source
5353 'default',
54 -
 54+
5555 // Language key used for subtitle tracks
5656 'srclang',
57 -
 57+
5858 // titleKey ( used for api lookups )
5959 'titleKey',
60 -
 60+
6161 // The provider type ( for what type of api query to make )
6262 'provider_type',
63 -
 63+
6464 // The api url for the provider
65 - 'provider_url'
 65+ 'provider_url'
6666 ] );
6767
6868 /**
6969 * Adds jQuery binding for embedPlayer
7070 */
7171 ( function( $ ) {
72 -
 72+
7373 /*
7474 * embeds all players that match the rewrite player tags config Passes off
7575 * request to the embedPlayer selector:
76 - *
 76+ *
7777 * @param {Object} attributes Attributes to apply to embed players @param
7878 * {Function} callback Function to call once embedding is done
7979 */
8080 $.embedPlayers = function( attributes, callback) {
8181 $j( mw.getConfig( 'EmbedPlayer.RewriteTags' ) ).embedPlayer( attributes, callback );
8282 };
83 -
 83+
8484 /**
8585 * Selector based embedPlayer jQuery binding
86 - *
 86+ *
8787 * Rewrites all tags via a given selector
88 - *
 88+ *
8989 * @param {object=}
9090 * attributes Optional embedPlayer attributes for the given video
9191 * interface. Attributes Object can include any key value pair
9292 * that would otherwise be an attribute in the html element.
93 - *
 93+ *
9494 * also see: mw.getConfig( 'EmbedPlayer.Attributes' )
95 - *
 95+ *
9696 * @param {Function=}
9797 * callback Optional Function to be called once video interfaces
9898 * are ready
99 - *
 99+ *
100100 */
101101 $.fn.embedPlayer = function( attributes, callback ) {
102102 mw.log( 'EmbedPlayer:: fn.embedPlayer' );
103103 var playerSelect = this.selector;
104 -
 104+
105105 // Define attributes if unset
106106 if( !attributes ) {
107107 attributes = {};
108108 }
109 -
 109+
110110 // Handle optional include of attributes argument:
111111 if( typeof attributes == 'function' ){
112112 callback = attributes;
113113 attributes = {};
114114 }
115 -
 115+
116116 $j( playerSelect ).each( function( index, playerElement) {
117117 // make sure the playerElement has an id:
118118 if( $j( playerElement ).attr('id') =='' ){
119119 $j( playerElement ).attr( "id", 'mwe_v' + ( index ) );
120120 }
121 -
 121+
122122 // If we are dynamically embedding on a "div" check if we can
123123 // add a poster image behind the loader:
124 - if( playerElement.nodeName.toLowerCase() == 'div'
 124+ if( playerElement.nodeName.toLowerCase() == 'div'
125125 && ( attributes.poster || $j(playerElement).attr( 'poster' ) ) ){
126126 var posterSrc = ( attributes.poster ) ? attributes.poster : $j(playerElement).attr( 'poster' );
127127
@@ -133,7 +133,7 @@
134134 if( !height ){
135135 var height = ( attributes.height )? attributes.height : '100%';
136136 }
137 -
 137+
138138 mw.log('EmbedPlayer:: set loading background: ' + posterSrc);
139139 $j( playerElement ).append(
140140 $j( '<img />' )
@@ -146,12 +146,12 @@
147147 );
148148 }
149149 });
150 -
 150+
151151 // If we have not detected browser plugin embed types do that now
152152 if( ! mw.EmbedTypes.players ){
153153 mw.EmbedTypes.init();
154154 }
155 -
 155+
156156 // Create the Global Embed Player Manager ( if not already created )
157157 if( ! mw.playerManager ) {
158158 mw.log( "EmbedPlayer::Create the player manager:" );
@@ -178,14 +178,14 @@
179179 // Add the player
180180 mw.playerManager.addElement( playerElement, attributes);
181181 }
182 -
 182+
183183 } );
184184 // run the callback directly if no players were added to the
185185 // playerManager
186186 if( !addedToPlayerManager && callback ){
187187 callback();
188188 }
189 -
 189+
190190 });
191191 };
192192
@@ -193,7 +193,7 @@
194194
195195 /**
196196 * EmbedPlayerManager
197 - *
 197+ *
198198 * Manages calls to embed video interfaces
199199 */
200200 var EmbedPlayerManager = function( ) {
@@ -201,12 +201,12 @@
202202 return this.init( );
203203 };
204204 EmbedPlayerManager.prototype = {
205 -
 205+
206206 // Functions to run after the video interface is ready
207207 callbackFunctions : null,
208 -
 208+
209209 playerElementQueue: [],
210 -
 210+
211211 /**
212212 * Constructor initializes callbackFunctions and playerList
213213 */
@@ -214,11 +214,11 @@
215215 this.callbackFunctions = [];
216216 this.playerList = [];
217217 },
218 -
 218+
219219 /**
220220 * Adds a callback to the callbackFunctions list the callback functions are
221221 * called once the players are ready.
222 - *
 222+ *
223223 * @param {Function}
224224 * callback Function to be called once players are ready
225225 */
@@ -227,27 +227,27 @@
228228 this.callbackFunctions.push( callback );
229229 }
230230 },
231 -
 231+
232232 /**
233233 * Get the list of players
234234 */
235235 getPlayerList: function( ) {
236236 return this.playerList;
237237 },
238 -
 238+
239239 /**
240240 * Adds an Element for the embedPlayer to rewrite
241 - *
 241+ *
242242 * uses embedPlayer interface on audio / video elements uses mvPlayList
243243 * interface on playlist elements
244 - *
 244+ *
245245 * Once a player interface is established the following chain of functions
246246 * are called;
247 - *
 247+ *
248248 * _this.checkPlayerSources() _this.checkForTimedText()
249249 * _this.setupSourcePlayer() _this.inheritEmbedPlayer()
250250 * _this.selectedPlayer.load() _this.showPlayer()
251 - *
 251+ *
252252 * @param {Element}
253253 * playerElement DOM element to be swapped
254254 * @param {Object}
@@ -256,58 +256,58 @@
257257 */
258258 addElement: function( playerElement, attributes ) {
259259 var _this = this;
260 -
 260+
261261 if ( !playerElement.id || playerElement.id == '' ) {
262262 // give the playerElement an id:
263 - playerElement.id = 'vid' + ( this.playerList.length + 1 );
 263+ playerElement.id = 'vid' + ( this.playerList.length + 1 );
264264 }
265265 mw.log('EmbedPlayerManager: addElement:: ' + playerElement.id );
266266
267267 // Add the element id to playerList
268268 this.playerList.push( playerElement.id );
269 -
 269+
270270 // Check for player attributes such as skins or plugins attributes
271271 // that add to the request set
272272 var playerDependencyRequest = [];
273 -
 273+
274274 // merge in any custom attributes
275275 $j.extend( playerElement, attributes );
276 -
 276+
277277 // Update the list of dependent libraries for the player
278278 // ( allows extensions to add to the dependency list )
279279 mw.embedPlayerUpdateLibraryRequest( playerElement, playerDependencyRequest );
280 -
 280+
281281 // Load any skins we need then swap in the interface
282282 mw.load( playerDependencyRequest, function() {
283283 var waitForMeta = true;
284 -
 284+
285285 // Be sure to "stop" the target ( sometimes firefox keeps playing
286286 // the video even
287287 // though its been removed from the DOM )
288288 if( playerElement.pause ){
289289 playerElement.pause();
290290 }
291 -
292 -
 291+
 292+
293293 // Let extensions determine if its worthwhile to wait for metadata:
294294 // We pass an object to the trigger to preserve reference values
295 - var eventObject = {
296 - 'playerElement' : playerElement,
 295+ var eventObject = {
 296+ 'playerElement' : playerElement,
297297 'waitForMeta' : waitForMeta
298298 };
299299 $j( mw ).trigger( 'addElementWaitForMetaEvent', eventObject );
300 -
 300+
301301 // update the waitForMeta
302302 waitForMeta = eventObject[ 'waitForMeta' ];
303 -
304 -
 303+
 304+
305305 // Set the wait for meta flag if unset by extension
306306 if( waitForMeta ){
307307 waitForMeta = _this.waitForMetaCheck( playerElement );
308308 }
309 -
 309+
310310 var ranPlayerSwapFlag = false;
311 -
 311+
312312 // Local callback to runPlayer swap once playerElement has metadata
313313 function runPlayerSwap() {
314314 if( ranPlayerSwapFlag ){
@@ -315,10 +315,10 @@
316316 }
317317 ranPlayerSwapFlag = true;
318318 mw.log("EmbedPlayer::runPlayerSwap::" + $j( playerElement ).attr('id') );
319 -
 319+
320320 var playerInterface = new mw.EmbedPlayer( playerElement , attributes);
321321 var swapPlayer = _this.swapEmbedPlayerElement( playerElement, playerInterface );
322 -
 322+
323323 // Copy over any data attributes from the playerElement
324324 if( mw.getConfig( 'EmbedPlayer.DataAttributes' ) ) {
325325 var dataAttr = mw.getConfig( 'EmbedPlayer.DataAttributes' );
@@ -328,46 +328,46 @@
329329 }
330330 }
331331 }
332 -
 332+
333333 // Pass the id to any hook that needs to interface prior to
334334 // checkPlayerSources
335335 mw.log("EmbedPlayer::addElement :trigger " + playerInterface.id );
336336 $j( mw ).trigger ( 'newEmbedPlayerEvent', $j( '#' + playerInterface.id ).get(0) );
337 -
 337+
338338 // Issue the checkPlayerSources call to the new player
339339 // interface:
340340 // make sure to use the element that is in the DOM:
341341 $j( '#' + playerInterface.id ).get(0).checkPlayerSources();
342342 }
343 -
 343+
344344 if( waitForMeta ) {
345 - mw.log('EmbedPlayer::WaitForMeta ( video missing height (' +
346 - $j( playerElement ).attr('height') + '), width (' +
 345+ mw.log('EmbedPlayer::WaitForMeta ( video missing height (' +
 346+ $j( playerElement ).attr('height') + '), width (' +
347347 $j( playerElement ).attr('width') + ') or duration: ' +
348 - $j( playerElement ).attr('duration')
 348+ $j( playerElement ).attr('duration')
349349 );
350 -
 350+
351351 playerElement.removeEventListener( "loadedmetadata", runPlayerSwap, true );
352352 playerElement.addEventListener( "loadedmetadata", runPlayerSwap, true );
353 -
 353+
354354 // Time-out of 5 seconds ( maybe still playable but no timely
355355 // metadata )
356356 setTimeout( runPlayerSwap, 5000 );
357357 return ;
358 - } else {
 358+ } else {
359359 runPlayerSwap();
360360 return ;
361 - }
362 - });
 361+ }
 362+ });
363363 },
364 -
 364+
365365 /**
366366 * Check for bogus resolutions of the media asset that has not loaded.
367 - *
 367+ *
368368 * @return true if the resolution is "likely" to be updated by waiting for
369369 * metadata false if the resolution has been set via an attribute or
370370 * is already loaded
371 - */
 371+ */
372372 waitForMetaCheck: function( playerElement ){
373373 var waitForMeta = false;
374374 if( !playerElement )
@@ -378,19 +378,19 @@
379379 {
380380 return false;
381381 }
382 -
383 -
 382+
 383+
384384 var width = $j( playerElement ).css( 'width' );
385385 var height = $j( playerElement ).css( 'height' );
386 -
 386+
387387 // Css video defaults
388 - if( $j( playerElement ).css( 'width' ) == '300px' &&
 388+ if( $j( playerElement ).css( 'width' ) == '300px' &&
389389 $j( playerElement ).css( 'height' ) == '150px'
390390 ){
391391 waitForMeta = true;
392392 } else {
393393 // Check if we should wait for duration:
394 - if( $j( playerElement ).attr( 'duration') ||
 394+ if( $j( playerElement ).attr( 'duration') ||
395395 $j( playerElement ).attr('durationHint')
396396 ){
397397 // height, width and duration set; do not wait for meta data:
@@ -399,31 +399,31 @@
400400 waitForMeta = true;
401401 }
402402 }
403 -
 403+
404404 // Firefox ~ sometimes ~ gives -1 for unloaded media
405405 if ( $j(playerElement).attr( 'width' ) == -1 || $j(playerElement).attr( 'height' ) == -1 ) {
406 - waitForMeta = true;
 406+ waitForMeta = true;
407407 }
408 -
 408+
409409 // Google Chrome / safari gives 0 width height for unloaded media
410 - if( $j(playerElement).attr( 'width' ) === 0 ||
411 - $j(playerElement).attr( 'height' ) === 0
 410+ if( $j(playerElement).attr( 'width' ) === 0 ||
 411+ $j(playerElement).attr( 'height' ) === 0
412412 ) {
413413 waitForMeta = true;
414414 }
415 -
 415+
416416 // Firefox default width height is ~sometimes~ 150 / 300
417417 if( this.height == 150 && this.width == 300 ){
418 - waitForMeta = true;
 418+ waitForMeta = true;
419419 }
420 -
 420+
421421 // Make sure we have a src attribute or source child
422422 // ( i.e not a video tag to be dynamically populated or looked up from
423423 // xml resource description )
424 - if( waitForMeta &&
 424+ if( waitForMeta &&
425425 (
426426 $j( playerElement ).attr('src') ||
427 - $j( playerElement ).find("source[src]").length !== 0
 427+ $j( playerElement ).find("source[src]").length !== 0
428428 )
429429 ) {
430430 // Detect src type ( if no type set )
@@ -431,15 +431,15 @@
432432 } else {
433433 // playerElement is not likely to update its meta data ( no src )
434434 return false;
435 - }
 435+ }
436436 },
437 -
 437+
438438 /**
439439 * swapEmbedPlayerElement
440 - *
 440+ *
441441 * Takes a video element as input and swaps it out with an embed player
442442 * interface
443 - *
 443+ *
444444 * @param {Element}
445445 * targetElement Element to be swapped
446446 * @param {Object}
@@ -449,7 +449,7 @@
450450 mw.log( 'EmbedPlayer::swapEmbedPlayerElement: ' + targetElement.id );
451451 // Create a new element to swap the player interface into
452452 var swapPlayerElement = document.createElement('div');
453 -
 453+
454454 // Get properties / methods from playerInterface
455455 for ( var method in playerInterface ) {
456456 if ( method != 'readyState' ) { // readyState crashes IE ( don't
@@ -457,7 +457,7 @@
458458 swapPlayerElement[ method ] = playerInterface[ method ];
459459 }
460460 }
461 -
 461+
462462 // Check if we are using native controls ( should keep the video embed
463463 // around )
464464 if( playerInterface.useNativePlayerControls() ) {
@@ -465,20 +465,20 @@
466466 .attr( 'id', playerInterface.pid )
467467 .addClass( 'nativeEmbedPlayerPid' )
468468 .show()
469 - .after(
 469+ .after(
470470 $j( swapPlayerElement ).css( 'display', 'none' )
471471 );
472472 } else {
473473 $j( targetElement ).replaceWith( swapPlayerElement );
474474 }
475 -
476 -
 475+
 476+
477477 // Set swapPlayerElement has height / width set and set to loading:
478478 $j( swapPlayerElement ).css( {
479479 'width' : playerInterface.width + 'px',
480480 'height' : playerInterface.height + 'px'
481481 } );
482 -
 482+
483483 // If we don't already have a loadSpiner add one:
484484 if( $j('#loadingSpinner_' + playerInterface.id ).length == 0 ){
485485 if( playerInterface.useNativePlayerControls() ) {
@@ -486,7 +486,7 @@
487487 .getAbsoluteOverlaySpinner()
488488 .attr('id', 'loadingSpinner_' + playerInterface.id );
489489 }else{
490 - $j( swapPlayerElement ).append(
 490+ $j( swapPlayerElement ).append(
491491 $j('<div />')
492492 .loadingSpinner()
493493 );
@@ -494,14 +494,14 @@
495495 }
496496 return swapPlayerElement;
497497 },
498 -
499 -
 498+
 499+
500500 /**
501501 * Player ready will run the global callbacks once players are "ready"
502 - *
 502+ *
503503 * This enables mw.ready event to expose video tag elements as if the
504504 * videotag was supported natively.
505 - *
 505+ *
506506 * @param {Object}
507507 * player The EmbedPlayer object
508508 */
@@ -509,14 +509,14 @@
510510 var _this = this;
511511 mw.log( 'EmbedPlayer::ReadyToPlay callback player:' + player.id );
512512 player.readyToPlay = true;
513 -
 513+
514514 // Remove the player loader spinner:
515515 $j('#loadingSpinner_' + player.id ).remove();
516 -
 516+
517517 // Run the player ready trigger
518518 $j( player ).trigger( 'playerReady' );
519 -
520 - var is_ready = true;
 519+
 520+ var is_ready = true;
521521 for ( var i = 0; i < this.playerList.length; i++ ) {
522522 var currentPlayer = $j( '#' + this.playerList[i] ).get( 0 );
523523 if ( player ) {
@@ -527,7 +527,7 @@
528528 if ( is_ready ) {
529529 // Be sure to remove any player loader spinners
530530 $j('.playerLoadingSpinner').remove();
531 -
 531+
532532 mw.log( "EmbedPlayer::All on-page players ready run playerManager callbacks" );
533533 // Run queued functions
534534 if( _this.callbackFunctions ) {
@@ -541,7 +541,7 @@
542542
543543 /**
544544 * mediaSource class represents a source for a media element.
545 - *
 545+ *
546546 * @param {Element}
547547 * element: MIME type of the source.
548548 * @constructor
@@ -553,50 +553,50 @@
554554 mediaSource.prototype = {
555555 // MIME type of the source.
556556 mimeType:null,
557 -
 557+
558558 // URI of the source.
559559 uri:null,
560 -
 560+
561561 // Title of the source.
562562 title: null,
563 -
 563+
564564 // True if the source has been marked as the default.
565565 markedDefault: false,
566 -
 566+
567567 // True if the source supports url specification of offset and duration
568568 URLTimeEncoding:false,
569 -
 569+
570570 // Start offset of the requested segment
571571 startOffset: 0,
572 -
 572+
573573 // Duration of the requested segment (0 if not known)
574574 duration:0,
575 -
 575+
576576 // Is the source playable
577577 is_playable: null,
578 -
 578+
579579 // source id
580580 id: null,
581 -
 581+
582582 // Start time in npt format
583583 start_npt: null,
584 -
 584+
585585 // End time in npt format
586586 end_npt: null,
587 -
 587+
588588 // A provider "id" to identify api request type
589589 provider_type : null,
590590
591591 // The api url for the provider
592 - provider_url : null,
593 -
 592+ provider_url : null,
 593+
594594 /**
595595 * MediaSource constructor:
596596 */
597597 init : function( element ) {
598598 // mw.log('EmbedPlayer::adding mediaSource: ' + element);
599599 this.src = $j( element ).attr( 'src' );
600 -
 600+
601601 // Set default URLTimeEncoding if we have a time url:
602602 // not ideal way to discover if content is on an oggz_chop server.
603603 // should check some other way.
@@ -604,9 +604,9 @@
605605 if ( typeof pUrl[ 'queryKey' ][ 't' ] != 'undefined' ) {
606606 this.URLTimeEncoding = true;
607607 }
608 -
 608+
609609 var sourceAttr = mw.getConfig( 'EmbedPlayer.SourceAttributes' );
610 -
 610+
611611 for ( var i = 0; i < sourceAttr.length; i++ ) { // array loop:
612612 var attr = sourceAttr[ i ];
613613 var attr_value = element.getAttribute( attr );
@@ -614,8 +614,8 @@
615615 this[ attr ] = attr_value;
616616 }
617617 }
618 -
619 -
 618+
 619+
620620 // Set the content type:
621621 if ( $j( element ).attr( 'type' ) ) {
622622 this.mimeType = $j( element ).attr( 'type' );
@@ -627,32 +627,32 @@
628628 } else {
629629 this.mimeType = this.detectType( this.src );
630630 }
631 -
 631+
632632 // Conform the mime type to ogg
633633 if( this.mimeType == 'video/theora') {
634634 this.mimeType = 'video/ogg';
635635 }
636 -
 636+
637637 if( this.mimeType == 'audio/vorbis') {
638638 this.mimeType = 'audio/ogg';
639639 }
640 -
 640+
641641 // Check for parent elements ( supplies categories in "track" )
642642 if( $j( element ).parent().attr('category') ) {
643643 this.category = $j( element ).parent().attr('category');
644644 }
645 -
 645+
646646 if( $j( element ).attr( 'default' ) ){
647647 this.markedDefault = true;
648648 }
649 -
 649+
650650 // Get the url duration ( if applicable )
651651 this.getURLDuration();
652652 },
653 -
 653+
654654 /**
655655 * Update Source title via Element
656 - *
 656+ *
657657 * @param {Element}
658658 * element Source element to update attributes from
659659 */
@@ -662,10 +662,10 @@
663663 this.title = $j( element ).attr( "title" );
664664 }
665665 },
666 -
 666+
667667 /**
668668 * Updates the src time and start & end
669 - *
 669+ *
670670 * @param {String}
671671 * start_time: in NPT format
672672 * @param {String}
@@ -681,23 +681,23 @@
682682 if ( !mw.npt2seconds( start_npt ) ) {
683683 start_npt = this.start_npt;
684684 }
685 -
 685+
686686 if ( !mw.npt2seconds( end_npt ) ) {
687687 end_npt = this.end_npt;
688688 }
689 -
690 - this.src = mw.replaceUrlParams( this.src, {
691 - 't': start_npt + '/' + end_npt
 689+
 690+ this.src = mw.replaceUrlParams( this.src, {
 691+ 't': start_npt + '/' + end_npt
692692 });
693 -
 693+
694694 // update the duration
695695 this.getURLDuration();
696696 }
697697 },
698 -
 698+
699699 /**
700700 * Sets the duration and sets the end time if unset
701 - *
 701+ *
702702 * @param {Float}
703703 * duration: in seconds
704704 */
@@ -707,10 +707,10 @@
708708 this.end_npt = mw.seconds2npt( this.startOffset + duration );
709709 }
710710 },
711 -
 711+
712712 /**
713713 * MIME type accessors function.
714 - *
 714+ *
715715 * @return {String} the MIME type of the source.
716716 */
717717 getMIMEType: function() {
@@ -720,10 +720,10 @@
721721 this.mimeType = this.detectType( this.src );
722722 return this.mimeType;
723723 },
724 -
 724+
725725 /**
726726 * URI function.
727 - *
 727+ *
728728 * @param {Number}
729729 * serverSeekTime Int: Used to adjust the URI for url based
730730 * seeks)
@@ -739,21 +739,21 @@
740740 }
741741 return mw.replaceUrlParams( this.src,
742742 {
743 - 't': mw.seconds2npt( serverSeekTime ) + endvar
 743+ 't': mw.seconds2npt( serverSeekTime ) + endvar
744744 }
745 - );
 745+ );
746746 },
747 -
 747+
748748 /**
749749 * Title accessor function.
750 - *
 750+ *
751751 * @return {String} Title of the source.
752752 */
753753 getTitle : function() {
754754 if( this.title ){
755755 return this.title;
756756 }
757 -
 757+
758758 // Return a Title based on mime type:
759759 switch( this.getMIMEType() ) {
760760 case 'video/h264' :
@@ -775,21 +775,21 @@
776776 return 'AVI video'; // FIXME: i18n
777777 break;
778778 }
779 -
 779+
780780 // Return tilte based on file name:
781781 var urlParts = mw.parseUri( this.getSrc() );
782782 if( urlParts.file ){
783783 return urlParts.file;
784784 }
785 -
 785+
786786 // Return the mime type string if not known type.
787787 return this.mimeType;
788788 },
789 -
 789+
790790 /**
791 - *
 791+ *
792792 * Get Duration of the media in milliseconds from the source url.
793 - *
 793+ *
794794 * Supports media_url?t=ntp_start/ntp_end url request format
795795 */
796796 getURLDuration : function() {
@@ -813,10 +813,10 @@
814814 }
815815 }
816816 },
817 -
 817+
818818 /**
819819 * Attempts to detect the type of a media file based on the URI.
820 - *
 820+ *
821821 * @param {String}
822822 * uri URI of the media file.
823823 * @return {String} The guessed MIME type of the file.
@@ -875,11 +875,11 @@
876876
877877 /**
878878 * A media element corresponding to a <video> element.
879 - *
 879+ *
880880 * It is implemented as a collection of mediaSource objects. The media sources
881881 * will be initialized from the <video> element, its child <source> elements,
882882 * and/or the ROE file referenced by the <video> element.
883 - *
 883+ *
884884 * @param {element}
885885 * videoElement <video> element used for initialization.
886886 * @constructor
@@ -889,28 +889,28 @@
890890 }
891891
892892 mediaElement.prototype = {
893 -
 893+
894894 // The array of mediaSource elements.
895895 sources: null,
896 -
 896+
897897 // flag for ROE data being added.
898898 addedROEData: false,
899 -
 899+
900900 // Selected mediaSource element.
901901 selectedSource: null,
902 -
 902+
903903 // Media element thumbnail
904904 thumbnail: null,
905 -
 905+
906906 // Media element linkback
907907 linkback: null,
908908
909909 /**
910910 * Media Element constructor
911 - *
 911+ *
912912 * Sets up a mediaElement from a provided top level "video" element adds any
913913 * child sources that are found
914 - *
 914+ *
915915 * @param {Element}
916916 * videoElement Element that has src attribute or has children
917917 * source elements
@@ -919,22 +919,22 @@
920920 var _this = this;
921921 mw.log( "EmbedPlayer::mediaElement:init:" + videoElement.id );
922922 this.sources = new Array();
923 -
 923+
924924 // Process the videoElement as a source element:
925925 if ( $j( videoElement ).attr( "src" ) ) {
926926 _this.tryAddSource( videoElement );
927927 }
928 -
 928+
929929 // Process elements source children
930930 $j( videoElement ).find( 'source,track' ).each( function( ) {
931931 _this.tryAddSource( this );
932932 } );
933933 },
934 -
 934+
935935 /**
936936 * Updates the time request for all sources that have a standard time
937937 * request argument (ie &t=start_time/end_time)
938 - *
 938+ *
939939 * @param {String}
940940 * start_npt Start time in npt format
941941 * @param {String}
@@ -946,27 +946,27 @@
947947 mediaSource.updateSrcTime( start_npt, end_npt );
948948 } );
949949 },
950 -
 950+
951951 /**
952952 * Check for Timed Text tracks
953 - *
 953+ *
954954 * @return {Boolean} True if text tracks exist, false if no text tracks are
955955 * found
956956 */
957957 textSourceExists: function() {
958958 for ( var i = 0; i < this.sources.length; i++ ) {
959 - if ( this.sources[i].mimeType == 'text/cmml' ||
960 - this.sources[i].mimeType == 'text/x-srt' )
 959+ if ( this.sources[i].mimeType == 'text/cmml' ||
 960+ this.sources[i].mimeType == 'text/x-srt' )
961961 {
962962 return true;
963963 }
964964 };
965965 return false;
966966 },
967 -
 967+
968968 /**
969969 * Returns the array of mediaSources of this element.
970 - *
 970+ *
971971 * @param {String}
972972 * [mimeFilter] Filter criteria for set of mediaSources to return
973973 * @return {Array} mediaSource elements.
@@ -979,17 +979,17 @@
980980 var source_set = new Array();
981981 for ( var i = 0; i < this.sources.length ; i++ ) {
982982 if ( this.sources[i].mimeType &&
983 - this.sources[i].mimeType.indexOf( mimeFilter ) != -1 )
 983+ this.sources[i].mimeType.indexOf( mimeFilter ) != -1 )
984984 {
985985 source_set.push( this.sources[i] );
986986 }
987987 }
988988 return source_set;
989989 },
990 -
 990+
991991 /**
992992 * Selects a source by id
993 - *
 993+ *
994994 * @param {String}
995995 * source_id Id of the source to select.
996996 * @return {MediaSource} The selected mediaSource or null if not found
@@ -1002,10 +1002,10 @@
10031003 }
10041004 return null;
10051005 },
1006 -
 1006+
10071007 /**
10081008 * Selects a particular source for playback updating the "selectedSource"
1009 - *
 1009+ *
10101010 * @param {Number}
10111011 * index Index of source element to set as selectedSource
10121012 */
@@ -1021,22 +1021,22 @@
10221022 }
10231023 }
10241024 },
1025 -
 1025+
10261026 /**
10271027 * Selects the default source via cookie preference, default marked, or by
10281028 * id order
10291029 */
1030 - autoSelectSource: function() {
 1030+ autoSelectSource: function() {
10311031 mw.log( 'EmbedPlayer::mediaElement::autoSelectSource' );
10321032 // Select the default source
10331033 var playableSources = this.getPlayableSources();
10341034 var flash_flag = ogg_flag = false;
1035 -
 1035+
10361036 // Check if there are any playableSources
10371037 if( playableSources.length == 0 ){
10381038 return false;
10391039 }
1040 -
 1040+
10411041 // Set via user-preference
10421042 for ( var source = 0; source < playableSources.length; source++ ) {
10431043 var mimeType = playableSources[source].mimeType;
@@ -1046,7 +1046,7 @@
10471047 return true;
10481048 }
10491049 }
1050 -
 1050+
10511051 // Set via marked default:
10521052 for ( var source = 0; source < playableSources.length; source++ ) {
10531053 if ( playableSources[ source ].markedDefault ) {
@@ -1055,7 +1055,7 @@
10561056 return true;
10571057 }
10581058 }
1059 -
 1059+
10601060 // Prefer native playback
10611061 for ( var source = 0; source < playableSources.length; source++ ) {
10621062 var mimeType = playableSources[source].mimeType;
@@ -1066,15 +1066,15 @@
10671067 return true;
10681068 }
10691069 }
1070 -
 1070+
10711071 // Set h264 via native or flash fallback
10721072 for ( var source = 0; source < playableSources.length; source++ ) {
10731073 var mimeType = playableSources[source].mimeType;
10741074 var player = mw.EmbedTypes.players.defaultPlayer( mimeType );
1075 - if ( mimeType == 'video/h264'
1076 - && player
1077 - && (
1078 - player.library == 'Native'
 1075+ if ( mimeType == 'video/h264'
 1076+ && player
 1077+ && (
 1078+ player.library == 'Native'
10791079 ||
10801080 player.library == 'Kplayer'
10811081 )
@@ -1084,7 +1084,7 @@
10851085 return true;
10861086 }
10871087 };
1088 -
 1088+
10891089 // Else just select first source
10901090 if ( !this.selectedSource ) {
10911091 mw.log( 'set via first source:' + playableSources[0] );
@@ -1094,33 +1094,33 @@
10951095 // No Source found so no source selected
10961096 return false;
10971097 },
1098 -
 1098+
10991099 /**
11001100 * check if the mime is ogg
1101 - */
 1101+ */
11021102 isOgg: function( mimeType ){
1103 - if ( mimeType == 'video/ogg'
1104 - || mimeType == 'ogg/video'
1105 - || mimeType == 'video/annodex'
 1103+ if ( mimeType == 'video/ogg'
 1104+ || mimeType == 'ogg/video'
 1105+ || mimeType == 'video/annodex'
11061106 || mimeType == 'application/ogg'
11071107 ) {
11081108 return true;
11091109 }
11101110 return false;
11111111 },
1112 -
 1112+
11131113 /**
11141114 * Returns the thumbnail URL for the media element.
1115 - *
 1115+ *
11161116 * @returns {String} thumbnail URL
11171117 */
11181118 getPosterSrc: function( ) {
11191119 return this.poster;
11201120 },
1121 -
 1121+
11221122 /**
11231123 * Checks whether there is a stream of a specified MIME type.
1124 - *
 1124+ *
11251125 * @param {String}
11261126 * mimeType MIME type to check.
11271127 * @return {Boolean} true if sources include MIME false if not.
@@ -1135,7 +1135,7 @@
11361136 }
11371137 return false;
11381138 },
1139 -
 1139+
11401140 /**
11411141 * Checks if media is a playable type
11421142 */
@@ -1146,11 +1146,11 @@
11471147 return false;
11481148 }
11491149 },
1150 -
 1150+
11511151 /**
11521152 * Adds a single mediaSource using the provided element if the element has a
11531153 * 'src' attribute.
1154 - *
 1154+ *
11551155 * @param {Element}
11561156 * element <video>, <source> or <mediaSource> <text> element.
11571157 */
@@ -1170,20 +1170,20 @@
11711171 }
11721172 // Create a new source
11731173 var source = new mediaSource( element );
1174 -
 1174+
11751175 this.sources.push( source );
11761176 // mw.log( 'tryAddSource: added source ::' + source + 'sl:' +
11771177 // this.sources.length );
11781178 return source;
11791179 },
1180 -
 1180+
11811181 /**
11821182 * Get playable sources
1183 - *
 1183+ *
11841184 * @returns {Array} of playable sources
11851185 */
11861186 getPlayableSources: function() {
1187 - var playableSources = [];
 1187+ var playableSources = [];
11881188 for ( var i = 0; i < this.sources.length; i++ ) {
11891189 if ( this.isPlayableType( this.sources[i].mimeType ) ) {
11901190 playableSources.push( this.sources[i] );
@@ -1193,10 +1193,10 @@
11941194 };
11951195 return playableSources;
11961196 },
1197 -
 1197+
11981198 /**
11991199 * Imports media sources from ROE data.
1200 - *
 1200+ *
12011201 * @param roe_data
12021202 * ROE data.
12031203 */
@@ -1206,12 +1206,12 @@
12071207 var _this = this;
12081208 if ( roe_data ) {
12091209 var $roeParsed = $j( roe_data.pay_load );
1210 -
 1210+
12111211 // Add media sources:
12121212 $roeParsed.find("mediaSource").each( function( inx, source ) {
12131213 _this.tryAddSource( source );
12141214 } );
1215 -
 1215+
12161216 // Set the thumbnail:
12171217 $roeParsed.find( 'img' ).each( function( inx, n ) {
12181218 if ( $j( n ).attr( "id" ) == "stream_thumb" ) {
@@ -1219,7 +1219,7 @@
12201220 _this.poster = $j( n ).attr( "src" );
12211221 }
12221222 } );
1223 -
 1223+
12241224 // Set the linkback:
12251225 $roeParsed.find( 'link' ).each( function( inx, n ) {
12261226 if ( $j( n ).attr( 'id' ) == 'html_linkback' ) {
@@ -1236,7 +1236,7 @@
12371237
12381238 /**
12391239 * Base embedPlayer object
1240 - *
 1240+ *
12411241 * @param {Element}
12421242 * element, the element used for initialization.
12431243 * @param {Object}
@@ -1249,63 +1249,63 @@
12501250 };
12511251
12521252 mw.EmbedPlayer.prototype = {
1253 -
 1253+
12541254 // The mediaElement object containing all mediaSource objects
12551255 'mediaElement' : null,
1256 -
 1256+
12571257 // Object that describes the supported feature set of the underling plugin /
12581258 // player
12591259 'supports': { },
1260 -
 1260+
12611261 // Preview mode flag,
12621262 // some plugins don't seek accurately but in preview mode we need
12631263 // accurate seeks so we do tricks like hide the image until its ready
12641264 'preview_mode' : false,
1265 -
 1265+
12661266 // Ready to play
12671267 // NOTE: we should switch over to setting the html5 video ready state
1268 - 'readyToPlay' : false,
1269 -
 1268+ 'readyToPlay' : false,
 1269+
12701270 // Stores the loading errors
1271 - 'loadError' : false,
1272 -
 1271+ 'loadError' : false,
 1272+
12731273 // Thumbnail updating flag ( to avoid rewriting an thumbnail thats already
12741274 // being updated)
12751275 'thumbnail_updating' : false,
1276 -
 1276+
12771277 // Thumbnail display flag
12781278 'thumbnail_disp' : true,
1279 -
 1279+
12801280 // Local variable to hold CMML meeta data about the current clip
12811281 // for more on CMML see: http://wiki.xiph.org/CMML
12821282 'cmmlData': null,
1283 -
 1283+
12841284 // Stores the seek time request, Updated by the doSeek function
12851285 'serverSeekTime' : 0,
1286 -
 1286+
12871287 // If the embedPlayer is current 'seeking'
12881288 'seeking' : false,
1289 -
 1289+
12901290 // Percent of the clip buffered:
12911291 'bufferedPercent' : 0,
1292 -
 1292+
12931293 // Holds the timer interval function
12941294 'monitorTimerId' : null,
1295 -
 1295+
12961296 // Buffer flags
12971297 'bufferStartFlag' : false,
12981298 'bufferEndFlag' : false,
1299 -
 1299+
13001300 // On done playing
13011301 'donePlayingCount' : 0
13021302 ,
13031303 // if player events should be Propagated
13041304 '_propagateEvents': true,
1305 -
1306 -
 1305+
 1306+
13071307 /**
13081308 * embedPlayer constructor
1309 - *
 1309+ *
13101310 * @param {Element}
13111311 * element DOM element that we are building the player interface
13121312 * for.
@@ -1319,7 +1319,7 @@
13201320 if ( !customAttributes ) {
13211321 customAttributes = { };
13221322 }
1323 -
 1323+
13241324 var playerAttributes = mw.getConfig( 'EmbedPlayer.Attributes' );
13251325 // Setup the player Interface from supported attributes:
13261326 for ( var attr in playerAttributes ) {
@@ -1340,17 +1340,17 @@
13411341 if( this[ attr ] == "true" ) this[attr] = true;
13421342 }
13431343 //
1344 -
1345 -
 1344+
 1345+
13461346 if( this.apiTitleKey ){
13471347 this.apiTitleKey = decodeURI( this.apiTitleKey );
13481348 }
1349 -
 1349+
13501350 // Hide "controls" if using native player controls:
13511351 if( this.useNativePlayerControls() ){
13521352 _this.controls = false;
13531353 }
1354 -
 1354+
13551355 // Set the poster:
13561356 if ( $j( element ).attr( 'thumbnail' ) ) {
13571357 _this.poster = $j( element ).attr( 'thumbnail' );
@@ -1358,10 +1358,10 @@
13591359 if ( $j( element ).attr( 'poster' ) ) {
13601360 _this.poster = $j( element ).attr( 'poster' );
13611361 }
1362 -
 1362+
13631363 // Set the skin name from the class
13641364 var sn = $j(element).attr( 'class' );
1365 -
 1365+
13661366 if ( sn && sn != '' ) {
13671367 for ( var n = 0; n < mw.validSkins.length; n++ ) {
13681368 if ( sn.indexOf( mw.validSkins[n].toLowerCase() ) !== -1 ) {
@@ -1369,43 +1369,43 @@
13701370 }
13711371 }
13721372 }
1373 -
 1373+
13741374 // Set the default skin if unset:
13751375 if ( !this.skinName ) {
13761376 this.skinName = mw.getConfig( 'EmbedPlayer.SkinName' );
13771377 }
1378 -
 1378+
13791379 if( !this.monitorRate ){
13801380 this.monitorRate = mw.getConfig( 'EmbedPlayer.MonitorRate' );
13811381 }
1382 -
 1382+
13831383 // Make sure startOffset is cast as an float:
13841384 if ( this.startOffset && this.startOffset.split( ':' ).length >= 2 ) {
13851385 this.startOffset = parseFloat( mw.npt2seconds( this.startOffset ) );
13861386 }
1387 -
 1387+
13881388 // Make sure offset is in float:
13891389 this.startOffset = parseFloat( this.startOffset );
1390 -
 1390+
13911391 // Set the source duration ( if provided in the element metaData or
13921392 // durationHint )
13931393 if ( $j( element ).attr( 'duration' ) ) {
13941394 _this.duration = $j( element ).attr( 'duration' );
13951395 }
1396 -
 1396+
13971397 if ( !_this.duration && $j( element ).attr( 'durationHint' ) ) {
13981398 _this.durationHint = $j( element ).attr( 'durationHint' );
13991399 // Convert duration hint if needed:
14001400 _this.duration = mw.npt2seconds( _this.durationHint );
1401 - }
1402 -
 1401+ }
 1402+
14031403 // Make sure duration is a float:
14041404 this.duration = parseFloat( this.duration );
14051405 mw.log( 'EmbedPlayer::mediaElement:' + this.id + " duration is: " + this.duration );
1406 -
 1406+
14071407 // Set the player size attributes based loaded video element:
1408 - this.setPlayerSize( element );
1409 -
 1408+ this.setPlayerSize( element );
 1409+
14101410 // Set the plugin id
14111411 this.pid = 'pid_' + this.id;
14121412
@@ -1415,10 +1415,10 @@
14161416 // mw.log( 'innerHTML: ' + element.innerHTML );
14171417 this.user_missing_plugin_html = element.innerHTML;
14181418 }
1419 -
 1419+
14201420 // Add the mediaElement object with the elements sources:
14211421 this.mediaElement = new mediaElement( element );
1422 -
 1422+
14231423 // Process attribute "sources" for dynamic embedding
14241424 if( customAttributes.sources && customAttributes.sources.length ){
14251425 for( var i =0; i < customAttributes.sources.length ; i ++ ){
@@ -1439,7 +1439,7 @@
14401440 }
14411441 }
14421442 },
1443 -
 1443+
14441444 stopEventPropagation: function(){
14451445 this._propagateEvents = false;
14461446 },
@@ -1452,24 +1452,24 @@
14531453 updateFeatureSupport: function(){
14541454 return ;
14551455 },
1456 -
 1456+
14571457 /**
14581458 * Set the width & height from css style attribute, element attribute, or by
14591459 * default value if no css or attribute is provided set a callback to
14601460 * resize.
1461 - *
 1461+ *
14621462 * Updates this.width & this.height
1463 - *
 1463+ *
14641464 * @param {Element}
14651465 * element Source element to grab size from
14661466 */
14671467 setPlayerSize: function( element ) {
14681468 this.height = $j(element).css( 'height' );
14691469 this.width = $j(element).css( 'width' );
1470 -
 1470+
14711471 // Set to parent size ( resize events will cause player size updates)
14721472 if( this.height.indexOf('100%') != -1 || this.width.indexOf('100%') != -1 ){
1473 - $relativeParent = $j(element).parents().filter(function() {
 1473+ $relativeParent = $j(element).parents().filter(function() {
14741474 // reduce to only relative position or "body" elements
14751475 return $j(this).is('body') || $j(this).css('position') == 'relative';
14761476 }).slice(0,1); // grab only the "first"
@@ -1482,21 +1482,21 @@
14831483
14841484 // Set via attribute if CSS is zero or NaN and we have an attribute
14851485 // value:
1486 - this.height = ( this.height==0 || isNaN( this.height )
1487 - && $j(element).attr( 'height' ) ) ?
 1486+ this.height = ( this.height==0 || isNaN( this.height )
 1487+ && $j(element).attr( 'height' ) ) ?
14881488 parseInt( $j(element).attr( 'height' ) ): this.height;
1489 - this.width = ( this.width == 0 || isNaN( this.width )
1490 - && $j(element).attr( 'width' ) )?
 1489+ this.width = ( this.width == 0 || isNaN( this.width )
 1490+ && $j(element).attr( 'width' ) )?
14911491 parseInt( $j(element).attr( 'width' ) ): this.width;
1492 -
1493 -
 1492+
 1493+
14941494 // Special case for audio
14951495 // Firefox sets audio height to "0px" while webkit uses 32px .. force
14961496 // zero:
14971497 if( element.tagName.toLowerCase() == 'audio' && this.height == '32' ) {
1498 - this.height = 0;
 1498+ this.height = 0;
14991499 }
1500 -
 1500+
15011501 // Use default aspect ration to get height or width ( if rewriting a
15021502 // non-audio player )
15031503 if( element.tagName.toLowerCase() != 'audio' && this.videoAspect ) {
@@ -1509,15 +1509,15 @@
15101510 this.height = parseInt( this.width * ( aspect[1] / aspect[0] ) );
15111511 }
15121512 }
1513 -
 1513+
15141514 // On load sometimes attr is temporally -1 as we don't have video
15151515 // metadata yet.
15161516 // or in IE we get NaN for width height
1517 - //
 1517+ //
15181518 // NOTE: browsers that do support height width should set "waitForMeta"
15191519 // flag in addElement
15201520 if( ( isNaN( this.height ) && isNaN( this.width ) ) ||
1521 - ( this.height == -1 || this.width == -1 ) ||
 1521+ ( this.height == -1 || this.width == -1 ) ||
15221522 // Check for firefox defaults
15231523 // Note: ideally firefox would not do random guesses at css
15241524 // values
@@ -1525,7 +1525,7 @@
15261526 ) {
15271527 var defaultSize = mw.getConfig( 'EmbedPlayer.DefaultSize' ).split( 'x' );
15281528 this.width = defaultSize[0];
1529 -
 1529+
15301530 // Special height default for audio tag ( if not set )
15311531 if( element.tagName.toLowerCase() == 'audio' ) {
15321532 this.height = 0;
@@ -1533,7 +1533,7 @@
15341534 this.height = defaultSize[1];
15351535 }
15361536 }
1537 -
 1537+
15381538 },
15391539 /**
15401540 * Resize the player to a new size preserving aspect ratio Wraps the
@@ -1541,7 +1541,7 @@
15421542 */
15431543 resizePlayer: function( size , animate){
15441544 mw.log("EmbedPlayer::resizePlayer:" + size.width + ' x ' + size.height );
1545 -
 1545+
15461546 // Check if we are native display then resize the playerElement directly
15471547 if( this.useNativePlayerControls() ){
15481548 if( animate ){
@@ -1553,19 +1553,19 @@
15541554 this.controlBuilder.resizePlayer( size, animate);
15551555 }
15561556 },
1557 -
 1557+
15581558 /**
15591559 * Get the player pixel width not including controls
1560 - *
 1560+ *
15611561 * @return {Number} pixel height of the video
15621562 */
15631563 getPlayerWidth: function() {
15641564 return $j( this ).width();
15651565 },
1566 -
 1566+
15671567 /**
15681568 * Get the player pixel height not including controls
1569 - *
 1569+ *
15701570 * @return {Number} pixel height of the video
15711571 */
15721572 getPlayerHeight: function() {
@@ -1579,7 +1579,7 @@
15801580 checkPlayerSources: function() {
15811581 mw.log( 'EmbedPlayer::checkPlayerSources: ' + this.id );
15821582 var _this = this;
1583 -
 1583+
15841584 // Scope the end of check for player sources so it can be called in a
15851585 // callback
15861586 var finishCheckPlayerSources = function(){
@@ -1588,7 +1588,7 @@
15891589 _this.checkForTimedText();
15901590 });
15911591 };
1592 -
 1592+
15931593 // NOTE: Should could be moved to mediaWiki Api support module
15941594 // only load from api if sources are empty:
15951595 if ( _this.apiTitleKey && this.mediaElement.sources.length == 0) {
@@ -1598,24 +1598,24 @@
15991599 finishCheckPlayerSources();
16001600 } );
16011601 return ;
1602 - } else {
 1602+ } else {
16031603 finishCheckPlayerSources();
16041604 }
16051605 },
1606 -
 1606+
16071607 /**
16081608 * Insert and play a video source ( useful for ads or bumper videos )
1609 - *
 1609+ *
16101610 * Only works while video is in active play back. Only tested with native
16111611 * playback atm.
16121612 */
16131613 insertAndPlaySource: function( source ){
16141614 mw.log("Error: only native playback supports insertAndPlaySource right now");
16151615 },
1616 -
 1616+
16171617 /**
16181618 * Load Source video info from mediaWiki Api title key ( this.apiTitleKey )
1619 - *
 1619+ *
16201620 * @@todo move this to mediaWiki 'api' module
16211621 * @param {Function}
16221622 * callback Function called once loading is complete
@@ -1626,12 +1626,12 @@
16271627 mw.log( 'Error no apiTitleKey');
16281628 return false;
16291629 }
1630 -
 1630+
16311631 // Set local apiProvider via config if not defined
16321632 if( !_this.apiProvider ) {
16331633 _this.apiProvider = mw.getConfig( 'EmbedPlayer.ApiProvider' );
16341634 }
1635 -
 1635+
16361636 // Setup the request
16371637 var request = {
16381638 'prop': 'imageinfo',
@@ -1662,38 +1662,38 @@
16631663 return ;
16641664 }
16651665 var imageinfo = page.imageinfo[0];
1666 -
 1666+
16671667 // Set the poster
16681668 _this.poster = imageinfo.thumburl;
1669 -
 1669+
16701670 // Add the media src
16711671 _this.mediaElement.tryAddSource(
16721672 $j('<source />')
16731673 .attr( 'src', imageinfo.url )
16741674 .get( 0 )
16751675 );
1676 -
 1676+
16771677 // Set the duration
16781678 if( imageinfo.metadata[2]['name'] == 'length' ) {
16791679 _this.duration = imageinfo.metadata[2]['value'];
16801680 }
1681 -
 1681+
16821682 // Set the width height
16831683 // Make sure we have an accurate aspect ratio
16841684 if( imageinfo.height != 0 && imageinfo.width != 0 ) {
16851685 _this.height = parseInt( _this.width * ( imageinfo.height / imageinfo.width ) );
16861686 }
1687 -
 1687+
16881688 // Update the css for the player interface
16891689 $j( _this ).css( 'height', _this.height);
1690 -
 1690+
16911691 callback();
16921692 });
16931693 },
1694 -
 1694+
16951695 /**
16961696 * Check if we should load the timedText interface or not.
1697 - *
 1697+ *
16981698 * Note we check for text sources outside of
16991699 */
17001700 isTimedTextSupported: function() {
@@ -1705,7 +1705,7 @@
17061706 return false;
17071707 }
17081708 },
1709 -
 1709+
17101710 /**
17111711 * Check for timed Text support and load necessary libraries
17121712 */
@@ -1722,19 +1722,19 @@
17231723 }
17241724 _this.setupSourcePlayer();
17251725 },
1726 -
 1726+
17271727 /**
17281728 * Set up the select source player
1729 - *
 1729+ *
17301730 * issues autoSelectSource call
1731 - *
 1731+ *
17321732 * Sets load error if no source is playable
17331733 */
17341734 setupSourcePlayer: function() {
17351735 mw.log("EmbedPlayer::setupSourcePlayer: " + this.id + ' sources: ' + this.mediaElement.sources.length );
17361736 // Autoseletct the media source
17371737 this.mediaElement.autoSelectSource();
1738 -
 1738+
17391739 // Auto select player based on default order
17401740 if ( !this.mediaElement.selectedSource ) {
17411741 // check for parent clip:
@@ -1749,7 +1749,7 @@
17501750 } else {
17511751 this.selectedPlayer = mw.EmbedTypes.players.defaultPlayer( this.mediaElement.selectedSource.mimeType );
17521752 }
1753 -
 1753+
17541754 if ( this.selectedPlayer ) {
17551755 // Inherit the playback system of the selected player:
17561756 this.inheritEmbedPlayer();
@@ -1757,17 +1757,17 @@
17581758 this.showPluginMissingHTML();
17591759 }
17601760 },
1761 -
 1761+
17621762 /**
17631763 * Load and inherit methods from the selected player interface
1764 - *
 1764+ *
17651765 * @param {Function}
17661766 * callback Function to be called once playback-system has been
17671767 * inherited
17681768 */
17691769 inheritEmbedPlayer: function( callback ) {
17701770 mw.log( "EmbedPlayer::inheritEmbedPlayer:duration is: " + this.getDuration() + ' p: ' + this.id );
1771 -
 1771+
17721772 // Clear out any non-base embedObj methods:
17731773 if ( this.instanceOf ) {
17741774 eval( 'var tmpObj = mw.EmbedPlayer' + this.instanceOf );
@@ -1779,46 +1779,46 @@
17801780 }
17811781 }
17821782 }
1783 -
 1783+
17841784 // Set up the new embedObj
17851785 mw.log( 'EmbedPlayer::inheritEmbedPlayer: embedding with ' + this.selectedPlayer.library );
17861786 var _this = this;
1787 -
 1787+
17881788 // Load the selected player
17891789 this.selectedPlayer.load( function() {
17901790 mw.log( 'EmbedPlayer::inheritEmbedPlayer ' + _this.selectedPlayer.library + " player loaded for " + _this.id );
1791 -
 1791+
17921792 // Get embed library player Interface
17931793 var playerInterface = mw[ 'EmbedPlayer' + _this.selectedPlayer.library ];
1794 -
1795 - for ( var method in playerInterface ) {
 1794+
 1795+ for ( var method in playerInterface ) {
17961796 if ( _this[method] && !_this['parent_' + method] ) {
17971797 _this['parent_' + method] = _this[method];
17981798 }
17991799 _this[ method ] = playerInterface[method];
18001800 }
1801 -
 1801+
18021802 // Update feature support
18031803 _this.updateFeatureSupport();
1804 -
 1804+
18051805 _this.getDuration();
1806 -
 1806+
18071807 _this.showPlayer();
1808 -
 1808+
18091809 // Call the global player manager to inform this video interface is
18101810 // ready:
18111811 mw.playerManager.playerReady( _this );
1812 -
 1812+
18131813 // Run the callback if provided
18141814 if ( typeof callback == 'function' ){
18151815 callback();
18161816 }
18171817 } );
18181818 },
1819 -
 1819+
18201820 /**
18211821 * Select a player playback system
1822 - *
 1822+ *
18231823 * @param {Object}
18241824 * player Player playback system to be selected player playback
18251825 * system include vlc, native, java etc.
@@ -1829,7 +1829,7 @@
18301830 this.selectedPlayer = player;
18311831 this.inheritEmbedPlayer( function(){
18321832 // Hide / remove track container
1833 - _this.$interface.find( '.track' ).remove();
 1833+ _this.$interface.find( '.track' ).remove();
18341834 // We have to re-bind hoverIntent ( has to happen in this scope
18351835 // )
18361836 if( _this.controls && _this.controlBuilder.checkOverlayControls() ){
@@ -1848,10 +1848,10 @@
18491849 });
18501850 }
18511851 },
1852 -
 1852+
18531853 /**
18541854 * Get a time range from the media start and end time
1855 - *
 1855+ *
18561856 * @return start_npt and end_npt time if present
18571857 */
18581858 getTimeRange: function() {
@@ -1865,35 +1865,35 @@
18661866 return default_time_range;
18671867 return this.mediaElement.selectedSource.start_npt + this.mediaElement.selectedSource.end_npt;
18681868 },
1869 -
 1869+
18701870 /**
18711871 * Get the duration of the embed player
18721872 */
18731873 getDuration: function() {
18741874 return this.duration;
18751875 },
1876 -
 1876+
18771877 /**
18781878 * Get the player height
18791879 */
18801880 getHeight: function() {
18811881 return this.height;
18821882 },
1883 -
 1883+
18841884 /**
18851885 * Get the player width
18861886 */
18871887 getWidth: function(){
18881888 return this.width;
18891889 },
1890 -
 1890+
18911891 /**
18921892 * Check if the selected source is an audio element:
18931893 */
18941894 isAudio: function(){
18951895 return ( this.mediaElement.selectedSource.mimeType.indexOf('audio/') !== -1 );
18961896 },
1897 -
 1897+
18981898 /**
18991899 * Get the plugin embed html ( should be implemented by embed player
19001900 * interface )
@@ -1901,19 +1901,19 @@
19021902 doEmbedHTML: function() {
19031903 return 'Error: function doEmbedHTML should be implemented by embed player interface ';
19041904 },
1905 -
 1905+
19061906 /**
19071907 * Seek function ( should be implemented by embedPlayer interface
19081908 * playerNative, playerKplayer etc. ) embedPlayer doSeek only handles URL
19091909 * time seeks
1910 - */
 1910+ */
19111911 doSeek: function( percent ) {
19121912 var _this = this;
1913 -
 1913+
19141914 this.seeking = true;
19151915 // Run the seeking hook
19161916 $j( this.embedPlayer ).trigger( 'onSeek' );
1917 -
 1917+
19181918 // See if we should do a server side seek ( player independent )
19191919 if ( this.supportsURLTimeEncoding() ) {
19201920 mw.log( 'EmbedPlayer::doSeek:: updated serverSeekTime: ' + mw.seconds2npt ( this.serverSeekTime ) );
@@ -1924,7 +1924,7 @@
19251925 // Update the slider
19261926 this.updatePlayHead( percent );
19271927 }
1928 -
 1928+
19291929 // Do play request in 100ms ( give the dom time to swap out the embed
19301930 // player )
19311931 setTimeout( function() {
@@ -1932,13 +1932,13 @@
19331933 _this.play()
19341934 _this.monitor();
19351935 }, 100 );
1936 -
 1936+
19371937 // Run the onSeeking interface update
19381938 // NOTE controlBuilder should really bind to html5 events rather
19391939 // than explicitly calling it or inheriting stuff.
1940 - this.controlBuilder.onSeek();
 1940+ this.controlBuilder.onSeek();
19411941 },
1942 -
 1942+
19431943 /**
19441944 * Seeks to the requested time and issues a callback when ready (should be
19451945 * overwritten by client that supports frame serving)
@@ -1946,81 +1946,81 @@
19471947 setCurrentTime: function( time, callback ) {
19481948 mw.log( 'Error: base embed setCurrentTime can not frame serve (override via plugin)' );
19491949 },
1950 -
 1950+
19511951 /**
19521952 * On clip done action. Called once a clip is done playing
19531953 */
19541954 onClipDone: function() {
19551955 mw.log( 'EmbedPlayer::onClipDone:' + this.id + ' doneCount:' + this.donePlayingCount + ' stop state:' +this.isStopped() );
19561956 var _this = this;
1957 -
 1957+
19581958 // Only run stopped once:
19591959 if( !this.isStopped() ){
19601960 // Stop the monitor:
19611961 this.stopMonitor();
1962 -
 1962+
19631963 // Show the control bar:
19641964 this.controlBuilder.showControlBar();
1965 -
 1965+
19661966 // Update the clip done playing count:
19671967 this.donePlayingCount ++;
1968 -
 1968+
19691969 // Fire the html5 ended binding
19701970 var onDoneActionObject = {
19711971 'runBaseControlDone' : true
19721972 }
1973 -
 1973+
19741974 // Run the ended trigger ( allow the ended object to prevent default
19751975 // actions )
19761976 mw.log("EmbedPlayer::onClipDone:Trigger ended");
19771977 $j( this ).trigger( 'ended', onDoneActionObject );
1978 -
 1978+
19791979 if( onDoneActionObject.runBaseControlDone ){
1980 -
 1980+
19811981 // Check if we have the "loop" property set
19821982 if( this.loop ) {
19831983 this.stop();
19841984 this.play();
1985 - return;
 1985+ return;
19861986 }
1987 -
 1987+
19881988 // Stop the clip (load the thumbnail etc)
19891989 this.stop();
19901990 this.serverSeekTime = 0;
19911991 this.updatePlayHead( 0 );
1992 -
 1992+
19931993 // Make sure we are not in preview mode( no end clip actions in
19941994 // preview mode)
19951995 if ( this.preview_mode ) {
19961996 return ;
19971997 }
1998 -
 1998+
19991999 // Do the controlBuilder onClip done interface
20002000 this.controlBuilder.onClipDone();
20012001 }
20022002 }
2003 -
 2003+
20042004 },
2005 -
2006 -
 2005+
 2006+
20072007 /**
20082008 * Shows the video Thumbnail, updates pause state
20092009 */
20102010 showThumbnail: function() {
20112011 var _this = this;
20122012 mw.log( 'EmbedPlayer::showThumbnail' + this.thumbnail_disp );
2013 -
 2013+
20142014 // Close Menu Overlay:
20152015 this.controlBuilder.closeMenuOverlay();
2016 -
 2016+
20172017 // update the thumbnail html:
20182018 this.updatePosterHTML();
2019 -
 2019+
20202020 this.paused = true;
20212021 this.thumbnail_disp = true;
20222022 // Make sure the controlBuilder bindings are up-to-date
20232023 this.controlBuilder.addControlBindings();
2024 -
 2024+
20252025 // Once the thumbnail is shown run the mediaReady trigger (if not using
20262026 // native controls)
20272027 if( !this.useNativePlayerControls() ){
@@ -2028,7 +2028,7 @@
20292029 $j( this ).trigger( 'mediaLoaded' );
20302030 }
20312031 },
2032 -
 2032+
20332033 /**
20342034 * Show the player
20352035 */
@@ -2038,11 +2038,11 @@
20392039 // Set-up the local controlBuilder instance:
20402040 this.controlBuilder = new mw.PlayerControlBuilder( this );
20412041 var _this = this;
2042 -
 2042+
20432043 // Make sure we have mwplayer_interface
20442044 if( $j( this ).parent( '.mwplayer_interface' ).length == 0 ) {
20452045 // Select "player"
2046 - $j( this ).wrap(
 2046+ $j( this ).wrap(
20472047 $j('<div>')
20482048 .addClass( 'mwplayer_interface ' + this.controlBuilder.playerClass )
20492049 .css({
@@ -2055,14 +2055,14 @@
20562056 // position the "player" absolute inside the relative interface
20572057 // parent:
20582058 .css('position', 'absolute');
2059 - }
2060 -
 2059+ }
 2060+
20612061 // Set up local jQuery object reference to "mwplayer_interface"
20622062 this.$interface = $j( this ).parent( '.mwplayer_interface' );
2063 -
 2063+
20642064 // Update Thumbnail for the "player"
20652065 this.updatePosterHTML();
2066 -
 2066+
20672067 // Add controls if enabled:
20682068 if ( this.controls ) {
20692069 this.controlBuilder.addControls();
@@ -2071,7 +2071,7 @@
20722072 // Interface is hidden if controls are "off"
20732073 this.$interface.hide();
20742074 }
2075 -
 2075+
20762076 if ( this.autoplay ) {
20772077 mw.log( 'EmbedPlayer::showPlayer::activating autoplay' );
20782078 // Issue a non-blocking play request
@@ -2079,12 +2079,12 @@
20802080 _this.play();
20812081 },0)
20822082 }
2083 -
 2083+
20842084 },
2085 -
 2085+
20862086 /**
20872087 * Get missing plugin html (check for user included code)
2088 - *
 2088+ *
20892089 * @param {String}
20902090 * [misssingType] missing type mime
20912091 */
@@ -2098,7 +2098,7 @@
20992099 }
21002100 // Remove the loading spinner if present:
21012101 $j('.playerLoadingSpinner').remove();
2102 -
 2102+
21032103 // If the native video is already displayed hide it:
21042104 if( $j( '#' + this.pid ).length != 0 ){
21052105 $j('#loadingSpinner_' + this.id ).remove();
@@ -2108,7 +2108,7 @@
21092109 // hide the pid if present:
21102110 $j( '#pid_' + this.id ).hide();
21112111 $j( this ).show().html(
2112 - $j('<span />').text(
 2112+ $j('<span />').text(
21132113 gM('mwe-embedplayer-missing-source')
21142114 )
21152115 );
@@ -2118,7 +2118,7 @@
21192119 // Check if we have user defined missing html msg:
21202120 if ( this.user_missing_plugin_html ) {
21212121 $j( this ).html( this.user_missing_plugin_html );
2122 - } else {
 2122+ } else {
21232123 $j( this ).html(
21242124 $j('<div />').append(
21252125 gM( 'mwe-embedplayer-generic_missing_plugin', missingType ),
@@ -2134,10 +2134,10 @@
21352135 }
21362136 // hide
21372137 },
2138 -
 2138+
21392139 /**
21402140 * Update the video time request via a time request string
2141 - *
 2141+ *
21422142 * @param {String}
21432143 * time_req
21442144 */
@@ -2146,10 +2146,10 @@
21472147 var time_parts = time_req.split( '/' );
21482148 this.updateVideoTime( time_parts[0], time_parts[1] );
21492149 },
2150 -
 2150+
21512151 /**
21522152 * Update Video time from provided start_npt and end_npt values
2153 - *
 2153+ *
21542154 * @param {String}
21552155 * start_npt the new start time in npt format
21562156 * @pamra {String} end_npt the new end time in npt format
@@ -2157,13 +2157,13 @@
21582158 updateVideoTime: function( start_npt, end_npt ) {
21592159 // update media
21602160 this.mediaElement.updateSourceTimes( start_npt, end_npt );
2161 -
 2161+
21622162 // update mv_time
21632163 this.controlBuilder.setStatus( start_npt + '/' + end_npt );
2164 -
 2164+
21652165 // reset slider
21662166 this.updatePlayHead( 0 );
2167 -
 2167+
21682168 // reset seek_offset:
21692169 if ( this.mediaElement.selectedSource.URLTimeEncoding ) {
21702170 this.serverSeekTime = 0;
@@ -2172,20 +2172,20 @@
21732173 }
21742174 },
21752175
2176 -
 2176+
21772177 /**
21782178 * Update Thumb time with npt formated time
2179 - *
 2179+ *
21802180 * @param {String}
21812181 * time NPT formated time to update thumbnail
21822182 */
21832183 updateThumbTimeNPT: function( time ) {
21842184 this.updateThumbTime( mw.npt2seconds( time ) - parseInt( this.startOffset ) );
21852185 },
2186 -
 2186+
21872187 /**
21882188 * Update the thumb with a new time
2189 - *
 2189+ *
21902190 * @param {Float}
21912191 * floatSeconds Time to update the thumb to
21922192 */
@@ -2197,8 +2197,8 @@
21982198 }
21992199 if ( this.org_thum_src.indexOf( 't=' ) !== -1 ) {
22002200 this.last_thumb_url = mw.replaceUrlParams( this.org_thum_src,
2201 - {
2202 - 't' : mw.seconds2npt( floatSeconds + parseInt( this.startOffset ) )
 2201+ {
 2202+ 't' : mw.seconds2npt( floatSeconds + parseInt( this.startOffset ) )
22032203 }
22042204 );
22052205 if ( !this.thumbnail_updating ) {
@@ -2207,20 +2207,20 @@
22082208 }
22092209 }
22102210 },
2211 -
 2211+
22122212 /**
22132213 * Updates the displayed thumbnail via percent of the stream
2214 - *
 2214+ *
22152215 * @param {Float}
22162216 * percent Percent of duration to update thumb
22172217 */
22182218 updateThumbPerc:function( percent ) {
22192219 return this.updateThumbTime( ( this.getDuration() * percent ) );
22202220 },
2221 -
 2221+
22222222 /**
22232223 * Updates the thumbnail if the thumbnail is being displayed
2224 - *
 2224+ *
22252225 * @param {String}
22262226 * src New src of thumbnail
22272227 * @param {Boolean}
@@ -2234,9 +2234,9 @@
22352235 // if we are already updating don't issue a new update:
22362236 if ( this.thumbnail_updating && $j( '#new_img_thumb_' + this.id ).attr( 'src' ) == src )
22372237 return false;
2238 -
 2238+
22392239 mw.log( 'update thumb: ' + src );
2240 -
 2240+
22412241 if ( quick_switch ) {
22422242 $j( '#img_thumb_' + this.id ).attr( 'src', src );
22432243 } else {
@@ -2244,11 +2244,11 @@
22452245 // if still animating remove new_img_thumb_
22462246 if ( this.thumbnail_updating == true )
22472247 $j( '#new_img_thumb_' + this.id ).stop().remove();
2248 -
 2248+
22492249 if ( this.thumbnail_disp ) {
22502250 mw.log( 'set to thumb:' + src );
22512251 this.thumbnail_updating = true;
2252 - $j( this ).append(
 2252+ $j( this ).append(
22532253 $j('<img />')
22542254 .attr({
22552255 'src' : src,
@@ -2284,7 +2284,7 @@
22852285 }
22862286 }
22872287 },
2288 -
 2288+
22892289 /**
22902290 * Returns the HTML code for the video when it is in thumbnail mode.
22912291 * playing, configuring the player, inline cmml display, HTML linkback,
@@ -2295,17 +2295,17 @@
22962296 var thumb_html = '';
22972297 var class_atr = '';
22982298 var style_atr = '';
2299 -
2300 -
 2299+
 2300+
23012301 if( this.useNativePlayerControls() ){
23022302 this.showNativePlayer();
23032303 return ;
23042304 }
2305 -
 2305+
23062306 // Set by default thumb value if not found
2307 - var posterSrc = ( this.poster ) ? this.poster :
 2307+ var posterSrc = ( this.poster ) ? this.poster :
23082308 mw.getConfig( 'imagesPath' ) + 'vid_default_thumb.jpg';
2309 -
 2309+
23102310 // Poster support is not very consistent in browsers
23112311 // use a jpg poster image:
23122312 $j( this ).html(
@@ -2321,19 +2321,19 @@
23222322 })
23232323 .addClass( 'playerPoster' )
23242324 );
2325 -
2326 - if ( this.controls
2327 - && this.height > this.controlBuilder.getComponentHeight( 'playButtonLarge' )
 2325+
 2326+ if ( this.controls
 2327+ && this.height > this.controlBuilder.getComponentHeight( 'playButtonLarge' )
23282328 ) {
23292329 $j( this ).append(
23302330 this.controlBuilder.getComponent( 'playButtonLarge' )
23312331 );
23322332 }
23332333 },
2334 -
 2334+
23352335 /**
23362336 * Checks if native controls should be used
2337 - *
 2337+ *
23382338 * @param [player]
23392339 * Object Optional player object to check controls attribute
23402340 * @returns boolean true if the mwEmbed player interface should be used
@@ -2343,7 +2343,7 @@
23442344 if( this.usenativecontrols === true ){
23452345 return true;
23462346 }
2347 -
 2347+
23482348 if( mw.getConfig('EmbedPlayer.NativeControls') === true ) {
23492349 return true;
23502350 }
@@ -2351,14 +2351,14 @@
23522352 mw.isHTML5FallForwardNative()
23532353 ){
23542354 return true;
2355 - }
 2355+ }
23562356 return false;
23572357 },
2358 -
2359 -
 2358+
 2359+
23602360 /**
23612361 * Show the native player embed code
2362 - *
 2362+ *
23632363 * This is for cases where the main library needs to "get out of the way"
23642364 * since the device only supports a limited subset of the html5 and won't
23652365 * work with an html javascirpt interface
@@ -2367,14 +2367,14 @@
23682368 var _this = this;
23692369 // Empty the player
23702370 $j(this).empty();
2371 -
 2371+
23722372 // Remove the player loader spinner if it exists
23732373 $j('#loadingSpinner_' + this.id ).remove();
2374 -
2375 -
 2374+
 2375+
23762376 // Check if we need to refresh mobile safari
23772377 var mobileSafariNeedsRefresh = false;
2378 -
 2378+
23792379 // Unhide the original video element if not part of a playerThemer embed
23802380 if( !$j( '#' + this.pid ).hasClass('PlayerThemer') ){
23812381 $j( '#' + this.pid )
@@ -2383,10 +2383,10 @@
23842384 } )
23852385 .show()
23862386 .attr('controls', 'true');
2387 -
 2387+
23882388 mobileSafariNeedsRefresh = true;
23892389 }
2390 -
 2390+
23912391 // iPad does not handle video tag update for attributes like "controls"
23922392 // so we have to do a full replace ( if controls are not included
23932393 // initially )
@@ -2397,14 +2397,14 @@
23982398 mw.log( 'Warning: Your probably fakeing the iPhone userAgent ( no h.264 source )' );
23992399 source = this.mediaElement.getSources( 'video/ogg' )[0];
24002400 }
2401 -
 2401+
24022402 var videoAttribues = {
24032403 'id' : _this.pid,
24042404 'poster': _this.poster,
24052405 'src' : source.src,
24062406 'controls' : 'true'
24072407 }
2408 -
 2408+
24092409 if( this.loop ){
24102410 videoAttribues[ 'loop' ] = 'true';
24112411 }
@@ -2412,7 +2412,7 @@
24132413 'width' : _this.width,
24142414 'height' : _this.height
24152415 };
2416 - $j( '#' + this.pid ).replaceWith(
 2416+ $j( '#' + this.pid ).replaceWith(
24172417 _this.getNativePlayerHtml( videoAttribues, cssStyle )
24182418 )
24192419 // Bind native events:
@@ -2423,7 +2423,7 @@
24242424 // and only with 'native display'
24252425 if( mw.isAndroid2() ){
24262426 $j( '#' + _this.pid ).siblings('.play-btn-large').remove();
2427 - $j( '#' + _this.pid ).after(
 2427+ $j( '#' + _this.pid ).after(
24282428 $j('<div />')
24292429 .css({
24302430 'position' : 'relative',
@@ -2457,7 +2457,7 @@
24582458 applyMediaElementBindings: function(){
24592459 return ;
24602460 },
2461 -
 2461+
24622462 /**
24632463 * Gets code to embed the player remotely for "share" this player links
24642464 */
@@ -2471,25 +2471,25 @@
24722472 break;
24732473 }
24742474 },
2475 -
 2475+
24762476 /**
24772477 * Get the share embed object code
24782478 *
24792479 * NOTE this could probably share a bit more code with getShareEmbedVideoJs
24802480 */
24812481 getShareIframeObject: function(){
2482 -
2483 - // If using a gadget do the new embed format:
 2482+
 2483+ // If using a gadget do the new embed format:
24842484 // @@NOTE this should be factored out into mediaWiki gadget helper
24852485 if( typeof wgServer != 'undefined' && typeof mwCheckForGadget != 'undefined' ){
2486 - var iframeUrl = wgServer + wgArticlePath.replace( /\$1/, wgPageName ) +
 2486+ var iframeUrl = wgServer + wgArticlePath.replace( /\$1/, wgPageName ) +
24872487 '?' + mw.getConfig( 'Mw.AppendWithJS' ) +
24882488 '&embedplayer=yes';
24892489 } else {
24902490 // old style embed:
24912491 var iframeUrl = mw.getMwEmbedPath() + 'mwEmbedFrame.php?';
24922492 var params = {};
2493 -
 2493+
24942494 if ( this.roe ) {
24952495 params.roe = this.roe;
24962496 } else if( this.apiTitleKey ) {
@@ -2514,12 +2514,12 @@
25152515 params.poster = this.poster;
25162516 }
25172517 }
2518 -
 2518+
25192519 // Set the skin if set to something other than default
25202520 if( this.skinName ){
25212521 params.skin = this.skinName;
25222522 }
2523 -
 2523+
25242524 if( this.duration ) {
25252525 params.durationHint = parseFloat( this.duration );
25262526 }
@@ -2540,50 +2540,50 @@
25412541 // Return the embed code
25422542 return embedCode;
25432543 },
2544 -
 2544+
25452545 /**
25462546 * Get the share embed Video tag code
2547 - */
 2547+ */
25482548 getShareEmbedVideoJs: function(){
2549 -
 2549+
25502550 // Set the embed tag type:
25512551 var embedtag = ( this.isAudio() )? 'audio': 'video';
2552 -
 2552+
25532553 // Set up the mwEmbed js include:
25542554 var embedCode = '&lt;script type=&quot;text/javascript&quot; ' +
2555 - 'src=&quot;' +
2556 - mw.escapeQuotesHTML(
2557 - mw.absoluteUrl(
2558 - mw.getMwEmbedSrc()
 2555+ 'src=&quot;' +
 2556+ mw.escapeQuotesHTML(
 2557+ mw.absoluteUrl(
 2558+ mw.getMwEmbedSrc()
25592559 )
25602560 ) + '&quot;&gt;&lt;/script&gt' +
25612561 '&lt;' + embedtag + ' ';
25622562
25632563 if( this.poster ) {
25642564 embedCode += 'poster=&quot;' +
2565 - mw.escapeQuotesHTML( mw.absoluteUrl( this.poster ) ) +
 2565+ mw.escapeQuotesHTML( mw.absoluteUrl( this.poster ) ) +
25662566 '&quot; ';
25672567 }
2568 -
 2568+
25692569 // Set the skin if set to something other than default
25702570 if( this.skinName ){
25712571 embedCode += 'class=&quot;' +
2572 - mw.escapeQuotesHTML( this.skinName ) +
 2572+ mw.escapeQuotesHTML( this.skinName ) +
25732573 '&quot; ';
25742574 }
2575 -
 2575+
25762576 if( this.duration ) {
25772577 embedCode +='durationHint=&quot;' + parseFloat( this.duration ) + '&quot; ';
25782578 }
2579 -
 2579+
25802580 if( this.width || this.height ){
25812581 embedCode +='style=&quot;';
25822582 embedCode += ( this.width )? 'width:' + this.width +'px;': '';
25832583 embedCode += ( this.height )? 'height:' + this.height +'px;': '';
25842584 embedCode += '&quot; ';
25852585 }
2586 -
2587 -
 2586+
 2587+
25882588 if ( this.roe ) {
25892589 embedCode += 'roe=&quot;' + mw.escapeQuotesHTML( this.roe ) + '&quot; ';
25902590 } else if( this.apiTitleKey ) {
@@ -2593,27 +2593,27 @@
25942594 }
25952595 // close the video tag
25962596 embedCode += '&gt;&lt;/video&gt;';
2597 -
 2597+
25982598 } else {
25992599 // Close the video attr
26002600 embedCode += '&gt;';
2601 -
 2601+
26022602 // Output all the video sources:
26032603 for( var i=0; i < this.mediaElement.sources.length; i++ ){
26042604 var source = this.mediaElement.sources[i];
26052605 if( source.src ) {
2606 - embedCode +='&lt;source src=&quot;' +
2607 - mw.absoluteUrl( source.src ) +
 2606+ embedCode +='&lt;source src=&quot;' +
 2607+ mw.absoluteUrl( source.src ) +
26082608 '&quot; &gt;&lt;/source&gt;';
26092609 }
26102610 }
26112611 // Close the video tag
26122612 embedCode += '&lt;/video&gt;';
26132613 }
2614 -
 2614+
26152615 return embedCode;
26162616 },
2617 -
 2617+
26182618 /**
26192619 * Follows a linkback. Loads the ROE xml if no linkback is found
26202620 */
@@ -2635,36 +2635,36 @@
26362636 }
26372637 }
26382638 },
2639 -
 2639+
26402640 /**
26412641 * Base Embed Controls
26422642 */
2643 -
 2643+
26442644 /**
26452645 * The Play Action
2646 - *
 2646+ *
26472647 * Handles play requests, updates relevant states: seeking =false paused =
26482648 * false Updates pause button Starts the "monitor"
26492649 */
26502650 play: function() {
26512651 var _this = this;
2652 -
 2652+
26532653 if( this.paused && this.bubbleEventCheck() ){
26542654 this.paused = false;
2655 - mw.log("trigger play event::" + !this.paused);
2656 - $j( this ).trigger( 'play' );
 2655+ mw.log("trigger play event::" + !this.paused);
 2656+ $j( this ).trigger( 'play' );
26572657 }
26582658 this.paused = false;
2659 -
2660 - mw.log( "EmbedPlayer:: play" );
 2659+
 2660+ mw.log( "EmbedPlayer:: play" );
26612661 // Hide any overlay:
26622662 this.controlBuilder.closeMenuOverlay();
2663 -
 2663+
26642664 // Check if thumbnail is being displayed and embed html
26652665 if ( this.thumbnail_disp ) {
26662666 if ( !this.selectedPlayer ) {
26672667 this.showPluginMissingHTML();
2668 - return;
 2668+ return;
26692669 } else {
26702670 this.thumbnail_disp = false;
26712671 this.doEmbedHTML();
@@ -2673,32 +2673,32 @@
26742674 // the plugin is already being displayed
26752675 this.seeking = false;
26762676 }
2677 -
2678 -
 2677+
 2678+
26792679 this.$interface.find('.play-btn span')
26802680 .removeClass( 'ui-icon-play' )
26812681 .addClass( 'ui-icon-pause' );
2682 -
 2682+
26832683 this.$interface.find( '.play-btn' )
26842684 .unbind()
26852685 .buttonHover()
26862686 .click( function( ) {
26872687 _this.pause();
2688 - } )
2689 - .attr( 'title', gM( 'mwe-embedplayer-pause_clip' ) );
 2688+ } )
 2689+ .attr( 'title', gM( 'mwe-embedplayer-pause_clip' ) );
26902690
26912691 // Start the monitor if not already started
26922692 this.monitor();
2693 -
2694 - // If we previously finished playing this clip run the "replay hook"
2695 - if( this.donePlayingCount > 0 ) {
2696 - mw.log("replayEvent");
2697 - $j( this ).trigger( 'replayEvent' );
2698 - }
 2693+
 2694+ // If we previously finished playing this clip run the "replay hook"
 2695+ if( this.donePlayingCount > 0 ) {
 2696+ mw.log("replayEvent");
 2697+ $j( this ).trigger( 'replayEvent' );
 2698+ }
26992699 },
27002700 /**
27012701 * Returns true if the event should be triggered or false if not
2702 - *
 2702+ *
27032703 * @@FIXME:: firefox nightlies now Do NOT bubble events. Once release tag
27042704 * every version after that
27052705 */
@@ -2708,7 +2708,7 @@
27092709 }
27102710 return false;
27112711 },
2712 -
 2712+
27132713 /**
27142714 * Maps the html5 load request. There is no general way to "load" clips so
27152715 * underling plugin-player libs should override.
@@ -2717,10 +2717,10 @@
27182718 // should be done by child (no base way to pre-buffer video)
27192719 mw.log( 'baseEmbed:load call' );
27202720 },
2721 -
 2721+
27222722 /**
27232723 * Base embed pause Updates the play/pause button state.
2724 - *
 2724+ *
27252725 * There is no general way to pause the video must be overwritten by embed
27262726 * object to support this functionality.
27272727 */
@@ -2734,12 +2734,12 @@
27352735 $j( this ).trigger('pause' );
27362736 }
27372737 this.paused = true;
2738 -
 2738+
27392739 // update the ctrl "paused state"
27402740 this.$interface.find('.play-btn span' )
27412741 .removeClass( 'ui-icon-pause' )
27422742 .addClass( 'ui-icon-play' );
2743 -
 2743+
27442744 this.$interface.find('.play-btn' )
27452745 .unbind()
27462746 .buttonHover()
@@ -2748,23 +2748,23 @@
27492749 } )
27502750 .attr( 'title', gM( 'mwe-embedplayer-play_clip' ) );
27512751 },
2752 -
 2752+
27532753 /**
27542754 * Base embed stop
2755 - *
 2755+ *
27562756 * Updates the player to the stop state shows Thumbnail resets Buffer resets
27572757 * Playhead slider resets Status
27582758 */
27592759 stop: function() {
27602760 var _this = this;
27612761 mw.log( 'EmbedPlayer::stop:' + this.id );
2762 -
 2762+
27632763 // no longer seeking:
27642764 this.didSeekJump = false;
2765 -
 2765+
27662766 // Reset current time and prev time and seek offset
2767 - this.currentTime = this.previousTime = this.serverSeekTime = 0;
2768 -
 2767+ this.currentTime = this.previousTime = this.serverSeekTime = 0;
 2768+
27692769 // Issue pause to update interface (only call this parent)
27702770 if( !this.paused ){
27712771 this.paused = true;
@@ -2775,16 +2775,16 @@
27762776 this.pause();
27772777 }
27782778 }
2779 -
 2779+
27802780 // Rewrite the html to thumbnail disp
27812781 this.showThumbnail();
27822782 this.bufferedPercent = 0; // reset buffer state
27832783 this.controlBuilder.setStatus( this.getTimeRange() );
2784 -
 2784+
27852785 // Reset the playhead
27862786 mw.log("EmbedPlayer::Stop:: Reset play head")
27872787 this.updatePlayHead( 0 );
2788 -
 2788+
27892789 // Bind play-btn-large play
27902790 this.$interface.find( '.play-btn-large' )
27912791 .unbind( 'click' )
@@ -2792,10 +2792,10 @@
27932793 _this.play();
27942794 } );
27952795 },
2796 -
 2796+
27972797 /**
27982798 * Base Embed mute
2799 - *
 2799+ *
28002800 * Handles interface updates for toggling mute. Plug-in / player interface
28012801 * must handle the actual media player update
28022802 */
@@ -2813,10 +2813,10 @@
28142814 // Update the interface
28152815 this.setInterfaceVolume( percent );
28162816 },
2817 -
 2817+
28182818 /**
28192819 * Update volume function ( called from interface updates )
2820 - *
 2820+ *
28212821 * @param {float}
28222822 * percent Percent of full volume
28232823 */
@@ -2827,34 +2827,34 @@
28282828 }
28292829 // Set the local volume attribute
28302830 this.previousVolume = this.volume = percent;
2831 -
 2831+
28322832 // Un-mute if setting positive volume
28332833 if( percent != 0 ){
28342834 this.muted = false;
28352835 }
2836 -
 2836+
28372837 // Update the playerElement volume
28382838 this.setPlayerElementVolume( percent );
2839 -
 2839+
28402840 // mw.log(" setVolume:: " + percent + ' this.volume is: ' +
28412841 // this.volume);
28422842 $j( this ).trigger('volumeChanged', percent );
28432843 },
2844 -
 2844+
28452845 /**
28462846 * Updates the interface volume TODO should move to controlBuilder
2847 - *
 2847+ *
28482848 * @param {float}
28492849 * percent Percentage volume to update interface
28502850 */
28512851 setInterfaceVolume: function( percent ) {
2852 - if( this.supports[ 'volumeControl' ] &&
2853 - this.$interface.find( '.volume-slider' ).length
 2852+ if( this.supports[ 'volumeControl' ] &&
 2853+ this.$interface.find( '.volume-slider' ).length
28542854 ) {
28552855 this.$interface.find( '.volume-slider' ).slider( 'value', percent * 100 );
28562856 }
28572857 },
2858 -
 2858+
28592859 /**
28602860 * Abstract Update volume Method must be override by plug-in / player
28612861 * interface
@@ -2862,7 +2862,7 @@
28632863 setPlayerElementVolume: function( percent ) {
28642864 mw.log('Error player does not support volume adjustment' );
28652865 },
2866 -
 2866+
28672867 /**
28682868 * Abstract get volume Method must be override by plug-in / player interface
28692869 * (if player does not override we return the abstract player value )
@@ -2871,7 +2871,7 @@
28722872 // mw.log(' error player does not support getting volume property' );
28732873 return this.volume;
28742874 },
2875 -
 2875+
28762876 /**
28772877 * Abstract get volume muted property must be overwritten by plug-in /
28782878 * player interface (if player does not override we return the abstract
@@ -2881,14 +2881,14 @@
28822882 // mw.log(' error player does not support getting mute property' );
28832883 return this.muted;
28842884 },
2885 -
 2885+
28862886 /**
28872887 * Passes a fullscreen request to the controlBuilder interface
28882888 */
28892889 fullscreen: function() {
28902890 this.controlBuilder.toggleFullscreen();
28912891 },
2892 -
 2892+
28932893 /**
28942894 * Abstract method to be run post embedding the player Generally should be
28952895 * overwritten by the plug-in / player
@@ -2896,10 +2896,10 @@
28972897 postEmbedJS:function() {
28982898 return ;
28992899 },
2900 -
 2900+
29012901 /**
29022902 * Checks the player state based on thumbnail display & paused state
2903 - *
 2903+ *
29042904 * @return {Boolean} true if playing false if not playing
29052905 */
29062906 isPlaying : function() {
@@ -2913,30 +2913,30 @@
29142914 return true;
29152915 }
29162916 },
2917 -
 2917+
29182918 /**
29192919 * Get paused state
2920 - *
 2920+ *
29212921 * @return {Boolean} true if playing false if not playing
29222922 */
29232923 isPaused: function() {
29242924 return this.paused;
29252925 },
2926 -
 2926+
29272927 /**
29282928 * Get Stopped state
2929 - *
 2929+ *
29302930 * @return {Boolean} true if stopped false if playing
29312931 */
29322932 isStopped: function() {
29332933 return this.thumbnail_disp;
29342934 },
2935 -
 2935+
29362936 // xxx temporary hack we need a better stop monitor system
29372937 stopMonitor: function(){
29382938 this.thumbnail_disp = true;
29392939 },
2940 -
 2940+
29412941 /**
29422942 * Checks if the currentTime was updated outside of the getPlayerElementTime
29432943 * function
@@ -2954,20 +2954,20 @@
29552955 }
29562956 }
29572957 },
2958 -
 2958+
29592959 /**
29602960 * Monitor playback and update interface components. underling plugin
29612961 * objects are responsible for updating currentTime
29622962 */
29632963 monitor: function() {
29642964 var _this = this;
2965 -
 2965+
29662966 // Check for current time update outside of embed player
29672967 this.checkForCurrentTimeSeek();
2968 -
 2968+
29692969 // Update currentTime via embedPlayer
29702970 _this.currentTime = _this.getPlayerElementTime();
2971 -
 2971+
29722972 // Update any offsets from server seek
29732973 if( _this.serverSeekTime && _this.supportsURLTimeEncoding ){
29742974 _this.currentTime = _this.serverSeekTime + _this.getPlayerElementTime()
@@ -2976,8 +2976,8 @@
29772977 // Update the previousTime ( so we can know if the user-javascript
29782978 // changed currentTime )
29792979 _this.previousTime = _this.currentTime;
2980 -
2981 -
 2980+
 2981+
29822982 // Check if volume was set outside of embed player function
29832983 // mw.log( ' this.volume: ' + _this.volume + ' prev Volume:: ' +
29842984 // _this.previousVolume );
@@ -2985,21 +2985,21 @@
29862986 _this.setInterfaceVolume( _this.volume );
29872987 $j( this ).trigger('volumeChanged', _this.volume );
29882988 }
2989 -
 2989+
29902990 // Update the previous volume
29912991 _this.previousVolume = _this.volume;
2992 -
 2992+
29932993 // Update the volume from the player element
29942994 _this.volume = this.getPlayerElementVolume();
2995 -
 2995+
29962996 // update the mute state from the player element
29972997 if( _this.muted != _this.getPlayerElementMuted() && ! _this.isStopped() ){
29982998 mw.log( "EmbedPlayer::monitor: muted does not mach embed player" );
29992999 _this.toggleMute();
30003000 // Make sure they match:
3001 - _this.muted = _this.getPlayerElementMuted();
 3001+ _this.muted = _this.getPlayerElementMuted();
30023002 }
3003 -
 3003+
30043004 // mw.log( 'Monitor:: ' + this.currentTime + ' duration: ' + ( parseInt(
30053005 // this.getDuration() ) + 1 ) + ' is seeking: ' + this.seeking );
30063006 if ( this.currentTime >= 0 && this.duration ) {
@@ -3037,16 +3037,16 @@
30383038 this.controlBuilder.setStatus( this.getTimeRange() );
30393039 }
30403040 }
3041 -
 3041+
30423042 // Update buffer information
30433043 this.updateBufferStatus();
3044 -
 3044+
30453045 // run the "native" progress event on the virtual html5 object if set
30463046 if( this.progressEventData ) {
30473047 // mw.log("trigger:progress event on html5 proxy");
30483048 $j( this ).trigger( 'progress', this.progressEventData );
30493049 }
3050 -
 3050+
30513051 // Call monitor at 250ms interval. ( use setInterval to avoid stacking
30523052 // monitor requests )
30533053 if( ! this.isStopped() ) {
@@ -3061,23 +3061,23 @@
30623062 clearInterval( this.monitorInterval );
30633063 this.monitorInterval = 0;
30643064 }
3065 -
 3065+
30663066 // mw.log('trigger:monitor:: ' + this.currentTime );
30673067 $j( this ).trigger( 'monitorEvent' );
30683068 },
3069 -
 3069+
30703070 /**
30713071 * Abstract getPlayerElementTime function
30723072 */
30733073 getPlayerElementTime: function(){
30743074 mw.log("Error: getPlayerElementTime should be implemented by embed library");
30753075 },
3076 -
 3076+
30773077 /**
30783078 * Update the Buffer status based on the local bufferedPercent var
30793079 */
30803080 updateBufferStatus: function() {
3081 -
 3081+
30823082 // Get the buffer target based for playlist vs clip
30833083 $buffer = this.$interface.find( '.mw_buffer' );
30843084 //mw.log(' set bufferd %:' + this.bufferedPercent );
@@ -3087,7 +3087,7 @@
30883088 // '% ' + $buffer.length );
30893089 if ( this.bufferedPercent > 1 ){
30903090 this.bufferedPercent = 1;
3091 - }
 3091+ }
30923092 $buffer.css({
30933093 "width" : ( this.bufferedPercent * 100 ) + '%'
30943094 });
@@ -3095,24 +3095,24 @@
30963096 } else {
30973097 $buffer.css( "width", '0px' );
30983098 }
3099 -
 3099+
31003100 // if we have not already run the buffer start hook
31013101 if( this.bufferedPercent > 0 && !this.bufferStartFlag ) {
31023102 this.bufferStartFlag = true;
31033103 mw.log("bufferStart");
31043104 $j( this ).trigger( 'bufferStartEvent' );
31053105 }
3106 -
 3106+
31073107 // if we have not already run the buffer end hook
31083108 if( this.bufferedPercent == 1 && !this.bufferEndFlag){
31093109 this.bufferEndFlag = true;
31103110 $j( this ).trigger( 'bufferEndEvent' );
31113111 }
31123112 },
3113 -
 3113+
31143114 /**
31153115 * Update the player playhead
3116 - *
 3116+ *
31173117 * @param {Float}
31183118 * perc Value between 0 and 1 for position of playhead
31193119 */
@@ -3125,10 +3125,10 @@
31263126 // @@todo should have 'progress' trigger the same as html5
31273127 $j( this ).trigger('updatePlayHeadPercent', perc);
31283128 },
3129 -
 3129+
31303130 /**
31313131 * Highlight a section of video on the playhead
3132 - *
 3132+ *
31333133 * @param {Object}
31343134 * options Provides "start" time & "end" time to highlight
31353135 */
@@ -3141,7 +3141,7 @@
31423142 // remove the startOffset if relevent:
31433143 if ( this.startOffset )
31443144 rel_start_sec = rel_start_sec - this.startOffset
3145 -
 3145+
31463146 var slider_perc = 0;
31473147 if ( rel_start_sec <= 0 ) {
31483148 left_perc = 0;
@@ -3152,12 +3152,12 @@
31533153 left_perc = parseInt( ( rel_start_sec / dur ) * 100 ) ;
31543154 slider_perc = ( left_perc / 100 );
31553155 }
3156 -
 3156+
31573157 mw.log( "slider perc:" + slider_perc );
31583158 if ( ! this.isPlaying() ) {
31593159 this.updatePlayHead( slider_perc );
31603160 }
3161 -
 3161+
31623162 width_perc = parseInt( ( ( mw.npt2seconds( options['end'] ) - mw.npt2seconds( options['start'] ) ) / dur ) * 100 ) ;
31633163 if ( ( width_perc + left_perc ) > 100 ) {
31643164 width_perc = 100 - left_perc;
@@ -3168,7 +3168,7 @@
31693169 'left' : left_perc + '%',
31703170 'width' : width_perc + '%'
31713171 } ).show();
3172 -
 3172+
31733173 this.jump_time = options['start'];
31743174 this.serverSeekTime = mw.npt2seconds( options['start'] );
31753175 // trim output to
@@ -3176,7 +3176,7 @@
31773177 mw.log( 'DO update: ' + this.jump_time );
31783178 this.updateThumbTime( rel_start_sec );
31793179 },
3180 -
 3180+
31813181 /**
31823182 * Hides the playhead highlight
31833183 */
@@ -3185,15 +3185,15 @@
31863186 $j( '#mv_seeker_' + eid + ' .mv_highlight' ).hide();
31873187 this.controlBuilder.setStatus( this.getTimeRange() );
31883188 },
3189 -
3190 -
 3189+
 3190+
31913191 /**
31923192 * Helper Functions for selected source
31933193 */
3194 -
 3194+
31953195 /**
31963196 * Get the current selected media source
3197 - *
 3197+ *
31983198 * @return src url
31993199 */
32003200 getSrc: function() {
@@ -3202,10 +3202,10 @@
32033203 }
32043204 return false;
32053205 },
3206 -
 3206+
32073207 /**
32083208 * If the selected src supports URL time encoding
3209 - *
 3209+ *
32103210 * @return {Boolean} ture if the src supports url time requests false if the
32113211 * src does not support url time requests
32123212 */
@@ -3219,7 +3219,7 @@
32203220
32213221 /**
32223222 * mediaPlayer represents a media player plugin.
3223 - *
 3223+ *
32243224 * @param {String}
32253225 * id id used for the plugin.
32263226 * @param {Array}
@@ -3240,24 +3240,24 @@
32413241 mediaPlayer.prototype = {
32423242 // Id of the mediaPlayer
32433243 id:null,
3244 -
 3244+
32453245 // Mime types supported by this player
32463246 supported_types:null,
3247 -
 3247+
32483248 // Player library ie: native, vlc, java etc.
32493249 library:null,
3250 -
 3250+
32513251 // Flag stores the mediaPlayer load state
32523252 loaded:false,
3253 -
 3253+
32543254 /**
32553255 * Checks support for a given MIME type
3256 - *
 3256+ *
32573257 * @param {String}
32583258 * type Mime type to check against supported_types
32593259 * @return {Boolean} true if mime type is supported false if mime type is
32603260 * unsupported
3261 - */
 3261+ */
32623262 supportsMIMEType: function( type ) {
32633263 for ( var i = 0; i < this.supported_types.length; i++ ) {
32643264 if ( this.supported_types[i] == type )
@@ -3265,18 +3265,18 @@
32663266 }
32673267 return false;
32683268 },
3269 -
 3269+
32703270 /**
32713271 * Get the "name" of the player from a predictable msg key
32723272 */
32733273 getName: function() {
32743274 return gM( 'mwe-embedplayer-ogg-player-' + this.id );
32753275 },
3276 -
 3276+
32773277 /**
32783278 * Loads the player library & player skin config ( if needed ) and then
32793279 * calls the callback.
3280 - *
 3280+ *
32813281 * @param {Function}
32823282 * callback Function to be called once player library is loaded.
32833283 */
@@ -3293,10 +3293,10 @@
32943294 /**
32953295 * players and supported mime types In an ideal world we would query the plugin
32963296 * to get what mime types it supports in practice not always reliable/available
3297 - *
 3297+ *
32983298 * We can't cleanly store these values per library since player library is
32993299 * loaded post player detection
3300 - *
 3300+ *
33013301 */
33023302
33033303 // Flash based players:
@@ -3324,7 +3324,7 @@
33253325
33263326 /**
33273327 * mediaPlayers is a collection of mediaPlayer objects supported by the client.
3328 - *
 3328+ *
33293329 * @constructor
33303330 */
33313331 function mediaPlayers()
@@ -3336,13 +3336,13 @@
33373337 {
33383338 // The list of players supported
33393339 players : null,
3340 -
 3340+
33413341 // Store per mime-type prefrences for players
33423342 preference : { },
3343 -
 3343+
33443344 // Stores the default set of players for a given mime type
33453345 defaultPlayers : { },
3346 -
 3346+
33473347 /**
33483348 * Initializartion function sets the default order for players for a given
33493349 * mime type
@@ -3350,11 +3350,11 @@
33513351 init: function() {
33523352 this.players = new Array();
33533353 this.loadPreferences();
3354 -
 3354+
33553355 // set up default players order for each library type
33563356 this.defaultPlayers['video/x-flv'] = ['Kplayer', 'Vlc'];
33573357 this.defaultPlayers['video/h264'] = ['Native', 'Kplayer', 'Vlc'];
3358 -
 3358+
33593359 this.defaultPlayers['video/ogg'] = ['Native', 'Vlc', 'Java', 'Generic'];
33603360 this.defaultPlayers['video/webm'] = ['Native', 'Vlc'];
33613361 this.defaultPlayers['application/ogg'] = ['Native', 'Vlc', 'Java', 'Generic'];
@@ -3362,17 +3362,17 @@
33633363 this.defaultPlayers['video/mp4'] = ['Vlc'];
33643364 this.defaultPlayers['video/mpeg'] = ['Vlc'];
33653365 this.defaultPlayers['video/x-msvideo'] = ['Vlc'];
3366 -
 3366+
33673367 this.defaultPlayers['text/html'] = ['Html'];
33683368 this.defaultPlayers['image/jpeg'] = ['Html'];
33693369 this.defaultPlayers['image/png'] = ['Html'];
33703370 this.defaultPlayers['image/svg'] = ['Html'];
3371 -
 3371+
33723372 },
3373 -
 3373+
33743374 /**
33753375 * Adds a Player to the player list
3376 - *
 3376+ *
33773377 * @param {Object}
33783378 * player Player object to be added
33793379 */
@@ -3383,12 +3383,12 @@
33843384 return ;
33853385 }
33863386 }
3387 -
3388 -
 3387+
 3388+
33893389 // Add the player:
33903390 this.players.push( player );
33913391 },
3392 -
 3392+
33933393 /**
33943394 * Checks if a player is supported by id
33953395 */
@@ -3400,10 +3400,10 @@
34013401 }
34023402 return false;
34033403 },
3404 -
 3404+
34053405 /**
34063406 * get players that support a given mimeType
3407 - *
 3407+ *
34083408 * @param {String}
34093409 * mimeType Mime type of player set
34103410 * @return {Array} Array of players that support a the requested mime type
@@ -3423,10 +3423,10 @@
34243424 }
34253425 return mimePlayers;
34263426 },
3427 -
 3427+
34283428 /**
34293429 * Default player for a given mime type
3430 - *
 3430+ *
34313431 * @param {String}
34323432 * mimeType Mime type of the requested player
34333433 * @return Player for mime type null if no player found
@@ -3448,21 +3448,21 @@
34493449 // mw.log( 'No default player found for ' + mimeType );
34503450 return null;
34513451 },
3452 -
 3452+
34533453 /**
34543454 * Sets the format preference.
3455 - *
 3455+ *
34563456 * @param {String}
34573457 * mimeFormat Prefered format
34583458 */
34593459 setFormatPreference : function ( mimeFormat ) {
34603460 this.preference['format_preference'] = mimeFormat;
3461 - mw.setUserConfig( 'playerPref', this.preference);
 3461+ mw.setUserConfig( 'playerPref', this.preference);
34623462 },
3463 -
 3463+
34643464 /**
34653465 * Sets the player preference
3466 - *
 3466+ *
34673467 * @param {String}
34683468 * playerId Prefered player id
34693469 * @param {String}
@@ -3481,7 +3481,7 @@
34823482 }
34833483 // Update All the player instances:
34843484 if ( selectedPlayer ) {
3485 - var playerList = mw.playerManager.getPlayerList();
 3485+ var playerList = mw.playerManager.getPlayerList();
34863486 for ( var i = 0; i < playerList.length; i++ ) {
34873487 var embed = $j( '#' + playerList[i] ).get( 0 );
34883488 if ( embed.mediaElement.selectedSource && ( embed.mediaElement.selectedSource.mimeType == mimeType ) )
@@ -3492,11 +3492,11 @@
34933493 }
34943494 }
34953495 },
3496 -
 3496+
34973497 /**
34983498 * Loads the user preference settings from a cookie
34993499 */
3500 - loadPreferences : function ( ) {
 3500+ loadPreferences : function ( ) {
35013501 this.preference = { };
35023502 // see if we have a cookie set to a clientSupported type:
35033503 preferenceConfig = mw.getUserConfig( 'playerPref' );
@@ -3515,13 +3515,13 @@
35163516
35173517 // List of players supported
35183518 players: null,
3519 -
 3519+
35203520 // Detect flag for completion
35213521 detect_done:false,
3522 -
 3522+
35233523 /**
35243524 * Runs the detect method and update the detect_done flag
3525 - *
 3525+ *
35263526 * @constructor
35273527 */
35283528 init: function() {
@@ -3529,10 +3529,10 @@
35303530 this.detect();
35313531 this.detect_done = true;
35323532 },
3533 -
 3533+
35343534 /**
35353535 * If the browsers supports a given mimetype
3536 - *
 3536+ *
35373537 * @param {String}
35383538 * mimeType Mime type for browser plug-in check
35393539 */
@@ -3544,7 +3544,7 @@
35453545 }
35463546 return false;
35473547 },
3548 -
 3548+
35493549 /**
35503550 * Detects what plug-ins the client supports
35513551 */
@@ -3559,11 +3559,11 @@
35603560 try{
35613561 var javaEnabled = navigator.javaEnabled();
35623562 } catch ( e ){
3563 -
 3563+
35643564 }
35653565 // Some browsers filter out duplicate mime types, hiding some plugins
35663566 var uniqueMimesOnly = $j.browser.opera || $j.browser.safari;
3567 -
 3567+
35683568 // Opera will switch off javaEnabled in preferences if java can't be
35693569 // found.
35703570 // And it doesn't register an application/x-java-applet mime type like
@@ -3571,7 +3571,7 @@
35723572 if ( javaEnabled && ( navigator.appName == 'Opera' ) ) {
35733573 this.players.addPlayer( cortadoPlayer );
35743574 }
3575 -
 3575+
35763576 // ActiveX plugins
35773577 if ( $j.browser.msie ) {
35783578 // check for flash
@@ -3583,12 +3583,12 @@
35843584 if ( this.testActiveX( 'VideoLAN.VLCPlugin.2' ) ) {
35853585 this.players.addPlayer( vlcPlayer );
35863586 }
3587 -
 3587+
35883588 // Java ActiveX
35893589 if ( this.testActiveX( 'JavaWebStart.isInstalled' ) ) {
35903590 this.players.addPlayer( cortadoPlayer );
35913591 }
3592 -
 3592+
35933593 // quicktime (currently off)
35943594 // if ( this.testActiveX(
35953595 // 'QuickTimeCheckObject.QuickTimeCheck.1' ) )
@@ -3604,9 +3604,9 @@
36053605 if( dummyvid.canPlayType ) {
36063606 // Add the webm player
36073607 if( dummyvid.canPlayType('video/webm; codecs="vp8, vorbis"') ){
3608 - this.players.addPlayer( webmNativePlayer );
 3608+ this.players.addPlayer( webmNativePlayer );
36093609 }
3610 -
 3610+
36113611 // Test for h264:
36123612 if ( dummyvid.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"' ) ) {
36133613 this.players.addPlayer( h264NativePlayer );
@@ -3616,7 +3616,7 @@
36173617 if ( mw.isAndroid2() ){
36183618 this.players.addPlayer( h264NativePlayer );
36193619 }
3620 -
 3620+
36213621 // Test for ogg
36223622 if ( dummyvid.canPlayType( 'video/ogg; codecs="theora,vorbis"' ) ) {
36233623 this.players.addPlayer( oggNativePlayer );
@@ -3629,8 +3629,8 @@
36303630 } catch ( e ) {
36313631 mw.log( 'could not run canPlayType ' + e );
36323632 }
3633 - }
3634 -
 3633+ }
 3634+
36353635 // "navigator" plugins
36363636 if ( navigator.mimeTypes && navigator.mimeTypes.length > 0 ) {
36373637 for ( var i = 0; i < navigator.mimeTypes.length; i++ ) {
@@ -3649,17 +3649,17 @@
36503650 this.players.addPlayer( vlcPlayer );
36513651 continue;
36523652 }
3653 -
 3653+
36543654 if ( type == 'application/x-java-applet' ) {
36553655 this.players.addPlayer( cortadoPlayer );
36563656 continue;
36573657 }
3658 -
 3658+
36593659 if ( (type == 'video/mpeg' || type=='video/x-msvideo') &&
3660 - pluginName.toLowerCase() == 'vlc multimedia plugin' ) {
 3660+ pluginName.toLowerCase() == 'vlc multimedia plugin' ) {
36613661 this.players.addPlayer( vlcMozillaPlayer );
3662 - }
3663 -
 3662+ }
 3663+
36643664 if ( type == 'application/ogg' ) {
36653665 if ( pluginName.toLowerCase() == 'vlc multimedia plugin' ) {
36663666 this.players.addPlayer( vlcMozillaPlayer );
@@ -3678,12 +3678,12 @@
36793679 continue;
36803680 }
36813681 }
3682 -
 3682+
36833683 if ( type == 'application/x-shockwave-flash' ) {
3684 -
 3684+
36853685 this.players.addPlayer( kplayer );
36863686 // this.players.addPlayer( flowPlayer );
3687 -
 3687+
36883688 // check version to add omtk:
36893689 if( navigator.plugins["Shockwave Flash"] ){
36903690 var flashDescription = navigator.plugins["Shockwave Flash"].description;
@@ -3696,16 +3696,16 @@
36973697 }
36983698 }
36993699 }
3700 -
 3700+
37013701 // Allow extensions to detect and add their own "players"
37023702 mw.log("trigger::embedPlayerUpdateMediaPlayersEvent");
37033703 $j( mw ).trigger( 'embedPlayerUpdateMediaPlayersEvent' , this.players );
3704 -
 3704+
37053705 },
3706 -
 3706+
37073707 /**
37083708 * Test IE for activeX by name
3709 - *
 3709+ *
37103710 * @param {String}
37113711 * name Name of ActiveXObject to look for
37123712 */
Index: branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.IFramePlayerApiClient.js
@@ -1,7 +1,7 @@
22 /**
3 -* iFrame api mapping support
4 -*
5 -* Client side ( binds a given iFrames to expose the player api )
 3+* iFrame api mapping support
 4+*
 5+* Client side ( binds a given iFrames to expose the player api )
66 */
77 mw.IFramePlayerApiClient = function( iframe, playerProxy, options ){
88 return this.init( iframe , playerProxy, options);
@@ -48,11 +48,11 @@
4949 //mw.log("IframePlayerApiClient:: hanldeReciveMsg ");
5050 // Confirm the event is coming for the target host:
5151 if( event.origin != this.iframeServer){
52 - mw.log("Skip msg from host does not match iFrame player: " + event.origin +
 52+ mw.log("Skip msg from host does not match iFrame player: " + event.origin +
5353 ' != iframe Server: ' + this.iframeServer )
5454 return ;
5555 };
56 - // Decode the message
 56+ // Decode the message
5757 var msgObject = JSON.parse( event.data );
5858 var playerAttributes = mw.getConfig( 'EmbedPlayer.Attributes' );
5959 // Before we update local attributes check that the object has not been updated by user js
@@ -60,7 +60,7 @@
6161 if( attrName != 'id' ){
6262 if( _this._prevPlayerProxy[ attrName ] != _this.playerProxy[ attrName ] ){
6363 mw.log( "IFramePlayerApiClient:: User js update:" + attrName + ' set to: ' + this.playerProxy[ attrName ] + ' != old: ' + _this._prevPlayerProxy[ attrName ] );
64 - // Send the updated attribute back to the iframe:
 64+ // Send the updated attribute back to the iframe:
6565 _this.postMessage({
6666 'attrName' : attrName,
6767 'attrValue' : _this.playerProxy[ attrName ]
@@ -81,7 +81,7 @@
8282 }
8383 }
8484 }
85 - // Trigger any binding events
 85+ // Trigger any binding events
8686 if( typeof msgObject.triggerName != 'undefined' && msgObject.triggerArgs != 'undefined') {
8787 mw.log('IFramePlayerApiClient:: trigger: ' + msgObject.triggerName );
8888 $j( _this.playerProxy ).trigger( msgObject.triggerName, msgObject.triggerArgs );
@@ -91,9 +91,9 @@
9292 'postMessage': function( msgObj ){
9393 mw.log( "IFramePlayerApiClient:: postMessage(): " + JSON.stringify( msgObj ) );
9494 $j.postMessage(
95 - JSON.stringify( msgObj ),
96 - mw.absoluteUrl( $j( this.iframe ).attr('src') ),
97 - this.iframe.contentWindow
 95+ JSON.stringify( msgObj ),
 96+ mw.absoluteUrl( $j( this.iframe ).attr('src') ),
 97+ this.iframe.contentWindow
9898 );
9999 }
100100 };
@@ -107,7 +107,7 @@
108108 // Append '_ifp' ( iframe player ) to id of real iframe so that 'id', and 'src' attributes don't conflict
109109 var originalIframeId = ( $( this.selector ).attr( 'id' ) )? $( this.selector ).attr( 'id' ) : Math.floor( 9999999 * Math.random() );
110110 var iframePlayerId = originalIframeId + '_ifp' ; // here we use random to generate a unique id
111 - // Append the div element proxy after the iframe
 111+ // Append the div element proxy after the iframe
112112 $j( this.selector )
113113 .attr('id', iframePlayerId)
114114 .after(
Index: branches/MwEmbedStandAlone/modules/EmbedPlayer/skins/mw.PlayerControlBuilder.js
@@ -147,8 +147,8 @@
148148 var $controlBar = embedPlayer.$interface.find( '.control-bar' );
149149
150150 this.available_width = embedPlayer.getPlayerWidth();
151 -
152 - mw.log( 'PlayerControlsBuilder:: addControlComponents into:' + this.available_width );
 151+
 152+ mw.log( 'PlayerControlsBuilder:: addControlComponents into:' + this.available_width );
153153 // Build the supportedComponets list
154154 this.supportedComponets = $j.extend( this.supportedComponets, embedPlayer.supports );
155155
@@ -200,33 +200,33 @@
201201
202202 /**
203203 * Get a window size for the player while preserving aspect ratio:
204 - *
 204+ *
205205 * @param {object} windowSize
206206 * object that set { 'width': {width}, 'height':{height} } of target window
207 - * @return {object}
 207+ * @return {object}
208208 * css settings for fullscreen player
209 - */
 209+ */
210210 getAspectPlayerWindowCss: function( windowSize ) {
211211 var embedPlayer = this.embedPlayer;
212212 // Setup target height width based on max window size
213213 if( !windowSize ){
214214 var windowSize = {
215215 'width' : $j( window ).width(),
216 - 'height' : $j( window ).height()
 216+ 'height' : $j( window ).height()
217217 };
218218 }
219219 // Set target width
220220 var targetWidth = windowSize.width;
221 - var targetHeight = targetWidth * ( embedPlayer.getHeight() / embedPlayer.getWidth() );
222 - // Check if it exceeds the height constraint:
223 - if( targetHeight > windowSize.height ){
224 - targetHeight = windowSize.height;
225 - targetWidth = targetHeight * ( embedPlayer.getWidth() / embedPlayer.getHeight() );
 221+ var targetHeight = targetWidth * ( embedPlayer.getHeight() / embedPlayer.getWidth() );
 222+ // Check if it exceeds the height constraint:
 223+ if( targetHeight > windowSize.height ){
 224+ targetHeight = windowSize.height;
 225+ targetWidth = targetHeight * ( embedPlayer.getWidth() / embedPlayer.getHeight() );
226226 }
227227 var offsetTop = ( targetHeight < windowSize.height )? ( windowSize.height- targetHeight ) / 2 : 0;
228228 var offsetLeft = ( targetWidth < windowSize.width )? ( windowSize.width- targetWidth ) / 2 : 0;
229 -
230 - //mw.log(" targetWidth: " + targetWidth + ' windowSize.width: ' + windowSize.width + ' :: ' + ( windowSize.width- targetWidth ) / 2 );
 229+
 230+ //mw.log(" targetWidth: " + targetWidth + ' windowSize.width: ' + windowSize.width + ' :: ' + ( windowSize.width- targetWidth ) / 2 );
231231 return {
232232 'height': targetHeight,
233233 'width' : targetWidth,
@@ -345,37 +345,37 @@
346346 if( $interface.offsetParent().get(0).tagName.toLowerCase() != 'body' ) {
347347 topOffset = -this.windowOffset.top + 'px';
348348 leftOffset = -this.windowOffset.left + 'px';
349 - }
350 -
 349+ }
351350
352 - // Set the player height width:
 351+
 352+ // Set the player height width:
353353 $j( embedPlayer ).css( {
354354 'position' : 'relative'
355355 } );
356 -
357 - // Overflow hidden in fullscreen:
 356+
 357+ // Overflow hidden in fullscreen:
358358 $interface.css('overlow', 'hidden');
359 -
360 - // Resize the player keeping aspect and with the widow scroll offset:
361 - _this.resizePlayer({
 359+
 360+ // Resize the player keeping aspect and with the widow scroll offset:
 361+ _this.resizePlayer({
362362 'top' : topOffset,
363363 'left' : leftOffset,
364364 'width' : $j( window ).width(),
365 - 'height' : $j( window ).height()
 365+ 'height' : $j( window ).height()
366366 }, true);
367 -
 367+
368368 // Remove absolute css of the interface parents
369369 $interface.parents().each( function() {
370 - //mw.log(' parent : ' + $j( this ).attr('id' ) + ' class: ' + $j( this ).attr('class') + ' pos: ' + $j( this ).css( 'position' ) );
371 - if( $j( this ).css( 'position' ) == 'absolute' ) {
372 - _this.parentsAbsolute.push( $j( this ) );
 370+ //mw.log(' parent : ' + $j( this ).attr('id' ) + ' class: ' + $j( this ).attr('class') + ' pos: ' + $j( this ).css( 'position' ) );
 371+ if( $j( this ).css( 'position' ) == 'absolute' ) {
 372+ _this.parentsAbsolute.push( $j( this ) );
373373 $j( this ).css( 'position', null );
374 - mw.log(' should update position: ' + $j( this ).css( 'position' ) );
 374+ mw.log(' should update position: ' + $j( this ).css( 'position' ) );
375375 }
376376 } );
377 -
378 -
379377
 378+
 379+
380380 // Bind mouse move in interface to hide control bar
381381 _this.mouseMovedFlag = false;
382382 $interface.mousemove( function(e){
@@ -405,8 +405,8 @@
406406 if( _this.fullscreenMode ){
407407 _this.resizePlayer({
408408 'width' : $j( window ).width(),
409 - 'height' : $j( window ).height()
410 - })
 409+ 'height' : $j( window ).height()
 410+ })
411411 }
412412 });
413413
@@ -423,36 +423,36 @@
424424 * Resize the player to a target size keeping aspect ratio
425425 */
426426 resizePlayer: function( size, animate ){
427 - var _this = this;
428 - // Update interface container:
429 - var interfaceCss = {
 427+ var _this = this;
 428+ // Update interface container:
 429+ var interfaceCss = {
430430 'top' : ( size.top ) ? size.top : '0px',
431431 'left' : ( size.left ) ? size.left : '0px',
432432 'width' : size.width,
433 - 'height' : size.height
 433+ 'height' : size.height
434434 };
435 - // Set up local pointer to interface:
 435+ // Set up local pointer to interface:
436436 var embedPlayer = this.embedPlayer;
437437 var $interface = embedPlayer.$interface;
438438 if( animate ){
439439 $interface.animate( interfaceCss );
440 - // Update player size
 440+ // Update player size
441441 $j( embedPlayer ).animate( _this.getAspectPlayerWindowCss( size ) );
442442 // Update play button pos
443 - $interface.find('.play-btn-large').animate( _this.getFullscreenPlayButtonCss( size ) );
444 - // Update the timed text size
 443+ $interface.find('.play-btn-large').animate( _this.getFullscreenPlayButtonCss( size ) );
 444+ // Update the timed text size
445445 $interface.find( '.track' ).animate( _this.getInterfaceSizeTextCss( size ) );
446446 } else {
447447 $interface.css( interfaceCss );
448 - // Update player size
 448+ // Update player size
449449 $j( embedPlayer ).css( _this.getAspectPlayerWindowCss( size ) );
450450 // Update play button pos
451 - $interface.find('.play-btn-large').css( _this.getFullscreenPlayButtonCss( size ) );
452 - // Update the timed text size
 451+ $interface.find('.play-btn-large').css( _this.getFullscreenPlayButtonCss( size ) );
 452+ // Update the timed text size
453453 $interface.find( '.track' ).css( _this.getInterfaceSizeTextCss( size ) );
454 - }
 454+ }
455455 },
456 -
 456+
457457 /**
458458 * Restore the window player
459459 */
@@ -500,13 +500,13 @@
501501
502502 // Restore the body scroll bar
503503 $j('body').css( 'overflow', 'auto' );
504 -
505 - // Resize the timed text font size per window width
 504+
 505+ // Resize the timed text font size per window width
506506 $interface.find( '.track' ).css( _this.getInterfaceSizeTextCss({
507507 'width' : embedPlayer.getWidth(),
508508 'height' : interfaceHeight
509509 }) );
510 -
 510+
511511 } );
512512 mw.log( 'restore embedPlayer:: ' + embedPlayer.getWidth() + ' h: ' + embedPlayer.getHeight());
513513 // Restore the player:
@@ -715,17 +715,17 @@
716716 return false;
717717 }
718718 }
719 -
720 - // Chrome's webM support is oky though:
721 - if( /chrome/.test(navigator.userAgent.toLowerCase() ) &&
 719+
 720+ // Chrome's webM support is oky though:
 721+ if( /chrome/.test(navigator.userAgent.toLowerCase() ) &&
722722 mw.EmbedTypes.players.getMIMETypePlayers( 'video/webm' ).length ){
723723 return false;
724724 }
725 -
726 -
727 - // Check for h264 and or flash/flv source and playback support and don't show warning
728 - if(
729 - ( mw.EmbedTypes.players.getMIMETypePlayers( 'video/h264' ).length
 725+
 726+
 727+ // Check for h264 and or flash/flv source and playback support and don't show warning
 728+ if(
 729+ ( mw.EmbedTypes.players.getMIMETypePlayers( 'video/h264' ).length
730730 && this.embedPlayer.mediaElement.getSources( 'video/h264' ).length )
731731 ||
732732 ( mw.EmbedTypes.players.getMIMETypePlayers( 'video/x-flv' ).length
@@ -1008,7 +1008,7 @@
10091009
10101010 this.displayOptionsMenuFlag = false;
10111011 //mw.log(' closeMenuOverlay: ' + this.displayOptionsMenuFlag);
1012 -
 1012+
10131013 $overlay.fadeOut( "slow", function() {
10141014 $overlay.remove();
10151015 } );
Index: branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayerNative.js
@@ -1,34 +1,34 @@
22 /**
33 * Native embed library:
4 -*
 4+*
55 * Enables embedPlayer support for native html5 browser playback system
66 */
77 mw.EmbedPlayerNative = {
88
99 //Instance Name
1010 instanceOf: 'Native',
11 -
12 - // Counts the number of times we tried to access the video element
 11+
 12+ // Counts the number of times we tried to access the video element
1313 grab_try_count:0,
14 -
15 - // Flag to only load the video ( not play it )
 14+
 15+ // Flag to only load the video ( not play it )
1616 onlyLoadFlag:false,
17 -
18 - //Callback fired once video is "loaded"
 17+
 18+ //Callback fired once video is "loaded"
1919 onLoadedCallback: null,
20 -
21 - // The previous "currentTime" to sniff seek actions
 20+
 21+ // The previous "currentTime" to sniff seek actions
2222 // NOTE the bug where onSeeked does not seem fire consistently may no longer be applicable
2323 prevCurrentTime: -1,
24 -
 24+
2525 // Store the progress event ( updated during monitor )
2626 progressEventData: null,
27 -
28 - // If the media loaded event has been fired
 27+
 28+ // If the media loaded event has been fired
2929 mediaLoadedFlag: null,
30 -
31 -
32 - // All the native events per:
 30+
 31+
 32+ // All the native events per:
3333 // http://www.w3.org/TR/html5/video.html#mediaevents
3434 nativeEvents : [
3535 'loadstart',
@@ -65,8 +65,8 @@
6666 'overlays' : true
6767 },
6868
69 - /**
70 - * Updates the supported features given the "type of player"
 69+ /**
 70+ * Updates the supported features given the "type of player"
7171 */
7272 updateFeatureSupport: function(){
7373 // iWhatever devices appear to have a broken
@@ -75,39 +75,39 @@
7676 this.supports.overlays = false;
7777 }
7878 },
79 -
 79+
8080 /**
8181 * Return the embed code
8282 */
8383 doEmbedHTML : function () {
8484 var _this = this;
85 -
86 - // Reset some play state flags:
 85+
 86+ // Reset some play state flags:
8787 _this.bufferStartFlag = false;
8888 _this.bufferEndFlag = false;
89 -
 89+
9090 mw.log( "native play url:" + this.getSrc() + ' startOffset: ' + this.start_ntp + ' end: ' + this.end_ntp );
91 -
 91+
9292 // Check if using native controls and already the "pid" is already in the DOM
9393 if( this.useNativePlayerControls() && $j( '#' + this.pid ).length &&
9494 typeof $j( '#' + this.pid ).get(0).play != 'undefined' ) {
9595 _this.postEmbedJS();
9696 return ;
9797 }
98 -
 98+
9999 $j( this ).html(
100100 _this.getNativePlayerHtml()
101101 );
102 -
103 - // Directly run postEmbedJS ( if playerElement is not available it will retry )
 102+
 103+ // Directly run postEmbedJS ( if playerElement is not available it will retry )
104104 _this.postEmbedJS();
105105 },
106 -
 106+
107107 /**
108108 * Get the native player embed code.
109 - *
 109+ *
110110 * @param {object} playerAttribtues Attributes to be override in function call
111 - * @return {object} cssSet css to apply to the player
 111+ * @return {object} cssSet css to apply to the player
112112 */
113113 getNativePlayerHtml: function( playerAttribtues, cssSet ){
114114 if( !playerAttribtues) {
@@ -116,46 +116,46 @@
117117 // Update required attributes
118118 if( !playerAttribtues[ 'id'] ) playerAttribtues['id'] = this.pid;
119119 if( !playerAttribtues['src'] ) playerAttribtues['src'] = this.getSrc();
120 -
 120+
121121 // If autoplay pass along to attribute ( needed for iPad / iPod no js autoplay support
122122 if( this.autoplay ) {
123123 playerAttribtues['autoplay'] = 'true';
124124 }
125 -
126 -
 125+
 126+
127127 if( !cssSet ){
128128 cssSet = {};
129129 }
130130 // Set default width height to 100% of parent container
131131 if( !cssSet['width'] ) cssSet['width'] = '100%';
132132 if( !cssSet['height'] ) cssSet['height'] = '100%';
133 -
 133+
134134 // Also need to set the loop param directly for iPad / iPod
135135 if( this.loop ) {
136136 playerAttribtues['loop'] = 'true';
137137 }
138 -
 138+
139139 var tagName = ( this.isAudio() ) ? 'audio' : 'video';
140 -
 140+
141141 return $j( '<' + tagName + ' />' )
142 - // Add the special nativeEmbedPlayer to avoid any rewrites of of this video tag.
 142+ // Add the special nativeEmbedPlayer to avoid any rewrites of of this video tag.
143143 .addClass( 'nativeEmbedPlayerPid' )
144144 .attr( playerAttribtues )
145145 .css( cssSet );
146146 },
147 -
 147+
148148 /**
149 - * Post element javascript, binds event listeners and starts monitor
 149+ * Post element javascript, binds event listeners and starts monitor
150150 */
151151 postEmbedJS: function() {
152152 var _this = this;
153153 mw.log( "f:native:postEmbedJS:" );
154154
155 - // Setup local pointer:
 155+ // Setup local pointer:
156156 var vid = this.getPlayerElement();
157157 // Apply media element bindings:
158158 this.applyMediaElementBindings();
159 -
 159+
160160 // Check for load flag
161161 if ( this.onlyLoadFlag ) {
162162 vid.pause();
@@ -164,14 +164,14 @@
165165 // Issue play request
166166 vid.play();
167167 }
168 -
 168+
169169 setTimeout( function() {
170170 _this.monitor();
171171 }, 100 );
172172 },
173 -
 173+
174174 /**
175 - * Apply media element bindings
 175+ * Apply media element bindings
176176 */
177177 applyMediaElementBindings: function(){
178178 var _this = this;
@@ -181,36 +181,36 @@
182182 return ;
183183 }
184184 $j.each( _this.nativeEvents, function( inx, eventName ){
185 - $j( vid ).bind( eventName , function(){
 185+ $j( vid ).bind( eventName , function(){
186186 if( _this._propagateEvents ){
187 - var argArray = $j.makeArray( arguments );
188 - // Check if there is local handler:
 187+ var argArray = $j.makeArray( arguments );
 188+ // Check if there is local handler:
189189 if( _this['on' + eventName ] ){
190190 _this['on' + eventName ].apply( _this, argArray);
191191 } else {
192 - // No local handler directly propagate the event to the abstract object:
 192+ // No local handler directly propagate the event to the abstract object:
193193 $j( _this ).trigger( eventName, argArray )
194194 }
195195 }
196196 })
197197 });
198198 },
199 -
 199+
200200 // basic monitor function to update buffer
201201 monitor: function(){
202202 var _this = this;
203203 var vid = _this.getPlayerElement();
204 -
 204+
205205 // Update the bufferedPercent
206206 if( vid && vid.buffered && vid.buffered.end && vid.duration ) {
207207 this.bufferedPercent = ( vid.buffered.end(0) / vid.duration );
208208 }
209209 _this.parent_monitor();
210210 },
211 -
212 -
 211+
 212+
213213 /**
214 - * Issue a seeking request.
 214+ * Issue a seeking request.
215215 *
216216 * @param {Float} percentage
217217 */
@@ -219,10 +219,10 @@
220220 this.seeking = true;
221221 // Run the seeking hook
222222 $j( this.embedPlayer ).trigger( 'onSeek' );
223 -
 223+
224224 // Run the onSeeking interface update
225225 this.controlBuilder.onSeek();
226 -
 226+
227227 // @@todo check if the clip is loaded here (if so we can do a local seek)
228228 if ( this.supportsURLTimeEncoding() ) {
229229 // Make sure we could not do a local seek instead:
@@ -230,21 +230,21 @@
231231 mw.log( "do local seek " + percentage + ' is already buffered < ' + this.bufferedPercent );
232232 this.doNativeSeek( percentage );
233233 } else {
234 - // We support URLTimeEncoding call parent seek:
 234+ // We support URLTimeEncoding call parent seek:
235235 this.parent_doSeek( percentage );
236236 }
237237 } else if ( this.playerElement && this.playerElement.duration ) {
238 - // (could also check bufferedPercent > percentage seek (and issue oggz_chop request or not)
 238+ // (could also check bufferedPercent > percentage seek (and issue oggz_chop request or not)
239239 this.doNativeSeek( percentage );
240240 } else {
241 - // try to do a play then seek:
 241+ // try to do a play then seek:
242242 this.doPlayThenSeek( percentage )
243243 }
244244 },
245 -
 245+
246246 /**
247247 * Do a native seek by updating the currentTime
248 - * @param {float} percentage
 248+ * @param {float} percentage
249249 * Percent to seek to of full time
250250 */
251251 doNativeSeek: function( percentage ) {
@@ -257,11 +257,11 @@
258258 _this.monitor();
259259 })
260260 },
261 -
 261+
262262 /**
263263 * Seek in a existing stream
264264 *
265 - * @param {Float} percentage
 265+ * @param {Float} percentage
266266 * Percentage of the stream to seek to between 0 and 1
267267 */
268268 doPlayThenSeek: function( percentage ) {
@@ -275,7 +275,7 @@
276276 if ( _this.playerElement && _this.playerElement.duration ) {
277277 _this.doNativeSeek( percentage );
278278 } else {
279 - // Try to get player for 40 seconds:
 279+ // Try to get player for 40 seconds:
280280 // (it would be nice if the onmetadata type callbacks where fired consistently)
281281 if ( retryCount < 800 ) {
282282 setTimeout( readyForSeek, 50 );
@@ -287,11 +287,11 @@
288288 }
289289 readyForSeek();
290290 },
291 -
 291+
292292 /**
293293 * Set the current time with a callback
294 - *
295 - * @param {Float} position
 294+ *
 295+ * @param {Float} position
296296 * Seconds to set the time to
297297 * @param {Function} callback
298298 * Function called once time has been set.
@@ -304,7 +304,7 @@
305305 if( _this.playerElement.readyState >= 1 ){
306306 if( _this.playerElement.currentTime == time ){
307307 callback();
308 - return;
 308+ return;
309309 }
310310 var once = function( event ) {
311311 if( callback ){
@@ -324,7 +324,7 @@
325325 } else {
326326 if( callbackCount >= 300 ){
327327 mw.log("Error with seek request, media never in ready state");
328 - return ;
 328+ return ;
329329 }
330330 setTimeout( function(){
331331 _this.setCurrentTime( time, callback , callbackCount++);
@@ -338,8 +338,8 @@
339339 getPlayerElementTime: function() {
340340 var _this = this;
341341 // Make sure we have .vid obj
342 - this.getPlayerElement();
343 -
 342+ this.getPlayerElement();
 343+
344344 if ( !this.playerElement ) {
345345 mw.log( 'mwEmbedPlayer::getPlayerElementTime: ' + this.id + ' not in dom ( stop monitor)' );
346346 return false;
@@ -347,7 +347,7 @@
348348 // Return the playerElement currentTime
349349 return this.playerElement.currentTime;
350350 },
351 -
 351+
352352 /**
353353 * Pause the video playback
354354 * calls parent_pause to update the interface
@@ -361,13 +361,13 @@
362362 }
363363 }
364364 },
365 -
 365+
366366 /**
367367 * Play back the video stream
368368 * calls parent_play to update the interface
369369 */
370370 play: function( ) {
371 -
 371+
372372 this.getPlayerElement();
373373 this.parent_play(); // update interface
374374 if ( this.playerElement && this.playerElement.play ) {
@@ -375,12 +375,12 @@
376376 if( this.playerElement.paused ){
377377 this.playerElement.play();
378378 }
379 - // re-start the monitor:
 379+ // re-start the monitor:
380380 this.monitor();
381381 }
382382 },
383383 /**
384 - * Stop the player ( end all listeners )
 384+ * Stop the player ( end all listeners )
385385 */
386386 stop:function(){
387387 if( this.playerElement ){
@@ -388,7 +388,7 @@
389389 }
390390 this.parent_stop();
391391 },
392 -
 392+
393393 /**
394394 * Toggle the Mute
395395 * calls parent_toggleMute to update the interface
@@ -399,7 +399,7 @@
400400 if ( this.playerElement )
401401 this.playerElement.muted = this.muted;
402402 },
403 -
 403+
404404 /**
405405 * Update Volume
406406 *
@@ -414,27 +414,27 @@
415415 this.playerElement.volume = percentage;
416416 }
417417 },
418 -
 418+
419419 /**
420420 * get Volume
421421 *
422 - * @return {Float}
 422+ * @return {Float}
423423 * Audio volume between 0 and 1.
424424 */
425 - getPlayerElementVolume: function() {
 425+ getPlayerElementVolume: function() {
426426 if ( this.getPlayerElement() ) {
427427 return this.playerElement.volume;
428428 }
429429 },
430430 /**
431431 * get the native muted state
432 - */
 432+ */
433433 getPlayerElementMuted: function(){
434434 if ( this.getPlayerElement() ) {
435435 return this.playerElement.muted;
436436 }
437437 },
438 -
 438+
439439 /**
440440 * Get the native media duration
441441 */
@@ -443,7 +443,7 @@
444444 return this.playerElement.duration;
445445 }
446446 },
447 -
 447+
448448 /**
449449 * load the video stream with a callback fired once the video is "loaded"
450450 *
@@ -464,80 +464,80 @@
465465 callback();
466466 }
467467 },
468 -
 468+
469469 /**
470 - * Get /update the playerElement value
471 - */
 470+ * Get /update the playerElement value
 471+ */
472472 getPlayerElement: function () {
473473 this.playerElement = $j( '#' + this.pid ).get( 0 );
474474 return this.playerElement;
475475 },
476 -
 476+
477477 /**
478 - * Bindings for the Video Element Events
 478+ * Bindings for the Video Element Events
479479 */
480 -
 480+
481481 /**
482482 * Local method for seeking event
483 - * fired when "seeking"
 483+ * fired when "seeking"
484484 */
485485 onseeking: function() {
486486 mw.log( "native:onSeeking");
487 - // Trigger the html5 seeking event
 487+ // Trigger the html5 seeking event
488488 //( if not already set from interface )
489489 if( !this.seeking ) {
490490 this.seeking = true;
491491 // Run the seeking hook (somewhat redundant )
492492 $j( this ).trigger( 'onSeek' );
493 -
 493+
494494 // Run the onSeeking interface update
495495 this.controlBuilder.onSeek();
496 -
 496+
497497 // Trigger the html5 "seeking" trigger
498498 mw.log("native:seeking:trigger:: " + this.seeking);
499499 $j( this ).trigger( 'seeking' );
500500 }
501501 },
502 -
 502+
503503 /**
504504 * Local method for seeked event
505 - * fired when done seeking
 505+ * fired when done seeking
506506 */
507507 onseeked: function() {
508508 mw.log("native:onSeeked");
509 -
 509+
510510 mw.log("native:onSeeked:trigger");
511 - // Trigger the html5 action on the parent
 511+ // Trigger the html5 action on the parent
512512 if( this.seeking && this.useNativePlayerControls() ){
513513 this.seeking = false;
514514 $j( this ).trigger( 'seeked' );
515515 }
516516 this.seeking = false;
517517 },
518 -
 518+
519519 /**
520520 * Handle the native paused event
521 - */
 521+ */
522522 onpause: function(){
523523 mw.log( "EmbedPlayer:native: OnPaused" );
524524 this.parent_pause();
525525 },
526 -
 526+
527527 /**
528 - * Handle the native play event
 528+ * Handle the native play event
529529 */
530530 onplay: function(){
531531 mw.log("EmbedPlayer:native:: OnPlay");
532532 // Update the interface ( if paused )
533533 this.parent_play();
534534 },
535 -
 535+
536536 /**
537537 * Local method for metadata ready
538538 * fired when metadata becomes available
539539 *
540 - * Used to update the media duration to
541 - * accurately reflect the src duration
 540+ * Used to update the media duration to
 541+ * accurately reflect the src duration
542542 */
543543 onloadedmetadata: function() {
544544 this.getPlayerElement();
@@ -545,25 +545,25 @@
546546 mw.log( 'f:onloadedmetadata metadata ready Update duration:' + this.playerElement.duration + ' old dur: ' + this.getDuration() );
547547 this.duration = this.playerElement.duration;
548548 }
549 -
 549+
550550 //Fire "onLoaded" flags if set
551551 if( typeof this.onLoadedCallback == 'function' ) {
552552 this.onLoadedCallback();
553553 }
554 -
 554+
555555 // Tigger "media loaded"
556556 if( ! this.mediaLoadedFlag ){
557557 $j( this ).trigger( 'mediaLoaded' );
558558 this.mediaLoadedFlag = true;
559559 }
560560 },
561 -
 561+
562562 /**
563563 * Local method for progress event
564564 * fired as the video is downloaded / buffered
565565 *
566 - * Used to update the bufferedPercent
567 - *
 566+ * Used to update the bufferedPercent
 567+ *
568568 * Note: this way of updating buffer was only supported in firefox 3.x and
569569 * not supported in firefox 4.x
570570 */
@@ -571,11 +571,11 @@
572572 var e = event.originalEvent;
573573 //mw.log("onprogress: e:" + e + ' ' + e.loaded + ' && ' + e.total );
574574 if( e.loaded && e.total ) {
575 - this.bufferedPercent = e.loaded / e.total;
 575+ this.bufferedPercent = e.loaded / e.total;
576576 this.progressEventData = e.loaded;
577577 }
578578 },
579 -
 579+
580580 /**
581581 * Local method for progress event
582582 * fired as the video is downloaded / buffered
@@ -585,7 +585,7 @@
586586 onended: function() {
587587 var _this = this;
588588 mw.log( 'EmbedPlayer:native: onended:' + this.playerElement.currentTime + ' real dur:' + this.getDuration() );
589 -
 589+
590590 this.onClipDone();
591591 }
592592 };

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r75691whitespace and indent cleanuphartman00:10, 30 October 2010
r76689sync with kaltura svn. Some whitespace fixes scripts may have to be re-run. (...dale17:33, 15 November 2010

Status & tagging log