r55574 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r55573‎ | r55574 | r55575 >
Date:15:34, 25 August 2009
Author:dale
Status:deferred
Tags:
Comment:
* related videos per commons wikiKey ( GerardoDoog )
Modified paths:
  • /trunk/phase3/js2/mwEmbed/example_usage/Player_RelatedVideos.html (added) (history)
  • /trunk/phase3/js2/mwEmbed/libEmbedVideo/embedVideo.js (modified) (history)

Diff [purge]

Index: trunk/phase3/js2/mwEmbed/libEmbedVideo/embedVideo.js
@@ -1,6 +1,6 @@
22 /* the base video control JSON object with default attributes
3 - * for supported attribute details see README
4 - */
 3+* for supported attribute details see README
 4+*/
55
66 loadGM({
77 "mwe-loading_plugin" : "loading plugin <blink>...<\/blink>",
@@ -45,13 +45,17 @@
4646 "mwe-ogg-player-selected" : "(selected)",
4747 "mwe-ogg-player-omtkplayer" : "OMTK Flash Vorbis",
4848 "mwe-generic_missing_plugin" : "You browser does not appear to support the following playback type: <b>$1<\/b><br \/>Visit the <a href=\"http:\/\/commons.wikimedia.org\/wiki\/Commons:Media_help\">Playback Methods<\/a> page to download a player.<br \/>",
49 - "mwe-for_best_experience" : "For a better video playback experience we recommend:<br \/><b><a href=\"http:\/\/www.mozilla.com\/en-US\/firefox\/upgrade.html?from=mwEmbed\">Firefox 3.5<\/a>.<\/b>",
 49+ "mwe-for_best_experience" : "For a better video playback experience we recommend: <b><a href=\"http:\/\/www.mozilla.com\/en-US\/firefox\/upgrade.html?from=mwEmbed\">Firefox 3.5<\/a>.<\/b>",
5050 "mwe-do_not_warn_again" : "Dissmiss for now.",
5151 "mwe-playerselect" : "Players",
5252 "mwe-read_before_embed" : "Please <a href=\"http:\/\/mediawiki.org\/wiki\/Security_Notes_on_Remote_Embedding\" target=\"_new\">Read This<\/a> before embeding!",
53 - "mwe-embed_site_or_blog" : "Embed on your site or blog"
 53+ "mwe-embed_site_or_blog" : "Embed on your site or blog",
 54+ "mwe_related_videos" : "Related Videos"
5455 });
5556
 57+//set the globals:
 58+var commons_api_url = 'http://commons.wikimedia.org/w/api.php';
 59+
5660 var default_video_attributes = {
5761 "id":null,
5862 "class":null,
@@ -68,7 +72,8 @@
6973 "end":null,
7074 "controls":true,
7175 "muted":false,
72 -
 76+ "wikiTitleKey":null,
 77+
7378 //roe url (for xml based metadata)
7479 "roe":null,
7580 //if roe includes metadata tracks we can expose a link to metadata
@@ -82,15 +87,15 @@
8388 "duration":null, //media duration (read from file or the temporal url)
8489 "networkState":0,
8590
86 - "startOffset":null, //if serving an ogg_chop segment use this to offset the presentation time
 91+ "startOffset":null, //if serving an ogg_chop segment use this to offset the presentation time
8792
8893 //custom attributes for mv_embed:
89 - "play_button":true,
 94+ "play_button":true,
9095 "thumbnail":null,
9196 "linkback":null,
9297 "embed_link":true,
9398 "download_link":true,
94 - "type":null //the content type of the media
 99+ "type":null //the content type of the media
95100 };
96101 /*
97102 * the base source attibute checks
@@ -103,11 +108,11 @@
104109 'startOffset',
105110 'durationHint',
106111 'start',
107 - 'end',
 112+ 'end',
108113 'default',
109114 'lang'
110115 );
111 -//set the dismissNativeWarn flag:
 116+//set the dismissNativeWarn flag:
112117 _global['dismissNativeWarn'] = false;
113118 /*
114119 * Converts all occurrences of <video> tag into video object
@@ -115,79 +120,79 @@
116121 function mv_video_embed(swap_done_callback, force_id){
117122 mvEmbed.init( swap_done_callback, force_id );
118123 }
119 -mvEmbed = {
120 - //flist stores the set of functions to run after the video has been swaped in.
 124+mvEmbed = {
 125+ //flist stores the set of functions to run after the video has been swaped in.
121126 flist:new Array(),
122127 init:function( swap_done_callback, force_id ){
123 -
 128+
124129 if(swap_done_callback)
125130 mvEmbed.flist.push( swap_done_callback );
126 -
 131+
127132 //get mv_embed location if it has not been set
128 - js_log('mv_embed ' + MV_EMBED_VERSION);
129 -
130 - var loadPlaylistLib=false;
131 -
 133+ js_log('mv_embed ' + MV_EMBED_VERSION);
 134+
 135+ var loadPlaylistLib=false;
 136+
132137 var eAction = function(this_elm){
133138 js_log( "Do SWAP: " + $j(this_elm).attr("id") + ' tag: '+ this_elm.tagName.toLowerCase() );
134 -
 139+
135140 if( $j(this_elm).attr("id") == '' ){
136141 $j(this_elm).attr("id", 'v'+ global_player_list.length);
137 - }
138 - //stre a global reference to the id
 142+ }
 143+ //stre a global reference to the id
139144 global_player_list.push( $j(this_elm).attr("id") );
140145 //if video doSwap
141146 switch( this_elm.tagName.toLowerCase()){
142147 case 'video':
143 - var videoInterface = new embedVideo(this_elm);
 148+ var videoInterface = new embedVideo(this_elm);
144149 mvEmbed.swapEmbedVideoElement( this_elm, videoInterface );
145150 break;
146151 case 'audio':
147 - var videoInterface = new embedVideo(this_elm);
 152+ var videoInterface = new embedVideo(this_elm);
148153 videoInterface.type ='audio';
149154 mvEmbed.swapEmbedVideoElement( this_elm, videoInterface );
150155 break;
151156 case 'playlist':
152157 loadPlaylistLib=true;
153158 break;
154 - }
 159+ }
155160 }
156 -
 161+
157162 if( force_id == null && force_id != '' ){
158 - var j_selector = 'video,audio,playlist';
 163+ var j_selector = 'video,audio,playlist';
159164 }else{
160165 var j_selector = '#' + force_id;
161166 }
162 - //process selected elements:
163 - //ie8 does not play well with the jQuery video,audio,playlist selector use native:
 167+ //process selected elements:
 168+ //ie8 does not play well with the jQuery video,audio,playlist selector use native:
164169 if($j.browser.msie && $j.browser.version >= 8){
165 - jtags = j_selector.split(',');
166 - for( var i=0; i < jtags.length; i++){
 170+ jtags = j_selector.split(',');
 171+ for( var i=0; i < jtags.length; i++){
167172 $j( document.getElementsByTagName( jtags[i] )).each(function(){
168173 eAction(this);
169174 });
170 - }
171 - }else{
 175+ }
 176+ }else{
172177 $j( j_selector ).each(function(){
173178 eAction(this);
174 - });
175 - }
176 - if(loadPlaylistLib){
177 - mvJsLoader.doLoad([
 179+ });
 180+ }
 181+ if(loadPlaylistLib){
 182+ mvJsLoader.doLoad([
178183 'mvPlayList',
179184 '$j.ui', //include dialog for pop-ing up thigns
180 - '$j.ui.dialog'
 185+ '$j.ui.dialog'
181186 ], function(){
182 - $j('playlist').each(function(){
 187+ $j('playlist').each(function(){
183188 //create new playlist interface:
184189 var plObj = new mvPlayList( this );
185190 mvEmbed.swapEmbedVideoElement(this, plObj);
186191 var added_height = plObj.pl_layout.title_bar_height + plObj.pl_layout.control_height;
187 - //move into a blocking display container with height + controls + title height:
188 - $j('#'+plObj.id).wrap('<div style="display:block;height:' + (plObj.height + added_height) + 'px;"></div>');
 192+ //move into a blocking display container with height + controls + title height:
 193+ $j('#'+plObj.id).wrap('<div style="display:block;height:' + (plObj.height + added_height) + 'px;"></div>');
189194 });
190195 });
191 - }
 196+ }
192197 this.checkClipsReady();
193198 },
194199 /*
@@ -199,13 +204,13 @@
200205 js_log('do swap ' + videoInterface.id + ' for ' + video_element);
201206 embed_video = document.createElement('div');
202207 //make sure our div has a hight/width set:
203 -
 208+
204209 $j(embed_video).css({
205210 'width':videoInterface.width,
206211 'height':videoInterface.height
207 - }).html( mv_get_loading_img() );
 212+ }).html( mv_get_loading_img() );
208213 //inherit the video interface
209 - for(var method in videoInterface){ //for in loop oky in Element context
 214+ for(var method in videoInterface){ //for in loop oky in Element context
210215 if(method!='readyState'){ //readyState crashes IE
211216 if(method=='style'){
212217 embed_video.setAttribute('style', videoInterface[method]);
@@ -222,32 +227,32 @@
223228 //string -> boolean:
224229 if(embed_video[method]=="false")embed_video[method]=false;
225230 if(embed_video[method]=="true")embed_video[method]=true;
226 - }
227 - ///js_log('did vI style');
228 - //now swap out the video element for the embed_video obj:
229 - $j(video_element).after(embed_video).remove();
230 - //js_log('did swap');
231 - $j('#'+embed_video.id).get(0).on_dom_swap();
232 -
 231+ }
 232+ ///js_log('did vI style');
 233+ //now swap out the video element for the embed_video obj:
 234+ $j(video_element).after(embed_video).remove();
 235+ //js_log('did swap');
 236+ $j('#'+embed_video.id).get(0).on_dom_swap();
 237+
233238 // now that "embed_video" is stable, do more initialization (if we are ready)
234 - if($j('#'+embed_video.id).get(0).loading_external_data == false &&
 239+ if($j('#'+embed_video.id).get(0).loading_external_data == false &&
235240 $j('#'+embed_video.id).get(0).init_with_sources_loadedDone == false){
236 - //load and set ready state since source are available:
 241+ //load and set ready state since source are available:
237242 $j('#'+embed_video.id).get(0).init_with_sources_loaded();
238243 }
239 -
 244+
240245 js_log('done with child: ' + embed_video.id + ' len:' + global_player_list.length);
241246 return true;
242247 },
243248 //this should not be needed.
244249 checkClipsReady : function(){
245250 //js_log('checkClipsReady');
246 - var is_ready=true;
 251+ var is_ready=true;
247252 for(var i=0; i < global_player_list.length; i++){
248253 if( $j('#'+global_player_list[i]).length !=0){
249 - var cur_vid = $j('#'+global_player_list[i]).get(0);
 254+ var cur_vid = $j('#'+global_player_list[i]).get(0);
250255 is_ready = ( cur_vid.ready_to_play ) ? is_ready : false;
251 - if( !is_ready && cur_vid.load_error ){
 256+ if( !is_ready && cur_vid.load_error ){
252257 is_ready=true;
253258 $j(cur_vid).html( cur_vid.load_error );
254259 }
@@ -255,15 +260,15 @@
256261 }
257262 if( is_ready ){
258263 mvEmbed.allClipsReady = true;
259 - // run queued functions
 264+ // run queued functions
260265 //js_log('run queded functions:' + mvEmbed.flist[0]);
261266 mvEmbed.runFlist();
262 - }else{
 267+ }else{
263268 setTimeout( 'mvEmbed.checkClipsReady()', 25 );
264 - }
 269+ }
265270 },
266271 runFlist:function(){
267 - while (this.flist.length){
 272+ while (this.flist.length){
268273 this.flist.shift()();
269274 }
270275 }
@@ -306,37 +311,37 @@
307312
308313 init : function(element)
309314 {
310 - //js_log('adding mediaSource: ' + element);
 315+ //js_log('adding mediaSource: ' + element);
311316 this.src = $j(element).attr('src');
312317 this.marked_default = false;
313318 if ( element.tagName.toLowerCase() == 'video')
314 - this.marked_default = true;
315 -
 319+ this.marked_default = true;
 320+
316321 //set default URLTimeEncoding if we have a time url:
317 - //not ideal way to discover if content is on an oggz_chop server.
318 - //should check some other way.
 322+ //not ideal way to discover if content is on an oggz_chop server.
 323+ //should check some other way.
319324 var pUrl = parseUri ( this.src );
320325 if(typeof pUrl['queryKey']['t'] != 'undefined'){
321 - this['URLTimeEncoding']=true;
322 - }
 326+ this['URLTimeEncoding']=true;
 327+ }
323328 for(var i=0; i < mv_default_source_attr.length; i++){ //array loop:
324 - var attr = mv_default_source_attr[ i ];
 329+ var attr = mv_default_source_attr[ i ];
325330 if( $j(element).attr( attr ) ) {
326331 this[ attr ] = $j(element).attr( attr );
327332 }
328 - }
329 - //update duration from hit if present:
 333+ }
 334+ //update duration from hit if present:
330335 if(this.durationHint)
331 - this.duration = this.durationHint;
332 -
333 -
 336+ this.duration = this.durationHint;
 337+
 338+
334339 if ( $j(element).attr('type'))
335340 this.mime_type = $j(element).attr('type');
336341 else if ($j(element).attr('content-type'))
337342 this.mime_type = $j(element).attr('content-type');
338 - else
 343+ else
339344 this.mime_type = this.detectType(this.src);
340 -
 345+
341346 //set the title if unset:
342347 if( !this.title )
343348 this.title = this.mime_type;
@@ -344,9 +349,9 @@
345350 this.parseURLDuration();
346351 },
347352 updateSource:function(element){
348 - //for now just update the title:
 353+ //for now just update the title:
349354 if ($j(element).attr("title"))
350 - this.title = $j(element).attr("title");
 355+ this.title = $j(element).attr("title");
351356 },
352357 /** updates the src time and start & end
353358 * @param {String} start_time in NTP format
@@ -357,18 +362,18 @@
358363 //js_log("pre uri:" + this.src);
359364 //if we have time we can use:
360365 if( this.URLTimeEncoding ){
361 - //make sure its a valid start time / end time (else set default)
362 - if( !npt2seconds(start_ntp) )
 366+ //make sure its a valid start time / end time (else set default)
 367+ if( !npt2seconds(start_ntp) )
363368 start_ntp = this.start_ntp;
364 -
 369+
365370 if( !npt2seconds(end_ntp) )
366371 end_ntp = this.end_ntp;
367 -
368 - this.src = getURLParamReplace(this.src, { 't': start_ntp +'/'+ end_ntp } );
369 -
 372+
 373+ this.src = getURLParamReplace(this.src, { 't': start_ntp +'/'+ end_ntp } );
 374+
370375 //update the duration
371376 this.parseURLDuration();
372 - }
 377+ }
373378 },
374379 setDuration:function (duration)
375380 {
@@ -386,20 +391,20 @@
387392 return this.mime_type;
388393 },
389394 /** URI accessor function.
390 - * @param int seek_time_sec (used to adjust the URI for url based seeks)
 395+ * @param int seek_time_sec (used to adjust the URI for url based seeks)
391396 @return the URI of the source.
392397 @type String
393398 */
394399 getURI : function( seek_time_sec )
395 - {
396 - if( !seek_time_sec || !this.URLTimeEncoding ){
397 - return this.src;
398 - }
 400+ {
 401+ if( !seek_time_sec || !this.URLTimeEncoding ){
 402+ return this.src;
 403+ }
399404 if(!this.end_ntp){
400405 var endvar = '';
401406 }else{
402407 var endvar = '/'+ this.end_ntp;
403 - }
 408+ }
404409 return getURLParamReplace(this.src, { 't': seconds2npt( seek_time_sec )+endvar } ); ;
405410 },
406411 /** Title accessor function.
@@ -423,9 +428,9 @@
424429 * special case derive duration from request url
425430 * supports media_url?t=ntp_start/ntp_end url request format
426431 */
427 - parseURLDuration : function(){
428 - //check if we have a URLTimeEncoding:
429 - if( this.URLTimeEncoding ){
 432+ parseURLDuration : function(){
 433+ //check if we have a URLTimeEncoding:
 434+ if( this.URLTimeEncoding ){
430435 var annoURL = parseUri( this.src );
431436 if( annoURL.queryKey['t'] ){
432437 var times = annoURL.queryKey['t'].split('/');
@@ -437,15 +442,15 @@
438443 //look for this info as attributes
439444 if(this.startOffset){
440445 this.start_offset = this.startOffset;
441 - this.start_ntp = seconds2npt( this.startOffset);
442 - }
 446+ this.start_ntp = seconds2npt( this.startOffset);
 447+ }
443448 if(this.duration){
444449 this.end_ntp = seconds2npt( parseInt(this.duration) + parseInt(this.start_offset) );
445 - }
446 - }
 450+ }
 451+ }
447452 }
448453 //else nothing to parse just keep whatever info we already have
449 -
 454+
450455 //js_log('f:parseURLDuration() for:' + this.src + ' d:' + this.duration);
451456 },
452457 /** Attempts to detect the type of a media file based on the URI.
@@ -485,12 +490,12 @@
486491 mediaElement.prototype =
487492 {
488493 /** The array of mediaSource elements. */
489 - sources:null,
490 - addedROEData:false,
 494+ sources:null,
 495+ addedROEData:false,
491496 /** Selected mediaSource element. */
492497 selected_source:null,
493498 thumbnail:null,
494 - linkback:null,
 499+ linkback:null,
495500
496501 /** @private */
497502 init:function( video_element )
@@ -501,20 +506,23 @@
502507 this.thumbnail = mv_default_thumb_url;
503508 // Process the source element:
504509 if($j(video_element).attr("src"))
505 - this.tryAddSource(video_element);
506 -
 510+ this.tryAddSource(video_element);
 511+
507512 if($j(video_element).attr('thumbnail'))
508513 this.thumbnail = $j(video_element).attr('thumbnail');
509 -
 514+
510515 if($j(video_element).attr('poster'))
511516 this.thumbnail = $j(video_element).attr('poster');
512 -
513 - // Process all inner <source> elements
 517+
 518+ if($j(video_element).attr('wikiTitleKey'))
 519+ this.wikiTitleKey=$j(video_element).attr('wikiTitleKey');
 520+
 521+ // Process all inner <source> elements
514522 //js_log("inner source count: " + video_element.getElementsByTagName('source').length );
515 -
516 - $j(video_element).find('source,text').each(function(inx, inner_source){
 523+
 524+ $j(video_element).find('source,text').each(function(inx, inner_source){
517525 _this.tryAddSource( inner_source );
518 - });
 526+ });
519527 },
520528 /** Updates the time request for all sources that have a standard time request argument (ie &t=start_time/end_time)
521529 */
@@ -526,10 +534,10 @@
527535 },
528536 /*timed Text check*/
529537 timedTextSources:function(){
530 - for(var i=0; i < this.sources.length; i++){
 538+ for(var i=0; i < this.sources.length; i++){
531539 if( this.sources[i].mime_type == 'text/cmml' ||
532540 this.sources[i].mime_type == 'text/x-srt')
533 - return true;
 541+ return true;
534542 };
535543 return false;
536544 },
@@ -540,7 +548,7 @@
541549 {
542550 if(!mime_filter)
543551 return this.sources;
544 - //apply mime filter:
 552+ //apply mime filter:
545553 var source_set = new Array();
546554 for(var i=0; i < this.sources.length ; i++){
547555 if( this.sources[i].mime_type.indexOf( mime_filter ) != -1 )
@@ -548,7 +556,7 @@
549557 }
550558 return source_set;
551559 },
552 - getSourceById:function( source_id ){
 560+ getSourceById:function( source_id ){
553561 for(var i=0; i < this.sources.length ; i++){
554562 if( this.sources[i].id == source_id)
555563 return this.sources[i];
@@ -564,70 +572,70 @@
565573 for(var i=0; i < playable_sources.length; i++){
566574 if( i==index ){
567575 this.selected_source = playable_sources[i];
568 - //update the user selected format:
 576+ //update the user selected format:
569577 embedTypes.players.userSelectFormat( playable_sources[i].mime_type );
570578 break;
571579 }
572 - }
 580+ }
573581 },
574582 /** selects the default source via cookie preference, default marked, or by id order
575583 * */
576 - autoSelectSource:function(){
577 - js_log('f:autoSelectSource:');
578 - //@@todo read user preference for source
 584+ autoSelectSource:function(){
 585+ js_log('f:autoSelectSource:');
 586+ //@@todo read user preference for source
579587 // Select the default source
580 - var playable_sources = this.getPlayableSources();
581 - var flash_flag=ogg_flag=false;
 588+ var playable_sources = this.getPlayableSources();
 589+ var flash_flag=ogg_flag=false;
582590 //debugger;
583591 for(var source=0; source < playable_sources.length; source++){
584592 var mime_type =playable_sources[source].mime_type;
585593 if( playable_sources[source].marked_default ){
586594 js_log('set via marked default: ' + playable_sources[source].marked_default);
587 - this.selected_source = playable_sources[source];
 595+ this.selected_source = playable_sources[source];
588596 return true;
589597 }
590598 //set via user-preference
591599 if(embedTypes.players.preference['format_prefrence'] == mime_type){
592600 js_log('set via preference: '+playable_sources[source].mime_type);
593601 this.selected_source = playable_sources[source];
594 - return true;
595 - }
596 - }
597 - //set Ogg via player support
 602+ return true;
 603+ }
 604+ }
 605+ //set Ogg via player support
598606 for(var source=0; source < playable_sources.length; source++){
599607 js_log('f:autoSelectSource:' + playable_sources[source].mime_type);
600 - var mime_type =playable_sources[source].mime_type;
601 - //set source via player
602 - if(mime_type=='video/ogg' || mime_type=='ogg/video' || mime_type=='video/annodex' || mime_type=='application/ogg'){
 608+ var mime_type =playable_sources[source].mime_type;
 609+ //set source via player
 610+ if(mime_type=='video/ogg' || mime_type=='ogg/video' || mime_type=='video/annodex' || mime_type=='application/ogg'){
603611 for(var i=0; i < embedTypes.players.players.length; i++){ //for in loop on object oky
604 - var player = embedTypes.players.players[i];
 612+ var player = embedTypes.players.players[i];
605613 if(player.library=='vlc' || player.library=='native'){
606 - js_log('set via ogg via order');
607 - this.selected_source = playable_sources[source];
 614+ js_log('set via ogg via order');
 615+ this.selected_source = playable_sources[source];
608616 return true;
609 - }
 617+ }
610618 }
611619 }
612620 }
613621 //set basic flash
614 - for(var source=0; source < playable_sources.length; source++){
615 - var mime_type =playable_sources[source].mime_type;
 622+ for(var source=0; source < playable_sources.length; source++){
 623+ var mime_type =playable_sources[source].mime_type;
616624 if( mime_type=='video/x-flv' ){
617625 js_log('set via by player preference normal flash')
618626 this.selected_source = playable_sources[source];
619627 return true;
620 - }
 628+ }
621629 }
622 - //set h264 flash
623 - for(var source=0; source < playable_sources.length; source++){
624 - var mime_type =playable_sources[source].mime_type;
 630+ //set h264 flash
 631+ for(var source=0; source < playable_sources.length; source++){
 632+ var mime_type =playable_sources[source].mime_type;
625633 if( mime_type=='video/h264' ){
626634 js_log('set via playable_sources preference h264 flash')
627635 this.selected_source = playable_sources[source];
628636 return true;
629 - }
630 - }
631 - //select first source
 637+ }
 638+ }
 639+ //select first source
632640 if (!this.selected_source)
633641 {
634642 js_log('set via first source:' + playable_sources[0]);
@@ -666,48 +674,48 @@
667675 //return mime_type=='video/ogg' || mime_type=='ogg/video' || mime_type=='video/annodex' || mime_type=='video/x-flv';
668676 },
669677 /** Adds a single mediaSource using the provided element if
670 - the element has a 'src' attribute.
 678+ the element has a 'src' attribute.
671679 @param element {element} <video>, <source> or <mediaSource> element.
672680 */
673681 tryAddSource:function(element)
674682 {
675 - js_log('f:tryAddSource:'+ $j(element).attr("src"));
 683+ js_log('f:tryAddSource:'+ $j(element).attr("src"));
676684 if (! $j(element).attr("src")){
677685 //js_log("element has no src");
678686 return false;
679687 }
680688 var new_src = $j(element).attr('src');
681 - //make sure an existing element with the same src does not already exist:
682 - for( var i=0; i < this.sources.length; i++ ){
 689+ //make sure an existing element with the same src does not already exist:
 690+ for( var i=0; i < this.sources.length; i++ ){
683691 if(this.sources[i].src == new_src){
684 - //js_log('checking existing: '+this.sources[i].getURI() + ' != '+ new_src);
685 - //can't add it all but try to update any additional attr:
 692+ //js_log('checking existing: '+this.sources[i].getURI() + ' != '+ new_src);
 693+ //can't add it all but try to update any additional attr:
686694 this.sources[i].updateSource(element);
687695 return false;
688696 }
689697 }
690 - var source = new mediaSource( element );
691 - this.sources.push(source);
 698+ var source = new mediaSource( element );
 699+ this.sources.push(source);
692700 //alert('pushed source to stack'+ source + 'sl:'+this.sources.length);
693701 },
694 - getPlayableSources: function(){
 702+ getPlayableSources: function(){
695703 var playable_sources= new Array();
696 - for(var i=0; i < this.sources.length; i++){
697 - if( this.isPlayableType( this.sources[i].mime_type ) ){
 704+ for(var i=0; i < this.sources.length; i++){
 705+ if( this.isPlayableType( this.sources[i].mime_type ) ){
698706 playable_sources.push( this.sources[i] );
699707 }else{
700708 js_log("type "+ this.sources[i].mime_type + 'is not playable');
701709 }
702 - };
 710+ };
703711 return playable_sources;
704712 },
705713 /* Imports media sources from ROE data.
706714 * @param roe_data ROE data.
707715 */
708 - addROE:function(roe_data){
 716+ addROE:function(roe_data){
709717 js_log('f:addROE');
710718 this.addedROEData=true;
711 - var _this = this;
 719+ var _this = this;
712720 if( typeof roe_data == 'string' )
713721 {
714722 var parser=new DOMParser();
@@ -734,7 +742,7 @@
735743 });
736744 }else{
737745 js_log('ROE data empty.');
738 - }
 746+ }
739747 }
740748 };
741749
@@ -750,7 +758,7 @@
751759 embedVideo.prototype = {
752760 /** The mediaElement object containing all mediaSource objects */
753761 media_element:null,
754 - preview_mode:false,
 762+ preview_mode:false,
755763 ready_to_play:false, //should use html5 ready state
756764 load_error:false, //used to set error in case of error
757765 loading_external_data:false,
@@ -758,19 +766,19 @@
759767 thumbnail_disp:true,
760768 init_with_sources_loadedDone:false,
761769 inDOM:false,
762 - //for onClip done stuff:
 770+ //for onClip done stuff:
763771 anno_data_cache:null,
764772 seek_time_sec:0,
765773 base_seeker_slider_offset:null,
766774 onClipDone_disp:false,
767 - supports:{},
 775+ supports:{},
768776 //for seek thumb updates:
769777 cur_thumb_seek_time:0,
770778 thumb_seek_interval:null,
771 -
 779+
772780 seeking:false,
773 - //set the buffered percent:
774 - bufferedPercent:0,
 781+ //set the buffered percent:
 782+ bufferedPercent:0,
775783 //utility functions for property values:
776784 hx : function ( s ) {
777785 if ( typeof s != 'String' ) {
@@ -799,7 +807,7 @@
800808 else
801809 return parseInt(this.height);
802810 },
803 - init: function(element){
 811+ init: function(element){
804812 //this.element_pointer = element;
805813
806814 //inherit all the default video_attributes
@@ -812,16 +820,16 @@
813821 //js_log('attr:' + attr + ' val: ' + video_attributes[attr] +" "+ 'elm_val:' + element.getAttribute(attr) + "\n (set by attr)");
814822 }
815823 }
816 - //make sure startOffset is cast as an int
 824+ //make sure startOffset is cast as an int
817825 if( this.startOffset && this.startOffset.split(':').length >= 2)
818826 this.startOffset = npt2seconds(this.startOffset);
819 - //make sure offset is in float:
 827+ //make sure offset is in float:
820828 this.startOffset = parseFloat(this.startOffset);
821 -
 829+
822830 if( this.duration && this.duration.split(':').length >= 2)
823 - this.duration = npt2seconds( this.duration );
824 - //make sure duration is in float:
825 - this.duration = parseFloat(this.duration);
 831+ this.duration = npt2seconds( this.duration );
 832+ //make sure duration is in float:
 833+ this.duration = parseFloat(this.duration);
826834 js_log("duration is: " + this.duration);
827835 //if style is set override width and height
828836 var dwh = mwConfig['video_size'].split('x');
@@ -835,114 +843,114 @@
836844 if(element.innerHTML!='' && element.getElementsByTagName('source').length==0){
837845 js_log('innerHTML: ' + element.innerHTML);
838846 this.user_missing_plugin_html=element.innerHTML;
839 - }
 847+ }
840848 // load all of the specified sources
841 - this.media_element = new mediaElement(element);
 849+ this.media_element = new mediaElement(element);
842850 },
843851 on_dom_swap: function(){
844 - js_log('f:on_dom_swap');
 852+ js_log('f:on_dom_swap');
845853 // Process the provided ROE file... if we don't yet have sources
846854 if(this.roe && this.media_element.sources.length==0 ){
847855 js_log('loading external data');
848856 this.loading_external_data=true;
849 - var _this = this;
 857+ var _this = this;
850858 do_request(this.roe, function(data)
851 - {
852 - //continue
853 - _this.media_element.addROE( data );
854 - js_log('added_roe::' + _this.media_element.sources.length);
855 -
856 - js_log('set loading_external_data=false');
857 - _this.loading_external_data=false;
858 -
859 - _this.init_with_sources_loaded();
 859+ {
 860+ //continue
 861+ _this.media_element.addROE( data );
 862+ js_log('added_roe::' + _this.media_element.sources.length);
 863+
 864+ js_log('set loading_external_data=false');
 865+ _this.loading_external_data=false;
 866+
 867+ _this.init_with_sources_loaded();
860868 });
861869 }
862870 },
863871 init_with_sources_loaded : function()
864 - {
 872+ {
865873 js_log('f:init_with_sources_loaded');
866874 //set flag that we have run this function:
867 - this.init_with_sources_loadedDone=true;
 875+ this.init_with_sources_loadedDone=true;
868876 //autoseletct the source
869 - this.media_element.autoSelectSource();
 877+ this.media_element.autoSelectSource();
870878 //auto select player based on prefrence or default order
871879 if( !this.media_element.selected_source )
872880 {
873 - //check for parent clip:
874 - if( typeof this.pc != 'undefined' ){
875 - js_log('no sources, type:' +this.type + ' check for html');
876 - //debugger;
877 - //do load player if just displaying innerHTML:
 881+ //check for parent clip:
 882+ if( typeof this.pc != 'undefined' ){
 883+ js_log('no sources, type:' +this.type + ' check for html');
 884+ //debugger;
 885+ //do load player if just displaying innerHTML:
878886 if( this.pc.type == 'text/html' ){
879887 this.selected_player = embedTypes.players.defaultPlayer( 'text/html' );
880 - js_log('set selected player:'+ this.selected_player.mime_type);
 888+ js_log('set selected player:'+ this.selected_player.mime_type);
881889 }
882890 }
883 - }else{
 891+ }else{
884892 this.selected_player = embedTypes.players.defaultPlayer( this.media_element.selected_source.mime_type );
885 - }
 893+ }
886894 if( this.selected_player ){
887895 js_log('selected ' + this.selected_player.getName());
888896 js_log("PLAYBACK TYPE: "+this.selected_player.library);
889 - this.thumbnail_disp = true;
890 - this.inheritEmbedObj();
891 - }else{
 897+ this.thumbnail_disp = true;
 898+ this.inheritEmbedObj();
 899+ }else{
892900 //no source's playable
893901 var missing_type ='';
894 - var or ='';
 902+ var or ='';
895903 for( var i=0; i < this.media_element.sources.length; i++){
896904 missing_type+= or + this.media_element.sources[i].mime_type;
897905 or=' or ';
898 - }
 906+ }
899907 if( this.pc )
900 - var missing_type = this.pc.type;
 908+ var missing_type = this.pc.type;
901909 js_log('no player found for given source type ' + missing_type);
902 - this.load_error= this.getPluginMissingHTML(missing_type);
903 - }
 910+ this.load_error= this.getPluginMissingHTML(missing_type);
 911+ }
904912 },
905 - inheritEmbedObj:function(){
906 - js_log("inheritEmbedObj:duration is: " + this.duration);
 913+ inheritEmbedObj:function(){
 914+ js_log("inheritEmbedObj:duration is: " + this.duration);
907915 //@@note: tricky cuz direct overwrite is not so ideal.. since the extended object is already tied to the dom
908916 //clear out any non-base embedObj stuff:
909917 if(this.instanceOf){
910918 eval('tmpObj = '+this.instanceOf);
911 - for(var i in tmpObj){ //for in loop oky for object
 919+ for(var i in tmpObj){ //for in loop oky for object
912920 if(this['parent_'+i]){
913921 this[i]=this['parent_'+i];
914922 }else{
915923 this[i]=null;
916924 }
917925 }
918 - }
 926+ }
919927 //set up the new embedObj
920928 js_log('f: inheritEmbedObj: embedding with ' + this.selected_player.library);
921 - var _this = this;
 929+ var _this = this;
922930 this.selected_player.load( function()
923931 {
924 - js_log("selected_player::load:duration is: " + _this.duration);
 932+ js_log("selected_player::load:duration is: " + _this.duration);
925933 //js_log('inheriting '+_this.selected_player.library +'Embed to ' + _this.id + ' ' + $j('#'+_this.id).length);
926934 //var _this = $j('#'+_this.id).get(0);
927935 //js_log( 'type of ' + _this.selected_player.library +'Embed + ' +
928 - // eval('typeof '+_this.selected_player.library +'Embed'));
 936+ // eval('typeof '+_this.selected_player.library +'Embed'));
929937 eval('embedObj = ' +_this.selected_player.library +'Embed;');
930 - for(var method in embedObj){ //for in loop oky for object
 938+ for(var method in embedObj){ //for in loop oky for object
931939 //parent method preservation for local overwritten methods
932940 if(_this[method])
933941 _this['parent_' + method] = _this[method];
934942 _this[method]=embedObj[method];
935943 }
936944 js_log('TYPEOF_ppause: ' + typeof _this['parent_pause']);
937 -
 945+
938946 if(_this.inheritEmbedOverride){
939947 _this.inheritEmbedOverride();
940948 }
941949 //update controls if possible
942950 if(!_this.loading_external_data)
943 - _this.refreshControlsHTML();
944 -
945 - //js_log("READY TO PLAY:"+_this.id);
946 - _this.ready_to_play=true;
 951+ _this.refreshControlsHTML();
 952+
 953+ //js_log("READY TO PLAY:"+_this.id);
 954+ _this.ready_to_play=true;
947955 _this.getDuration();
948956 _this.getHTML();
949957 });
@@ -953,61 +961,61 @@
954962 if(this.selected_player.id != player.id){
955963 this.selected_player = player;
956964 this.inheritEmbedObj();
957 - }
 965+ }
958966 },
959 - doNativeWarningCheck:function(){
 967+ doNativeWarningCheck:function(){
960968 if( $j.cookie('dismissNativeWarn') && $j.cookie('dismissNativeWarn')===true){
961969 return false;
962 - }else{
963 - //see if we have native support for ogg:
964 - var supporting_players = embedTypes.players.getMIMETypePlayers( 'video/ogg' );
 970+ }else{
 971+ //see if we have native support for ogg:
 972+ var supporting_players = embedTypes.players.getMIMETypePlayers( 'video/ogg' );
965973 for(var i=0; i < supporting_players.length; i++){
966974 if(supporting_players[i].id == 'videoElement'){
967975 return false;
968 - }
969 - }
970 - //see if we are using mv_embed without a ogg source in which case no point in promoting firefox :P
 976+ }
 977+ }
 978+ //see if we are using mv_embed without a ogg source in which case no point in promoting firefox :P
971979 if(this.media_element && this.media_element.sources){
972980 var foundOgg = false;
973981 var playable_sources = this.media_element.getPlayableSources();
974 - for(var sInx=0; sInx < playable_sources.length; sInx++){
 982+ for(var sInx=0; sInx < playable_sources.length; sInx++){
975983 var mime_type = playable_sources[sInx].mime_type;
976984 if( mime_type=='video/ogg' ){
977 - //they have flash / h.264 fallback no need to push firefox :(
 985+ //they have flash / h.264 fallback no need to push firefox :(
978986 foundOgg = true;
979987 }
980988 }
981989 //no ogg no point in download firefox
982990 if(!foundOgg)
983991 return false;
984 -
 992+
985993 }
986994 }
987 - return true;
 995+ return true;
988996 },
989997 getTimeReq:function(){
990998 var default_time_req = '0:00:00/' + seconds2npt(this.getDuration());
991999 if(!this.media_element)
9921000 return default_time_req;
9931001 if(!this.media_element.selected_source)
994 - return default_time_req;
 1002+ return default_time_req;
9951003 if(!this.media_element.selected_source.end_ntp)
996 - return default_time_req;
 1004+ return default_time_req;
9971005 return this.media_element.selected_source.start_ntp+'/'+this.media_element.selected_source.end_ntp;
998 - },
999 - getDuration:function(){
1000 - //update some local pointers for the selected source:
1001 - if(this.media_element && this.media_element.selected_source && this.media_element.selected_source.duration){
1002 - this.duration = this.media_element.selected_source.duration;
 1006+ },
 1007+ getDuration:function(){
 1008+ //update some local pointers for the selected source:
 1009+ if(this.media_element && this.media_element.selected_source && this.media_element.selected_source.duration){
 1010+ this.duration = this.media_element.selected_source.duration;
10031011 this.start_offset = this.media_element.selected_source.start_offset;
10041012 this.start_ntp = this.media_element.selected_source.start_ntp;
1005 - this.end_ntp = this.media_element.selected_source.end_ntp;
 1013+ this.end_ntp = this.media_element.selected_source.end_ntp;
10061014 }
1007 - //update start end_ntp if duration !=0 (set from plugin)
 1015+ //update start end_ntp if duration !=0 (set from plugin)
10081016 if(!this.start_ntp)
10091017 this.start_ntp = '0:0:0';
10101018 if(!this.end_ntp && this.duration)
1011 - this.end_ntp = seconds2npt( this.duration );
 1019+ this.end_ntp = seconds2npt( this.duration );
10121020 //return the duration
10131021 return this.duration;
10141022 },
@@ -1015,48 +1023,48 @@
10161024 * wrapEmebedContainer
10171025 * wraps the embed code into a container to better support playlist function
10181026 * (where embed element is swapped for next clip
1019 - * (where plugin method does not support playlsits)
 1027+ * (where plugin method does not support playlsits)
10201028 */
10211029 wrapEmebedContainer:function(embed_code){
10221030 //check if parent clip is set( ie we are in a playlist so name the embed container by playlistID)
10231031 var id = (this.pc!=null)?this.pc.pp.id:this.id;
1024 - return '<div id="mv_ebct_'+id+'" style="width:'+this.width+'px;height:'+this.height+'px;">' +
1025 - embed_code +
 1032+ return '<div id="mv_ebct_'+id+'" style="width:'+this.width+'px;height:'+this.height+'px;">' +
 1033+ embed_code +
10261034 '</div>';
1027 - },
 1035+ },
10281036 getEmbedHTML : function(){
10291037 //return this.wrapEmebedContainer( this.getEmbedObj() );
10301038 return 'function getEmbedHTML should be overitten by embedLib ';
10311039 },
10321040 //do seek function (should be overwritten by implementing embedLibs)
1033 - // first check if seek can be done on locally downloaded content.
1034 - doSeek : function( perc ){
1035 - if( this.supportsURLTimeEncoding() ){
 1041+ // first check if seek can be done on locally downloaded content.
 1042+ doSeek : function( perc ){
 1043+ if( this.supportsURLTimeEncoding() ){
10361044 //make sure this.seek_time_sec is up-to-date:
10371045 this.seek_time_sec = npt2seconds( this.start_ntp ) + parseFloat( perc * this.getDuration() );
10381046 js_log('updated seek_time_sec: ' + seconds2npt ( this.seek_time_sec) );
1039 - this.stop();
 1047+ this.stop();
10401048 this.didSeekJump=true;
10411049 //update the slider
1042 - this.setSliderValue( perc );
1043 - }
1044 - //do play in 100ms (give things time to clear)
 1050+ this.setSliderValue( perc );
 1051+ }
 1052+ //do play in 100ms (give things time to clear)
10451053 setTimeout('$j(\'#' + this.id + '\').get(0).play()',100);
10461054 },
10471055 /*
1048 - * seeks to the requested time and issues a callback when ready
 1056+ * seeks to the requested time and issues a callback when ready
10491057 * (should be overwitten by client that supports frame serving)
1050 - */
 1058+ */
10511059 setCurrentTime:function( time, callback){
10521060 js_log('error: base embed setCurrentTime can not frame serve (overide via plugin)');
10531061 },
10541062 addPresTimeOffset:function(){
1055 - //add in the offset:
 1063+ //add in the offset:
10561064 if(this.seek_time_sec && this.seek_time_sec!=0){
10571065 this.currentTime+=this.seek_time_sec;
1058 - }else if(this.start_offset && this.start_offset!=0){
1059 - this.currentTime = parseFloat(this.currentTime) + parseFloat(this.start_offset);
1060 - }
 1066+ }else if(this.start_offset && this.start_offset!=0){
 1067+ this.currentTime = parseFloat(this.currentTime) + parseFloat(this.start_offset);
 1068+ }
10611069 },
10621070 doEmbedHTML:function()
10631071 {
@@ -1066,90 +1074,179 @@
10671075 this.closeDisplayedHTML();
10681076
10691077 // if(!this.selected_player){
1070 -// return this.getPluginMissingHTML();
 1078+// return this.getPluginMissingHTML();
10711079 //Set "loading" here
10721080 $j('#mv_embedded_player_'+_this.id).html(''+
1073 - '<div style="color:black;width:'+this.width+'px;height:'+this.height+'px;">' +
1074 - gM('mwe-loading_plugin') +
1075 - '</div>'
 1081+ '<div style="color:black;width:'+this.width+'px;height:'+this.height+'px;">' +
 1082+ gM('mwe-loading_plugin') +
 1083+ '</div>'
10761084 );
10771085 // schedule embedding
10781086 this.selected_player.load(function()
10791087 {
1080 - js_log('performing embed for ' + _this.id);
1081 - var embed_code = _this.getEmbedHTML();
 1088+ js_log('performing embed for ' + _this.id);
 1089+ var embed_code = _this.getEmbedHTML();
10821090 //js_log('shopuld embed:' + embed_code);
1083 - $j('#mv_embedded_player_'+_this.id).html(embed_code);
 1091+ $j('#mv_embedded_player_'+_this.id).html(embed_code);
10841092 });
10851093 },
 1094+ mvVideoAudioSearch:function(){
 1095+ var _this = this;
 1096+ js_log('switch video Relational' );
 1097+ var reqObj = {
 1098+ 'action':'query',
 1099+ 'titles': this.wikiTitleKey,
 1100+ 'generator':'categories'
 1101+ };
 1102+ var req_categories= new Array();
 1103+ do_api_req( {
 1104+ 'data':reqObj,
 1105+ 'url': commons_api_url
 1106+ }, function(data){
 1107+ req_categories = Array();
 1108+ if(data.query && data.query.pages){
 1109+ for(var pageid in data.query.pages){
 1110+ if(data.query.pages[pageid].title)
 1111+ req_categories.push(data.query.pages[pageid].title);
 1112+ }
 1113+ }
 1114+ _this.getRelatedFromCat( req_categories );
 1115+ });
 1116+ },
 1117+ getRelatedFromCat:function(catAry){
 1118+ js_log('getRelatedFromCat');
 1119+ var _this = this;
 1120+ for ( var i= 0 ; i <= catAry.length ;i++ ){
 1121+ if(!catAry[i])
 1122+ continue;
 1123+ var reqObj = {
 1124+ 'action' : 'query',
 1125+ 'generator' : 'categorymembers' ,
 1126+ 'gcmtitle' : catAry[i],
 1127+ 'prop' : 'imageinfo',
 1128+ 'iiprop' : 'url',
 1129+ 'iiurlwidth': '80'
 1130+ };
 1131+ do_api_req({
 1132+ 'data':reqObj,
 1133+ 'url': commons_api_url
 1134+ }, function(data){
 1135+ //empty the videos:
 1136+ $j('#dc_'+ _this.id + ' .related_vids ul').html(' ');
 1137+ var leyenda="";
 1138+ var titule="";
 1139+
 1140+ for(var j in data.query.pages){
 1141+ //setup poster default:
 1142+ var local_poster ="http://upload.wikimedia.org/wikipedia/commons/7/79/Wiki-commons.png";
 1143+ //make sure it exists:
 1144+ var page = data.query.pages[j];
 1145+ if( j > 0 && page && page['imageinfo'] ){
 1146+ if( page['imageinfo'][0].thumburl ){
 1147+ local_poster = page['imageinfo'][0].thumburl;
 1148+ }
 1149+ var descriptionurl = page['imageinfo'][0].descriptionurl;
 1150+ var title_str = page.title.replace( /File:|.ogv$|.oga$|.ogg$/gi, "" );
 1151+ //only link to other videos:
 1152+ if ( descriptionurl.match( /\.ogg$|\.ogv$|\.oga$/gi ) != null) {
 1153+ var liout = '<li>' +
 1154+ '<a href="' + descriptionurl + '" >' +
 1155+ '<img src="' + local_poster + '">' +
 1156+ '</a>' +
 1157+ '<div>' +
 1158+ '<a title="' + title_str + '" target="_blank" ' +
 1159+ 'href="'+ descriptionurl +'">' + title_str + '</a>' +
 1160+ '</div>' +
 1161+ '</li>';
 1162+ $j('#dc_'+ _this.id + ' .related_vids ul').append(liout) ;
 1163+ }
 1164+ }
 1165+ };
 1166+ js_log( 'content: ' + $j('#dc_'+ _this.id + ' .related_vids ul').html() );
 1167+ }); //end do_api_req
 1168+ };
 1169+ },
10861170 onClipDone:function(){
1087 - js_log('base:onClipDone');
1088 - //stop the clip (load the thumbnail etc)
1089 - this.stop();
1090 - this.seek_time_sec = 0;
1091 - this.setSliderValue(0);
1092 - var _this = this;
1093 -
1094 - //if the clip resolution is < 320 don't do fancy onClipDone stuff
1095 - if(this.width < 300){
1096 - return ;
1097 - }
1098 - this.onClipDone_disp=true;
1099 - this.thumbnail_disp=true;
1100 - //make sure we are not in preview mode( no end clip actions in preview mode)
1101 - if( this.preview_mode )
1102 - return ;
1103 -
1104 - $j('#img_thumb_'+this.id).css('zindex',1);
1105 - $j('#big_play_link_'+this.id).hide();
1106 - //add the liks_info_div black back
1107 - $j('#dc_'+this.id).append('<div id="liks_info_'+this.id+'" ' +
1108 - 'style="width:' +parseInt(parseInt(this.width)/2)+'px;'+
1109 - 'height:'+ parseInt(parseInt(this.height)) +'px;'+
1110 - 'position:absolute;top:10px;overflow:auto'+
1111 - 'width: '+parseInt( ((parseInt(this.width)/2)-15) ) + 'px;'+
1112 - 'left:'+ parseInt( ((parseInt(this.width)/2)+15) ) +'px;">'+
1113 - '</div>' +
1114 - '<div id="black_back_'+this.id+'" ' +
1115 - 'style="z-index:-2;position:absolute;background:#000;' +
1116 - 'top:0px;left:0px;width:'+parseInt(this.width)+'px;' +
1117 - 'height:'+parseInt(this.height)+'px;">' +
1118 - '</div>'
1119 - );
1120 -
1121 - //start animation (make thumb small in upper left add in div for "loading"
1122 - $j('#img_thumb_'+this.id).animate({
1123 - width:parseInt(parseInt(_this.width)/2),
1124 - height:parseInt(parseInt(_this.height)/2),
1125 - top:20,
1126 - left:10
1127 - },
1128 - 1000,
1129 - function(){
1130 - //animation done.. add "loading" to div if empty
1131 - if($j('#liks_info_'+_this.id).html()==''){
1132 - $j('#liks_info_'+_this.id).html(gM('mwe-loading_txt'));
 1171+ js_log('base:onClipDone');
 1172+ //stop the clip (load the thumbnail etc)
 1173+ this.stop();
 1174+ this.seek_time_sec = 0;
 1175+ this.setSliderValue(0);
 1176+ var _this = this;
 1177+
 1178+ if(this.width < 300){
 1179+ return ;
 1180+ }
 1181+ this.onClipDone_disp=true;
 1182+ this.thumbnail_disp=true;
 1183+ //make sure we are not in preview mode( no end clip actions in preview mode)
 1184+ if( this.preview_mode )
 1185+ return ;
 1186+
 1187+ $j('#img_thumb_'+this.id).css('zindex',1);
 1188+ $j('#big_play_link_'+this.id).hide();
 1189+
 1190+ //add black background
 1191+ $j('#dc_'+this.id).append('<div id="black_back_'+this.id+'" ' +
 1192+ 'style="z-index:-2;position:absolute;background:#000;' +
 1193+ 'top:0px;left:0px;width:'+parseInt(this.width)+'px;' +
 1194+ 'height:'+parseInt(this.height)+'px;">' +
 1195+ '</div>');
 1196+
 1197+ if( this.wikiTitleKey){
 1198+ $j('#dc_'+this.id).append(
 1199+ '<div class="related_vids" >' +
 1200+ '<h1>' + gM('mwe_related_videos') + '</h1>'+
 1201+ '<ul>' +
 1202+ '</ul>' +
 1203+ '</div>');
 1204+ $j('#img_thumb_' + this.id).fadeOut("fast");
 1205+ $j('#dc_'+ _this.id + ' .related_vids ul').html( gM('mwe-loading_txt') );
 1206+ this.mvVideoAudioSearch();
 1207+ }else{
 1208+ //add the liks_info_div black back
 1209+ $j('#dc_'+this.id).append('<div id="liks_info_'+this.id+'" ' +
 1210+ 'style="width:' +parseInt(parseInt(this.width)/2)+'px;'+
 1211+ 'height:'+ parseInt(parseInt(this.height)) +'px;'+
 1212+ 'position:absolute;top:10px;overflow:auto'+
 1213+ 'width: '+parseInt( ((parseInt(this.width)/2)-15) ) + 'px;'+
 1214+ 'left:'+ parseInt( ((parseInt(this.width)/2)+15) ) +'px;">'+
 1215+ '</div>'
 1216+ );
 1217+ //start animation (make thumb small in upper left add in div for "loading"
 1218+ $j('#img_thumb_'+this.id).animate({
 1219+ width:parseInt(parseInt(_this.width)/2),
 1220+ height:parseInt(parseInt(_this.height)/2),
 1221+ top:20,
 1222+ left:10
 1223+ },
 1224+ 1000,
 1225+ function(){
 1226+ //animation done.. add "loading" to div if empty
 1227+ if($j('#liks_info_'+_this.id).html()==''){
 1228+ $j('#liks_info_'+_this.id).html(gM('mwe-loading_txt'));
 1229+ }
 1230+ }
 1231+ )
 1232+ //now load roe if run the showNextPrevLinks
 1233+ if(this.roe && this.media_element.addedROEData==false){
 1234+ do_request(this.roe, function(data)
 1235+ {
 1236+ _this.media_element.addROE(data);
 1237+ _this.getNextPrevLinks();
 1238+ });
 1239+ }else{
 1240+ this.getNextPrevLinks();
11331241 }
1134 - }
1135 - )
1136 - //now load roe if run the showNextPrevLinks
1137 - if(this.roe && this.media_element.addedROEData==false){
1138 - do_request(this.roe, function(data)
1139 - {
1140 - _this.media_element.addROE(data);
1141 - _this.getNextPrevLinks();
1142 - });
1143 - }else{
1144 - this.getNextPrevLinks();
1145 - }
1146 - },
1147 - //@@todo we should merge getNextPrevLinks with textInterface .. there is repeated code between them.
 1242+ }
 1243+ },
 1244+ //@@todo we should merge getNextPrevLinks with textInterface .. there is repeated code between them.
11481245 getNextPrevLinks:function(){
11491246 js_log('f:getNextPrevLinks');
11501247 var anno_track_url = null;
1151 - var _this = this;
 1248+ var _this = this;
11521249 //check for annoative track
1153 - $j.each(this.media_element.sources, function(inx, n){
 1250+ $j.each(this.media_element.sources, function(inx, n){
11541251 if(n.mime_type=='text/cmml'){
11551252 if( n.id == 'Anno_en'){
11561253 anno_track_url = n.src;
@@ -1161,28 +1258,28 @@
11621259 //zero out seconds (should improve cache hit rate and generally expands metadata search)
11631260 //@@todo this could be repalced with a regExp
11641261 var annoURL = parseUri(anno_track_url);
1165 - var times = annoURL.queryKey['t'].split('/');
1166 - var stime_parts = times[0].split(':');
1167 - var etime_parts = times[1].split(':');
 1262+ var times = annoURL.queryKey['t'].split('/');
 1263+ var stime_parts = times[0].split(':');
 1264+ var etime_parts = times[1].split(':');
11681265 //zero out the hour:
11691266 var new_start = stime_parts[0]+':'+'0:0';
11701267 //zero out the end sec
11711268 var new_end = (etime_parts[0]== stime_parts[0])? (etime_parts[0]+1)+':0:0' :etime_parts[0]+':0:0';
1172 -
 1269+
11731270 var etime_parts = times[1].split(':');
1174 -
 1271+
11751272 var new_anno_track_url = annoURL.protocol +'://'+ annoURL.host + annoURL.path +'?';
11761273 $j.each(annoURL.queryKey, function(i, val){
11771274 new_anno_track_url +=(i=='t')?'t='+new_start+'/'+new_end +'&' :
11781275 i+'='+ val+'&';
11791276 });
11801277 var request_key = new_start+'/'+new_end;
1181 - //check the anno_data cache:
1182 - //@@todo search cache see if current is in range.
 1278+ //check the anno_data cache:
 1279+ //@@todo search cache see if current is in range.
11831280 if(this.anno_data_cache){
11841281 js_log('anno data found in cache: '+request_key);
11851282 this.showNextPrevLinks();
1186 - }else{
 1283+ }else{
11871284 do_request(new_anno_track_url, function(cmml_data){
11881285 js_log('raw response: '+ cmml_data);
11891286 if(typeof cmml_data == 'string')
@@ -1193,8 +1290,8 @@
11941291 }
11951292 //init anno_data_cache
11961293 if(!_this.anno_data_cache)
1197 - _this.anno_data_cache={};
1198 - //grab all metadata and put it into the anno_data_cache:
 1294+ _this.anno_data_cache={};
 1295+ //grab all metadata and put it into the anno_data_cache:
11991296 $j.each(cmml_data.getElementsByTagName('clip'), function(inx, clip){
12001297 _this.anno_data_cache[ $j(clip).attr("id") ]={
12011298 'start_time_sec':npt2seconds($j(clip).attr("start").replace('npt:','')),
@@ -1203,32 +1300,32 @@
12041301 };
12051302 //grab all its meta
12061303 _this.anno_data_cache[ $j(clip).attr("id") ]['meta']={};
1207 - $j.each(clip.getElementsByTagName('meta'),function(imx, meta){
 1304+ $j.each(clip.getElementsByTagName('meta'),function(imx, meta){
12081305 //js_log('adding meta: '+ $j(meta).attr("name")+ ' = '+ $j(meta).attr("content"));
12091306 _this.anno_data_cache[$j(clip).attr("id")]['meta'][$j(meta).attr("name")]=$j(meta).attr("content");
12101307 });
12111308 });
1212 - _this.showNextPrevLinks();
 1309+ _this.showNextPrevLinks();
12131310 });
12141311 }
12151312 }else{
12161313 js_log('no annotative track found');
12171314 $j('#liks_info_'+this.id).html('no metadata found for related links');
12181315 }
1219 - //query current request time +|- 60s to get prev next speech links.
 1316+ //query current request time +|- 60s to get prev next speech links.
12201317 },
12211318 showNextPrevLinks:function(){
12221319 //js_log('f:showNextPrevLinks');
1223 - //int requested links:
 1320+ //int requested links:
12241321 var link = {
12251322 'prev':'',
12261323 'current':'',
12271324 'next':''
1228 - }
 1325+ }
12291326 var curTime = this.getTimeReq().split('/');
1230 -
 1327+
12311328 var s_sec = npt2seconds(curTime[0]);
1232 - var e_sec = npt2seconds(curTime[1]);
 1329+ var e_sec = npt2seconds(curTime[1]);
12331330 js_log('showNextPrevLinks: req time: '+ s_sec + ' to ' + e_sec);
12341331 //now we have all the data in anno_data_cache
12351332 var current_done=false;
@@ -1240,52 +1337,52 @@
12411338 link.prev = clip_id;
12421339 js_log('showNextPrevLinks: ' + s_sec + ' < ' + clip.end_time_sec + ' set prev');
12431340 }
1244 -
 1341+
12451342 if(e_sec==clip.end_time_sec && s_sec== clip.start_time_sec)
12461343 current_done = true;
12471344 //current clip is not done:
12481345 if( e_sec < clip.end_time_sec && link.current=='' && !current_done){
12491346 link.current = clip_id;
1250 - js_log('showNextPrevLinks: ' + e_sec + ' < ' + clip.end_time_sec + ' set current');
 1347+ js_log('showNextPrevLinks: ' + e_sec + ' < ' + clip.end_time_sec + ' set current');
12511348 }
1252 -
 1349+
12531350 //set end clip (first clip where start time is > end_time of req
12541351 if( e_sec < clip.start_time_sec && link.next==''){
12551352 link.next = clip_id;
12561353 js_log('showNextPrevLinks: '+ e_sec + ' < '+ clip.start_time_sec + ' && ' + link.next );
12571354 }
1258 - }
1259 - var html='';
 1355+ }
 1356+ var html='';
12601357 if(link.prev=='' && link.current=='' && link.next==''){
12611358 html='<p><a href="'+this.media_element.linkbackgetMsg+'">clip page</a>';
1262 - }else{
 1359+ }else{
12631360 for(var link_type in link){
1264 - var link_id = link[link_type];
 1361+ var link_id = link[link_type];
12651362 if(link_id!=''){
1266 - var clip = this.anno_data_cache[link_id];
 1363+ var clip = this.anno_data_cache[link_id];
12671364 var title_msg='';
12681365 for(var j in clip['meta']){
12691366 title_msg+=j.replace(/_/g,' ') +': ' +clip['meta'][j].replace(/_/g,' ') +" <br>";
1270 - }
 1367+ }
12711368 var time_req = clip.time_req;
1272 - if(link_type=='current') //if current start from end of current clip play to end of current meta:
 1369+ if(link_type=='current') //if current start from end of current clip play to end of current meta:
12731370 time_req = curTime[1]+ '/' + seconds2npt( clip.end_time_sec );
1274 -
1275 - //do special linkbacks for metavid content:
1276 - var regTimeCheck = new RegExp(/[0-9]+:[0-9]+:[0-9]+\/[0-9]+:[0-9]+:[0-9]+/);
 1371+
 1372+ //do special linkbacks for metavid content:
 1373+ var regTimeCheck = new RegExp(/[0-9]+:[0-9]+:[0-9]+\/[0-9]+:[0-9]+:[0-9]+/);
12771374 html+='<p><a ';
12781375 if( regTimeCheck.test( this.media_element.linkback ) ){
1279 - html+=' href="'+ this.media_element.linkback.replace(regTimeCheck,time_req) +'" ';
 1376+ html+=' href="'+ this.media_element.linkback.replace(regTimeCheck,time_req) +'" ';
12801377 }else{
1281 - html+=' href="#" onClick="$j(\'#'+this.id+'\').get(0).playByTimeReq(\''+
1282 - time_req + '\'); return false; "';
 1378+ html+=' href="#" onClick="$j(\'#'+this.id+'\').get(0).playByTimeReq(\''+
 1379+ time_req + '\'); return false; "';
12831380 }
1284 - html+=' title="' + title_msg + '">' +
1285 - gM('mwe-'+link_type+'_clip_msg') +
 1381+ html+=' title="' + title_msg + '">' +
 1382+ gM(link_type+'_clip_msg') +
12861383 '</a><br><span style="font-size:small">'+ title_msg +'<span></p>';
1287 - }
 1384+ }
12881385 }
1289 - }
 1386+ }
12901387 //js_og("should set html:"+ html);
12911388 $j('#liks_info_'+this.id).html(html);
12921389 },
@@ -1293,15 +1390,15 @@
12941391 js_log('f:playByTimeReq: '+time_req );
12951392 this.stop();
12961393 this.updateVideoTimeReq(time_req);
1297 - this.play();
 1394+ this.play();
12981395 },
12991396 doThumbnailHTML:function()
1300 - {
 1397+ {
13011398 var _this = this;
1302 - js_log('f:doThumbnailHTML'+ this.thumbnail_disp);
1303 - this.closeDisplayedHTML();
 1399+ js_log('f:doThumbnailHTML'+ this.thumbnail_disp);
 1400+ this.closeDisplayedHTML();
13041401 $j( '#mv_embedded_player_' + this.id ).html( this.getThumbnailHTML() );
1305 - this.paused = true;
 1402+ this.paused = true;
13061403 this.thumbnail_disp = true;
13071404 },
13081405 refreshControlsHTML:function(){
@@ -1312,40 +1409,40 @@
13131410 return;
13141411 }else{
13151412 $j('#mv_embedded_controls_'+this.id).html( this.getControlsHTML() );
1316 - ctrlBuilder.addControlHooks(this);
1317 - }
1318 - },
 1413+ ctrlBuilder.addControlHooks(this);
 1414+ }
 1415+ },
13191416 getControlsHTML:function()
1320 - {
 1417+ {
13211418 return ctrlBuilder.getControls( this );
1322 - },
1323 - getHTML : function (){
1324 - //@@todo check if we have sources avaliable
1325 - js_log('embedVideo:getHTML : ' + this.id + ' resource type: ' + this.type);
1326 - var _this = this;
1327 - var html_code = '';
1328 - html_code = '<div id="videoPlayer_'+this.id+'" style="width:'+this.width+'px;position:relative;" class="videoPlayer">';
 1419+ },
 1420+ getHTML : function (){
 1421+ //@@todo check if we have sources avaliable
 1422+ js_log('embedVideo:getHTML : ' + this.id + ' resource type: ' + this.type);
 1423+ var _this = this;
 1424+ var html_code = '';
 1425+ html_code = '<div id="videoPlayer_'+this.id+'" style="width:'+this.width+'px;position:relative;" class="videoPlayer">';
13291426 html_code += '<div style="width:'+parseInt(this.width)+'px;height:'+parseInt(this.height)+'px;" id="mv_embedded_player_'+this.id+'">' +
1330 - this.getThumbnailHTML() +
1331 - '</div>';
1332 - //js_log("mvEmbed:controls "+ typeof this.controls);
 1427+ this.getThumbnailHTML() +
 1428+ '</div>';
 1429+ //js_log("mvEmbed:controls "+ typeof this.controls);
13331430 if( this.controls )
13341431 {
13351432 js_log("f:getHTML:AddControls");
13361433 html_code +='<div id="mv_embedded_controls_' + this.id + '" class="ui-widget ui-corner-bottom ui-state-default controls" >';
1337 - html_code += this.getControlsHTML();
1338 - html_code +='</div>';
1339 - //block out some space by encapulating the top level div
 1434+ html_code += this.getControlsHTML();
 1435+ html_code +='</div>';
 1436+ //block out some space by encapulating the top level div
13401437 $j(this).wrap('<div style="width:'+parseInt(this.width)+'px;height:'
1341 - +(parseInt(this.height)+ctrlBuilder.height)+'px"></div>');
 1438+ +(parseInt(this.height)+ctrlBuilder.height)+'px"></div>');
13421439 }
1343 - html_code += '</div>'; //videoPlayer div close
 1440+ html_code += '</div>'; //videoPlayer div close
13441441 //js_log('should set: '+this.id);
1345 - $j(this).html( html_code );
 1442+ $j(this).html( html_code );
13461443 //add hooks once Controls are in DOM
1347 - ctrlBuilder.addControlHooks(this);
1348 -
1349 - //js_log('set this to: ' + $j(this).html() );
 1444+ ctrlBuilder.addControlHooks(this);
 1445+
 1446+ //js_log('set this to: ' + $j(this).html() );
13501447 //alert('stop');
13511448 //if auto play==true directly embed the plugin
13521449 if(this.autoplay)
@@ -1375,7 +1472,7 @@
13761473 this.updateVideoTime(time_parts[0], time_parts[1]);
13771474 },
13781475 //update video time
1379 - updateVideoTime:function(start_ntp, end_ntp){
 1476+ updateVideoTime:function(start_ntp, end_ntp){
13801477 //update media
13811478 this.media_element.updateSourceTimes( start_ntp, end_ntp );
13821479 //update mv_time
@@ -1387,11 +1484,11 @@
13881485 this.seek_time_sec=0;
13891486 else
13901487 this.seek_time_sec=npt2seconds(start_ntp);
1391 - },
1392 - //@@todo overwite by embed library if we can render frames natavily
 1488+ },
 1489+ //@@todo overwite by embed library if we can render frames natavily
13931490 renderTimelineThumbnail:function( options ){
13941491 var my_thumb_src = this.media_element.getThumbnailURL();
1395 - //check if our thumbnail has a time attribute:
 1492+ //check if our thumbnail has a time attribute:
13961493 if( my_thumb_src.indexOf('t=') !== -1){
13971494 var time_ntp = seconds2npt ( options.time + parseInt(this.start_offset) );
13981495 my_thumb_src = getURLParamReplace( my_thumb_src, { 't':time_ntp, 'size': options.size } );
@@ -1399,7 +1496,7 @@
14001497 var thumb_class = (typeof options['thumb_class'] != 'undefined' ) ? options['thumb_class'] : '';
14011498 return '<div class="ui-corner-all ' + thumb_class + '" src="' + my_thumb_src + '" '+
14021499 'style="height:' + options.height + 'px;' +
1403 - 'width:' + options.width + 'px" >' +
 1500+ 'width:' + options.width + 'px" >' +
14041501 '<img src="' + my_thumb_src +'" '+
14051502 'style="height:' + options.height + 'px;' +
14061503 'width:' + options.width + 'px">' +
@@ -1410,58 +1507,58 @@
14111508 },
14121509 updateThumbTime:function( float_sec ){
14131510 //js_log('updateThumbTime:'+float_sec);
1414 - var _this = this;
1415 - if( typeof this.org_thum_src=='undefined' ){
 1511+ var _this = this;
 1512+ if( typeof this.org_thum_src=='undefined' ){
14161513 this.org_thum_src = this.media_element.getThumbnailURL();
1417 - }
 1514+ }
14181515 if( this.org_thum_src.indexOf('t=') !== -1){
1419 - this.last_thumb_url = getURLParamReplace(this.org_thum_src,
1420 - { 't' : seconds2npt( float_sec + parseInt(this.start_offset)) } );
1421 - if(!this.thumbnail_updating){
 1516+ this.last_thumb_url = getURLParamReplace(this.org_thum_src,
 1517+ { 't' : seconds2npt( float_sec + parseInt(this.start_offset)) } );
 1518+ if(!this.thumbnail_updating){
14221519 this.updateThumbnail(this.last_thumb_url ,false);
14231520 this.last_thumb_url =null;
14241521 }
14251522 }
14261523 },
14271524 //for now provide a src url .. but need to figure out how to copy frames from video for plug-in based thumbs
1428 - updateThumbPerc:function( perc ){
 1525+ updateThumbPerc:function( perc ){
14291526 return this.updateThumbTime( (this.getDuration() * perc) );
14301527 },
14311528 //updates the thumbnail if the thumbnail is being displayed
1432 - updateThumbnail : function(src, quick_switch){
1433 - //make sure we don't go to the same url if we are not already updating:
 1529+ updateThumbnail : function(src, quick_switch){
 1530+ //make sure we don't go to the same url if we are not already updating:
14341531 if( !this.thumbnail_updating && $j('#img_thumb_'+this.id).attr('src')== src )
14351532 return false;
1436 - //if we are already updating don't issue a new update:
 1533+ //if we are already updating don't issue a new update:
14371534 if( this.thumbnail_updating && $j('#new_img_thumb_'+this.id).attr('src')== src )
14381535 return false;
1439 -
 1536+
14401537 js_log('update thumb: ' + src);
1441 -
 1538+
14421539 if(quick_switch){
14431540 $j('#img_thumb_'+this.id).attr('src', src);
14441541 }else{
1445 - var _this = this;
 1542+ var _this = this;
14461543 //if still animating remove new_img_thumb_
14471544 if(this.thumbnail_updating==true)
1448 - $j('#new_img_thumb_'+this.id).stop().remove();
1449 -
 1545+ $j('#new_img_thumb_'+this.id).stop().remove();
 1546+
14501547 if(this.thumbnail_disp){
14511548 js_log('set to thumb:'+ src);
14521549 this.thumbnail_updating=true;
14531550 $j('#dc_'+this.id).append('<img src="'+src+'" ' +
14541551 'style="display:none;position:absolute;zindex:2;top:0px;left:0px;" ' +
14551552 'width="'+this.width+'" height="'+this.height+'" '+
1456 - 'id = "new_img_thumb_'+this.id+'" />');
1457 - //js_log('appended: new_img_thumb_');
1458 - $j('#new_img_thumb_'+this.id).fadeIn("slow", function(){
 1553+ 'id = "new_img_thumb_'+this.id+'" />');
 1554+ //js_log('appended: new_img_thumb_');
 1555+ $j('#new_img_thumb_'+this.id).fadeIn("slow", function(){
14591556 //once faded in remove org and rename new:
14601557 $j('#img_thumb_'+_this.id).remove();
14611558 $j('#new_img_thumb_'+_this.id).attr('id', 'img_thumb_'+_this.id);
14621559 $j('#img_thumb_'+_this.id).css('zindex','1');
1463 - _this.thumbnail_updating=false;
 1560+ _this.thumbnail_updating=false;
14641561 //js_log("done fadding in "+ $j('#img_thumb_'+_this.id).attr("src"));
1465 -
 1562+
14661563 //if we have a thumb queued update to that
14671564 if(_this.last_thumb_url){
14681565 var src_url =_this.last_thumb_url;
@@ -1478,7 +1575,7 @@
14791576 download, and embed code.
14801577 */
14811578 getThumbnailHTML : function ()
1482 - {
 1579+ {
14831580 js_log('embedVideo:getThumbnailHTML::' + this.id);
14841581 var thumb_html = '';
14851582 var class_atr='';
@@ -1493,10 +1590,10 @@
14941591 ' overflow:hidden; top:0px; left:0px; width:'+this.playerPixelWidth()+'px; height:'+this.playerPixelHeight()+'px; z-index:0;">'+
14951592 '<img width="'+this.playerPixelWidth()+'" height="'+this.playerPixelHeight()+'" style="position:relative;width:'+this.playerPixelWidth()+';height:'+this.playerPixelHeight()+'"' +
14961593 ' id="img_thumb_'+this.id+'" src="' + this.thumbnail + '">';
1497 -
 1594+
14981595 if(this.play_button == true && this.controls == true)
14991596 thumb_html+=this.getPlayButton();
1500 -
 1597+
15011598 thumb_html+='</div>';
15021599 return thumb_html;
15031600 },
@@ -1550,16 +1647,16 @@
15511648 this.displayHTML(gM('mwe-loading_txt'));
15521649 do_request(this.roe, function(data)
15531650 {
1554 - _this.media_element.addROE(data);
 1651+ _this.media_element.addROE(data);
15551652 _this.doLinkBack();
1556 - });
 1653+ });
15571654 }else{
1558 - if(this.media_element.linkback){
 1655+ if(this.media_element.linkback){
15591656 window.location = this.media_element.linkback;
15601657 }else{
15611658 this.displayHTML(gM('mwe-could_not_find_linkback'));
15621659 }
1563 - }
 1660+ }
15641661 },
15651662 //display the code to remotely embed this video:
15661663 showEmbedCode : function(embed_code){
@@ -1584,42 +1681,42 @@
15851682 this.displayHTML(o);
15861683 },
15871684 copyText:function(){
1588 - $j('#embedding_user_html_'+this.id).focus().select();
1589 - if(document.selection){
1590 - CopiedTxt = document.selection.createRange();
 1685+ $j('#embedding_user_html_'+this.id).focus().select();
 1686+ if(document.selection){
 1687+ CopiedTxt = document.selection.createRange();
15911688 CopiedTxt.execCommand("Copy");
15921689 }
15931690 },
1594 - showTextInterface:function(){
 1691+ showTextInterface:function(){
15951692 var _this = this;
1596 - //display the text container with loading text:
 1693+ //display the text container with loading text:
15971694 //@@todo support position config
1598 - var loc = $j(this).position();
 1695+ var loc = $j(this).position();
15991696 if($j('#metaBox_'+this.id).length==0){
16001697 $j(this).after('<div class="ui-widget ui-widget-content ui-corner-all" style="position:absolute;z-index:10;'+
16011698 'top:' + (loc.top) + 'px;' +
16021699 'left:' + (parseInt( loc.left ) + parseInt(this.width) + 10 )+'px;' +
1603 - 'height:'+ parseInt( this.height )+'px;width:400px;' +
 1700+ 'height:'+ parseInt( this.height )+'px;width:400px;' +
16041701 'display:none;" ' +
16051702 'id="metaBox_' + this.id + '">'+
16061703 gM('mwe-loading_txt') +
1607 - '</div>');
 1704+ '</div>');
16081705 }
16091706 //fade in the text display
1610 - $j('#metaBox_'+this.id).fadeIn("fast");
 1707+ $j('#metaBox_'+this.id).fadeIn("fast");
16111708 //check if textObj present:
16121709 if(typeof this.textInterface == 'undefined' ){
16131710 //load the default text interface:
16141711 mvJsLoader.doLoad([
1615 - 'mvTextInterface',
 1712+ 'mvTextInterface',
16161713 '$j.fn.hoverIntent'
1617 - ], function(){
1618 - _this.textInterface = new mvTextInterface( _this );
 1714+ ], function(){
 1715+ _this.textInterface = new mvTextInterface( _this );
16191716 //show interface
16201717 _this.textInterface.show();
16211718 js_log("NEW TEXT INTERFACE");
16221719 for(var i in _this.textInterface.availableTracks){
1623 - js_log("tracks in new interface: "+_this.id+ ' tid:' + i);
 1720+ js_log("tracks in new interface: "+_this.id+ ' tid:' + i);
16241721 }
16251722 }
16261723 );
@@ -1636,26 +1733,26 @@
16371734 },
16381735 /** Generic function to display custom HTML inside the mv_embed element.
16391736 The code should call the closeDisplayedHTML function to close the
1640 - display of the custom HTML and restore the regular mv_embed display.
 1737+ display of the custom HTML and restore the regular mv_embed display.
16411738 @param {String} HTML code for the selection list.
16421739 */
16431740 displayHTML:function(html_code)
16441741 {
16451742 var sel_id = (this.pc!=null)?this.pc.pp.id:this.id;
1646 -
 1743+
16471744 if(!this.supports['overlays'])
16481745 this.stop();
1649 -
 1746+
16501747 //put select list on-top
16511748 //make sure the parent is relatively positioned:
16521749 $j('#'+sel_id).css('position', 'relative');
16531750 //set height width (check for playlist container)
16541751 var width = (this.pc)?this.pc.pp.width:this.playerPixelWidth();
16551752 var height = (this.pc)?this.pc.pp.height:this.playerPixelHeight();
1656 -
 1753+
16571754 if(this.pc)
16581755 height+=(this.pc.pp.pl_layout.title_bar_height + this.pc.pp.pl_layout.control_height);
1659 -
 1756+
16601757 var fade_in = true;
16611758 if($j('#blackbg_'+sel_id).length!=0)
16621759 {
@@ -1667,11 +1764,11 @@
16681765 'style="height:'+parseInt(height)+'px;width:'+parseInt(width)+'px;">'+
16691766 '<div class="videoOptionsComplete">'+
16701767 //@@TODO: this style should go to .css
1671 - '<span style="float:right;margin-right:10px">' +
 1768+ '<span style="float:right;margin-right:10px">' +
16721769 '<a href="#" style="color:white;" onClick="$j(\'#'+sel_id+'\').get(0).closeDisplayedHTML();return false;">close</a>' +
16731770 '</span>'+
16741771 '<div id="mv_disp_inner_'+sel_id+'" style="padding-top:10px;">'+
1675 - html_code
 1772+ html_code
16761773 +'</div>'+
16771774 '</div></div>';
16781775 $j('#'+sel_id).prepend(div_code);
@@ -1691,43 +1788,43 @@
16921789 });
16931790 return false; //onclick action return false
16941791 },
1695 - selectPlaybackMethod:function(){
 1792+ selectPlaybackMethod:function(){
16961793 //get id (in case where we have a parent container)
16971794 var this_id = (this.pc!=null)?this.pc.pp.id:this.id;
1698 -
1699 - var _this=this;
 1795+
 1796+ var _this=this;
17001797 var out= '<span style="color:#FFF;background-color:black;"><blockquote style="background-color:black;">';
17011798 var _this=this;
17021799 //js_log('selected src'+ _this.media_element.selected_source.url);
1703 - $j.each( this.media_element.getPlayableSources(), function(source_id, source){
1704 - var default_player = embedTypes.players.defaultPlayer( source.getMIMEType() );
1705 -
 1800+ $j.each( this.media_element.getPlayableSources(), function(source_id, source){
 1801+ var default_player = embedTypes.players.defaultPlayer( source.getMIMEType() );
 1802+
17061803 var is_selected = (source == _this.media_element.selected_source);
17071804 var image_src = mv_skin_img_path ;
1708 -
1709 - //set the Playable source type:
 1805+
 1806+ //set the Playable source type:
17101807 if( source.mime_type == 'video/x-flv' ){
17111808 image_src += 'flash_icon_';
17121809 }else if( source.mime_type == 'video/h264'){
1713 - //for now all mp4 content is pulled from archive.org (so use archive.org icon)
 1810+ //for now all mp4 content is pulled from archive.org (so use archive.org icon)
17141811 image_src += 'archive_org_';
17151812 }else{
17161813 image_src += 'fish_xiph_org_';
17171814 }
17181815 image_src += is_selected ? 'color':'bw';
1719 - image_src += '.png';
1720 -
 1816+ image_src += '.png';
 1817+
17211818 if (default_player)
17221819 {
17231820 out += '<img src="'+image_src+'"/>';
17241821 if( ! is_selected )
17251822 out+='<a href="#" class="sel_source" id="sc_' + source_id + '_' + default_player.id +'">';
17261823 out += source.getTitle()+ (is_selected?'</a>':'') + ' ';
1727 -
1728 - //output the player select code:
1729 - var supporting_players = embedTypes.players.getMIMETypePlayers( source.getMIMEType() );
 1824+
 1825+ //output the player select code:
 1826+ var supporting_players = embedTypes.players.getMIMETypePlayers( source.getMIMEType() );
17301827 out+='<div id="player_select_list_' + source_id + '" class="player_select_list"><ul>';
1731 - for(var i=0; i < supporting_players.length ; i++){
 1828+ for(var i=0; i < supporting_players.length ; i++){
17321829 if( _this.selected_player.id == supporting_players[i].id && is_selected ){
17331830 out+='<li style="border-style:dashed;margin-left:20px;">'+
17341831 '<img border="0" width="16" height="16" src="' + mv_skin_img_path + 'plugin.png">' +
@@ -1743,36 +1840,36 @@
17441841 '</li>';
17451842 }
17461843 }
1747 - out+='</ul></div>';
 1844+ out+='</ul></div>';
17481845 }else
17491846 out+= source.getTitle() + ' - no player available';
17501847 });
17511848 out+='</blockquote></span>';
17521849 this.displayHTML(out);
1753 -
 1850+
17541851 //set up the click bindings:
17551852 $j('.sel_source').each(function(){
17561853 $j(this).click(function(){
17571854 var iparts = $j(this).attr( 'id' ).replace(/sc_/,'').split('_');
17581855 var source_id = iparts[0];
17591856 var default_player_id = iparts[1];
1760 - js_log('source id: ' + source_id + ' player id: ' + default_player_id);
1761 -
1762 - $j('#' + this_id ).get(0).closeDisplayedHTML();
 1857+ js_log('source id: ' + source_id + ' player id: ' + default_player_id);
 1858+
 1859+ $j('#' + this_id ).get(0).closeDisplayedHTML();
17631860 $j('#' + _this.id ).get(0).media_element.selectSource( source_id );
1764 -
 1861+
17651862 embedTypes.players.userSelectPlayer( default_player_id,
17661863 _this.media_element.sources[ source_id ].getMIMEType() );
1767 -
 1864+
17681865 //be sure to issue a stop
17691866 $j('#' + this_id ).get(0).stop();
1770 -
 1867+
17711868 //don't follow the empty # link:
17721869 return false;
17731870 });
17741871 });
1775 - },
1776 - showVideoDownload:function(){
 1872+ },
 1873+ showVideoDownload:function(){
17771874 //load the roe if available (to populate out download options:
17781875 //js_log('f:showVideoDownload '+ this.roe + ' ' + this.media_element.addedROEData);
17791876 if(this.roe && this.media_element.addedROEData == false){
@@ -1780,23 +1877,23 @@
17811878 this.displayHTML(gM('mwe-loading_txt'));
17821879 do_request(this.roe, function(data)
17831880 {
1784 - _this.media_element.addROE(data);
 1881+ _this.media_element.addROE(data);
17851882 $j('#mv_disp_inner_'+_this.id).html( _this.getShowVideoDownload() );
1786 - });
 1883+ });
17871884 }else{
17881885 this.displayHTML( this.getShowVideoDownload() );
1789 - }
 1886+ }
17901887 },
1791 - getShowVideoDownload:function(){
 1888+ getShowVideoDownload:function(){
17921889 var out='<div style="color:white">' +
17931890 '<b style="color:white;">'+gM('mwe-download_segment')+'</b><br>';
17941891 out+='<blockquote style="background:#000">'+
17951892 gM('mwe-download_right_click') + '</blockquote><br>';
17961893 var dl_list='';
1797 - var dl_txt_list='';
 1894+ var dl_txt_list='';
17981895 $j.each(this.media_element.getSources(), function(index, source){
17991896 var dl_line = '<li>' + '<a style="color:white" href="' + source.getURI() +'"> '
1800 - + source.getTitle()+'</a> '+ '</li>'+"\n";
 1897+ + source.getTitle()+'</a> '+ '</li>'+"\n";
18011898 if( source.getURI().indexOf('?t=')!==-1){
18021899 out+=dl_line;
18031900 }else if( this.getMIMEType()=="text/cmml" || this.getMIMEType()=="text/x-srt" ){
@@ -1804,8 +1901,8 @@
18051902 }else{
18061903 dl_list+=dl_line;
18071904 }
1808 - });
1809 -
 1905+ });
 1906+
18101907 if(dl_list!='')
18111908 out+=gM('mwe-download_full') + '<blockquote style="background:#000">' + dl_list + '</blockquote>';
18121909 if(dl_txt_list!='')
@@ -1819,11 +1916,11 @@
18201917 */
18211918 play:function(){
18221919 var this_id = (this.pc!=null)?this.pc.pp.id:this.id;
1823 -
1824 - //js_log( "mv_embed play:" + this.id);
 1920+
 1921+ //js_log( "mv_embed play:" + this.id);
18251922 //js_log('thum disp:'+this.thumbnail_disp);
18261923 //check if thumbnail is being displayed and embed html
1827 - if( this.thumbnail_disp ){
 1924+ if( this.thumbnail_disp ){
18281925 if( !this.selected_player ){
18291926 js_log('no selected_player');
18301927 //this.innerHTML = this.getPluginMissingHTML();
@@ -1831,21 +1928,21 @@
18321929 $j('#'+this.id).html( this.getPluginMissingHTML() );
18331930 }else{
18341931 this.doEmbedHTML();
1835 - this.onClipDone_disp=false;
1836 - this.paused=false;
1837 - this.thumbnail_disp=false;
 1932+ this.onClipDone_disp=false;
 1933+ this.paused=false;
 1934+ this.thumbnail_disp=false;
18381935 }
18391936 }else{
1840 - //the plugin is already being displayed
 1937+ //the plugin is already being displayed
18411938 this.paused=false; //make sure we are not "paused"
18421939 this.seeking=false;
1843 - }
1844 -
1845 - $j("#mv_play_pause_button_" + this_id + ' span').removeClass('ui-icon-play').addClass('ui-icon-pause');
1846 - $j("#mv_play_pause_button_" + this_id).unbind().btnBind().click(function(){
 1940+ }
 1941+
 1942+ $j("#mv_play_pause_button_" + this_id + ' span').removeClass('ui-icon-play').addClass('ui-icon-pause');
 1943+ $j("#mv_play_pause_button_" + this_id).unbind().btnBind().click(function(){
18471944 $j('#' + this_id ).get(0).pause();
18481945 }).attr('title', gM('mwe-pause_clip'));
1849 -
 1946+
18501947 },
18511948 load:function(){
18521949 //should be done by child (no base way to load assets)
@@ -1853,41 +1950,41 @@
18541951 },
18551952 getSrc:function(){
18561953 return this.media_element.selected_source.getURI( this.seek_time_sec );
1857 - },
 1954+ },
18581955 /*
18591956 * base embed pause
18601957 * there is no general way to pause the video
18611958 * must be overwritten by embed object to support this functionality.
18621959 */
18631960 pause: function(){
1864 - var this_id = (this.pc!=null)?this.pc.pp.id:this.id;
1865 - //js_log('mv_embed:do pause');
1866 - //(playing) do pause
1867 - this.paused = true;
1868 - //update the ctrl "paused state"
 1961+ var this_id = (this.pc!=null)?this.pc.pp.id:this.id;
 1962+ //js_log('mv_embed:do pause');
 1963+ //(playing) do pause
 1964+ this.paused = true;
 1965+ //update the ctrl "paused state"
18691966 $j("#mv_play_pause_button_" + this_id + ' span').removeClass('ui-icon-pause').addClass('ui-icon-play');
1870 - $j("#mv_play_pause_button_" + this_id).unbind().btnBind().click(function(){
 1967+ $j("#mv_play_pause_button_" + this_id).unbind().btnBind().click(function(){
18711968 $j('#'+this_id).get(0).play();
18721969 }).attr('title', gM('mwe-play_clip'));
1873 - },
 1970+ },
18741971 /*
18751972 * base embed stop (can be overwritten by the plugin)
18761973 */
18771974 stop: function(){
18781975 var _this = this;
18791976 js_log('mvEmbed:stop:'+this.id);
1880 -
 1977+
18811978 //no longer seeking:
18821979 this.didSeekJump=false;
1883 -
1884 - //first issue pause to update interface (only call the parent)
 1980+
 1981+ //first issue pause to update interface (only call the parent)
18851982 if(this['parent_pause']){
18861983 this.parent_pause();
18871984 }else{
18881985 this.pause();
1889 - }
1890 -
1891 - //reset the currentTime:
 1986+ }
 1987+
 1988+ //reset the currentTime:
18921989 this.currentTime=0;
18931990 //check if thumbnail is being displayed in which case do nothing
18941991 if( this.thumbnail_disp ){
@@ -1900,12 +1997,12 @@
19011998 this.setSliderValue(0);
19021999 this.setStatus( this.getTimeReq() );
19032000 }
1904 -
1905 - //make sure the big playbutton is has click action:
 2001+
 2002+ //make sure the big playbutton is has click action:
19062003 $j('#big_play_link_' + _this.id).unbind('click').click(function(){
19072004 $j('#' +_this.id).get(0).play();
19082005 });
1909 -
 2006+
19102007 if(this.update_interval)
19112008 {
19122009 clearInterval(this.update_interval);
@@ -1913,19 +2010,19 @@
19142011 }
19152012 },
19162013 toggleMute:function(){
1917 - var this_id = (this.pc!=null)?this.pc.pp.id:this.id;
 2014+ var this_id = (this.pc!=null)?this.pc.pp.id:this.id;
19182015 if(this.muted){
19192016 this.muted=false;
19202017 $j('#volume_control_'+this_id + ' span').removeClass('ui-icon-volume-off').addClass('ui-icon-volume-on');
1921 - $j('#volume_bar_'+this_id).slider('value', 100);
 2018+ $j('#volume_bar_'+this_id).slider('value', 100);
19222019 this.updateVolumen(1);
19232020 }else{
19242021 this.muted=true;
19252022 $j('#volume_control_'+this_id + ' span').removeClass('ui-icon-volume-on').addClass('ui-icon-volume-off');
19262023 $j('#volume_bar_'+this_id).slider('value', 0);
1927 - this.updateVolumen(0);
 2024+ this.updateVolumen(0);
19282025 }
1929 - js_log('f:toggleMute::' + this.muted);
 2026+ js_log('f:toggleMute::' + this.muted);
19302027 },
19312028 updateVolumen:function(perc){
19322029 js_log('update volume not supported with current playback type');
@@ -1959,19 +2056,19 @@
19602057 postEmbedJS:function(){
19612058 return '';
19622059 },
1963 - //do common monitor code like update the playhead and play status
 2060+ //do common monitor code like update the playhead and play status
19642061 //plugin objects are responsible for updating currentTime
19652062 monitor:function(){
19662063 if( this.currentTime && this.currentTime > 0 && this.duration){
19672064 if( !this.userSlide ){
1968 - if( this.start_offset ){
1969 - //if start offset include that calculation
1970 - this.setSliderValue( ( this.currentTime - this.start_offset ) / this.duration );
1971 - this.setStatus( seconds2npt(this.currentTime) + '/'+ seconds2npt(parseFloat(this.start_offset)+parseFloat(this.duration) ));
 2065+ if( this.start_offset ){
 2066+ //if start offset include that calculation
 2067+ this.setSliderValue( ( this.currentTime - this.start_offset ) / this.duration );
 2068+ this.setStatus( seconds2npt(this.currentTime) + '/'+ seconds2npt(parseFloat(this.start_offset)+parseFloat(this.duration) ));
19722069 }else{
19732070 this.setSliderValue( this.currentTime / this.duration );
19742071 this.setStatus( seconds2npt(this.currentTime) + '/' + seconds2npt(this.duration ));
1975 - }
 2072+ }
19762073 }
19772074 }else{
19782075 //js_log(' ct:' + this.currentTime + ' dur: ' + this.duration);
@@ -1980,25 +2077,30 @@
19812078 }else if( this.isPaused() ){
19822079 this.setStatus( "paused" );
19832080 }else if( this.isPlaying() ){
1984 - if( this.currentTime && ! this.duration )
 2081+ if( this.currentTime && ! this.duration )
19852082 this.setStatus( seconds2npt( this.currentTime ) + ' /' );
1986 - else
 2083+ else
19872084 this.setStatus(" - - - ");
19882085 }else{
19892086 this.setStatus( this.getTimeReq() );
1990 - }
 2087+ }
19912088 }
1992 - //update buffer information
 2089+ //update buffer information
19932090 this.updateBufferStatus();
1994 -
 2091+
 2092+ //check if we passed duration
 2093+ if( this.duration && (this.currentTime > this.duration) ){
 2094+ this.onClipDone();
 2095+ }
 2096+
19952097 //update monitorTimerId to call child monitor
19962098 if( ! this.monitorTimerId ){
1997 - //make sure an instance of this.id exists:
 2099+ //make sure an instance of this.id exists:
19982100 if( document.getElementById(this.id) ){
19992101 this.monitorTimerId = setInterval('$j(\'#'+this.id+'\').get(0).monitor()', 250);
20002102 }
20012103 }
2002 - },
 2104+ },
20032105 stopMonitor:function(){
20042106 if( this.monitorTimerId != 0 )
20052107 {
@@ -2007,18 +2109,18 @@
20082110 }
20092111 },
20102112 updateBufferStatus: function(){
2011 -
2012 - //build the buffer targeet based for playlist vs clip
2013 - var buffer_select = (this.pc) ?
2014 - '#cl_status_' + this.id + ' .mv_buffer':
 2113+
 2114+ //build the buffer targeet based for playlist vs clip
 2115+ var buffer_select = (this.pc) ?
 2116+ '#cl_status_' + this.id + ' .mv_buffer':
20152117 '#mv_play_head_' + this.id + ' .mv_buffer';
2016 -
 2118+
20172119 //update the buffer progress bar (if available )
20182120 if( this.bufferedPercent != 0 ){
2019 - //js_log('bufferedPercent: ' + this.bufferedPercent);
 2121+ //js_log('bufferedPercent: ' + this.bufferedPercent);
20202122 if(this.bufferedPercent > 1)
2021 - this.bufferedPercent=1;
2022 -
 2123+ this.bufferedPercent=1;
 2124+
20232125 $j(buffer_select).css("width", (this.bufferedPercent*100) +'%' );
20242126 }else{
20252127 $j(buffer_select).css("width", '0px' );
@@ -2028,7 +2130,7 @@
20292131 if(!this.start_offset)
20302132 this.start_offset =0;
20312133 var rt = this.currentTime - this.start_offset;
2032 - if( rt < 0 ) //should not happen but does.
 2134+ if( rt < 0 ) //should not happen but does.
20332135 return 0;
20342136 return rt;
20352137 },
@@ -2044,7 +2146,7 @@
20452147 }
20462148 return null;
20472149 },
2048 - //HELPER Functions for selected source
 2150+ //HELPER Functions for selected source
20492151 /*
20502152 * returns the selected source url for players to play
20512153 */
@@ -2055,12 +2157,12 @@
20562158 //do head request if on the same domain
20572159 return this.media_element.selected_source.URLTimeEncoding;
20582160 },
2059 - setSliderValue: function(perc, hide_progress){
2060 - if(this.controls){
 2161+ setSliderValue: function(perc, hide_progress){
 2162+ if(this.controls){
20612163 var this_id = (this.pc)?this.pc.pp.id:this.id;
2062 - var val = parseInt( perc*1000 );
 2164+ var val = parseInt( perc*1000 );
20632165 $j('#mv_play_head_'+this_id).slider('value', val);
2064 -
 2166+
20652167 //js_log("embed video set: " + '#mv_play_head_'+this_id + ' to ' + val);
20662168 }
20672169 //js_log('set#mv_seeker_slider_'+this_id + ' perc in: ' + perc + ' * ' + $j('#mv_seeker_'+this_id).width() + ' = set to: '+ val + ' - '+ Math.round(this.mv_seeker_width*perc) );
@@ -2070,44 +2172,44 @@
20712173 js_log('highlightPlaySection');
20722174 var this_id = (this.pc)?this.pc.pp.id:this.id;
20732175 var dur = this.getDuration();
2074 - var hide_progress = true;
2075 - //set the left percet and update the slider:
 2176+ var hide_progress = true;
 2177+ //set the left percet and update the slider:
20762178 rel_start_sec = npt2seconds( options['start']);
2077 - //remove the start_offset if relevent:
 2179+ //remove the start_offset if relevent:
20782180 if(this.start_offset)
20792181 rel_start_sec = rel_start_sec - this.start_offset
2080 -
 2182+
20812183 var slider_perc=0;
20822184 if( rel_start_sec <= 0 ){
2083 - left_perc =0;
 2185+ left_perc =0;
20842186 options['start'] = seconds2npt( this.start_offset );
2085 - rel_start_sec=0;
 2187+ rel_start_sec=0;
20862188 this.setSliderValue( 0 , hide_progress);
20872189 }else{
2088 - left_perc = parseInt( (rel_start_sec / dur)*100 ) ;
 2190+ left_perc = parseInt( (rel_start_sec / dur)*100 ) ;
20892191 slider_perc = (left_perc / 100);
2090 - }
2091 - js_log("slider perc:" + slider_perc);
 2192+ }
 2193+ js_log("slider perc:" + slider_perc);
20922194 if( ! this.isPlaying() ){
2093 - this.setSliderValue( slider_perc , hide_progress);
 2195+ this.setSliderValue( slider_perc , hide_progress);
20942196 }
2095 -
2096 - width_perc = parseInt( (( npt2seconds( options['end'] ) - npt2seconds( options['start'] ) ) / dur)*100 ) ;
 2197+
 2198+ width_perc = parseInt( (( npt2seconds( options['end'] ) - npt2seconds( options['start'] ) ) / dur)*100 ) ;
20972199 if( (width_perc + left_perc) > 100 ){
2098 - width_perc = 100 - left_perc;
2099 - }
2100 - //js_log('should hl: '+rel_start_sec+ '/' + dur + ' re:' + rel_end_sec+' lp:' + left_perc + ' width: ' + width_perc);
 2200+ width_perc = 100 - left_perc;
 2201+ }
 2202+ //js_log('should hl: '+rel_start_sec+ '/' + dur + ' re:' + rel_end_sec+' lp:' + left_perc + ' width: ' + width_perc);
21012203 $j('#mv_seeker_' + this_id + ' .mv_highlight').css({
21022204 'left':left_perc+'%',
2103 - 'width':width_perc+'%'
2104 - }).show();
2105 -
 2205+ 'width':width_perc+'%'
 2206+ }).show();
 2207+
21062208 this.jump_time = options['start'];
21072209 this.seek_time_sec = npt2seconds( options['start']);
2108 - //trim output to
 2210+ //trim output to
21092211 this.setStatus( gM('mwe-seek_to')+' '+ seconds2npt( this.seek_time_sec ) );
21102212 js_log('DO update: ' + this.jump_time);
2111 - this.updateThumbTime( rel_start_sec );
 2213+ this.updateThumbTime( rel_start_sec );
21122214 },
21132215 hideHighlight:function(){
21142216 var this_id = (this.pc)?this.pc.pp.id:this.id;
@@ -2119,7 +2221,7 @@
21202222 var id = (this.pc)?this.pc.pp.id:this.id;
21212223 //update status:
21222224 $j('#mv_time_'+id).html(value);
2123 - }
 2225+ }
21242226 }
21252227
21262228
@@ -2146,9 +2248,9 @@
21472249 supported_types:null,
21482250 library:null,
21492251 loaded:false,
2150 - loading_callbacks:null,
 2252+ loading_callbacks:null,
21512253 supportsMIMEType : function(type)
2152 - {
 2254+ {
21532255 for (var i=0; i < this.supported_types.length; i++)
21542256 if(this.supported_types[i] == type)
21552257 return true;
@@ -2164,17 +2266,17 @@
21652267 js_log('plugin loaded, do callback:');
21662268 callback();
21672269 }else{
2168 - var _this = this;
2169 - //jQuery based get script does not work so well.
2170 - mvJsLoader.doLoad([
 2270+ var _this = this;
 2271+ //jQuery based get script does not work so well.
 2272+ mvJsLoader.doLoad([
21712273 libName
21722274 ],function(){
2173 - callback();
 2275+ callback();
21742276 });
21752277 }
2176 - }
 2278+ }
21772279 }
2178 -/* players and supported mime types
 2280+/* players and supported mime types
21792281 @@todo ideally we query the plugin to get what mime types it supports in practice not always reliable/avaliable
21802282 */
21812283 var flowPlayer = new mediaPlayer('flowplayer',['video/x-flv', 'video/h264'],'flash');
@@ -2191,7 +2293,7 @@
21922294 //add generic
21932295 var oggPluginPlayer = new mediaPlayer('oggPlugin',['video/ogg'],'generic');
21942296
2195 -//depricate quicktime in favor of safari native
 2297+//depricate quicktime in favor of safari native
21962298 //var quicktimeMozillaPlayer = new mediaPlayer('quicktime-mozilla',['video/ogg'],'quicktime');
21972299 //var quicktimeActiveXPlayer = new mediaPlayer('quicktime-activex',['video/ogg'],'quicktime');
21982300
@@ -2216,24 +2318,24 @@
22172319 {
22182320 this.players = new Array();
22192321 this.loadPreferences();
2220 -
2221 - //set up default players order for each library type
 2322+
 2323+ //set up default players order for each library type
22222324 this.default_players['video/x-flv'] = ['flash','vlc'];
22232325 this.default_players['video/h264'] = ['flash', 'vlc'];
2224 -
2225 - this.default_players['video/ogg'] = ['native','vlc','java', 'generic'];
2226 - this.default_players['application/ogg'] = ['native','vlc','java', 'generic'];
2227 - this.default_players['audio/ogg'] = ['native','vlc', 'java', 'omtk' ];
 2326+
 2327+ this.default_players['video/ogg'] = ['native','vlc','java', 'generic'];
 2328+ this.default_players['application/ogg'] = ['native','vlc','java', 'generic'];
 2329+ this.default_players['audio/ogg'] = ['native','vlc', 'java', 'omtk' ];
22282330 this.default_players['video/mp4'] = ['vlc'];
2229 -
 2331+
22302332 this.default_players['text/html'] = ['html'];
22312333 this.default_players['image/jpeg'] = ['html'];
22322334 this.default_players['image/png'] = ['html'];
22332335 this.default_players['image/svg'] = ['html'];
2234 -
 2336+
22352337 },
22362338 addPlayer : function(player, mime_type)
2237 - {
 2339+ {
22382340 //js_log('Adding ' + player.id + ' with mime_type ' + mime_type);
22392341 for (var i =0; i < this.players.length; i++){
22402342 if (this.players[i].id == player.id)
@@ -2241,52 +2343,52 @@
22422344 if(mime_type!=null)
22432345 {
22442346 //make sure the mime_type is not already there:
2245 - var add_mime = true;
 2347+ var add_mime = true;
22462348 for(var j=0; j < this.players[i].supported_types.length; j++ ){
22472349 if( this.players[i].supported_types[j]== mime_type)
22482350 add_mime=false;
2249 - }
 2351+ }
22502352 if(add_mime)
22512353 this.players[i].supported_types.push(mime_type);
22522354 }
22532355 return;
22542356 }
22552357 }
2256 - //player not found:
 2358+ //player not found:
22572359 if(mime_type!=null)
2258 - player.supported_types.push(mime_type);
2259 -
 2360+ player.supported_types.push(mime_type);
 2361+
22602362 this.players.push( player );
22612363 },
22622364 getMIMETypePlayers : function(mime_type)
2263 - {
 2365+ {
22642366 var mime_players = new Array();
22652367 var _this = this;
22662368 var inx = 0;
2267 - if( this.default_players[mime_type] ){
2268 - $j.each( this.default_players[mime_type], function(d, lib){
2269 - var library = _this.default_players[mime_type][d];
2270 - for ( var i=0; i < _this.players.length; i++ ){
 2369+ if( this.default_players[mime_type] ){
 2370+ $j.each( this.default_players[mime_type], function(d, lib){
 2371+ var library = _this.default_players[mime_type][d];
 2372+ for ( var i=0; i < _this.players.length; i++ ){
22712373 if ( _this.players[i].library == library && _this.players[i].supportsMIMEType(mime_type) ){
2272 - mime_players[ inx ] = _this.players[i];
 2374+ mime_players[ inx ] = _this.players[i];
22732375 inx++;
22742376 }
22752377 }
22762378 });
2277 - }
 2379+ }
22782380 return mime_players;
22792381 },
22802382 defaultPlayer : function(mime_type)
2281 - {
2282 - js_log("get defaultPlayer for " + mime_type);
2283 - var mime_players = this.getMIMETypePlayers(mime_type);
 2383+ {
 2384+ js_log("get defaultPlayer for " + mime_type);
 2385+ var mime_players = this.getMIMETypePlayers(mime_type);
22842386 if( mime_players.length > 0)
22852387 {
22862388 // check for prior preference for this mime type
22872389 for( var i=0; i < mime_players.length; i++ ){
22882390 if( mime_players[i].id==this.preference[mime_type] )
22892391 return mime_players[i];
2290 - }
 2392+ }
22912393 // otherwise just return the first compatible player
22922394 // (it will be chosen according to the default_players list
22932395 return mime_players[0];
@@ -2326,7 +2428,7 @@
23272429 },
23282430 loadPreferences : function()
23292431 {
2330 - this.preference = new Object();
 2432+ this.preference = new Object();
23312433 // see if we have a cookie set to a clientSupported type:
23322434 var cookieVal = $j.cookie( 'ogg_player_exp' );
23332435 if (cookieVal)
@@ -2342,11 +2444,11 @@
23432445 },
23442446 savePreferences : function()
23452447 {
2346 - var cookieVal = '';
 2448+ var cookieVal = '';
23472449 for(var i in this.preference)
23482450 cookieVal+= i + '='+ this.preference[i] + '&';
2349 -
2350 - cookieVal=cookieVal.substr(0, cookieVal.length-1);
 2451+
 2452+ cookieVal=cookieVal.substr(0, cookieVal.length-1);
23512453 var week = 7*86400*1000;
23522454 $j.cookie( 'ogg_player_exp', cookieVal, { 'expires':week } );
23532455 }
@@ -2360,7 +2462,7 @@
23612463 var embedTypes = {
23622464 // List of players
23632465 players: null,
2364 - detect_done:false,
 2466+ detect_done:false,
23652467 init: function(){
23662468 //detect supported types
23672469 this.detect();
@@ -2380,7 +2482,7 @@
23812483 js_log("running detect");
23822484 this.players = new mediaPlayers();
23832485 //every browser supports html rendering:
2384 - this.players.addPlayer( htmlPlayer );
 2486+ this.players.addPlayer( htmlPlayer );
23852487 // In Mozilla, navigator.javaEnabled() only tells us about preferences, we need to
23862488 // search navigator.mimeTypes to see if it's installed
23872489 var javaEnabled = navigator.javaEnabled();
@@ -2392,28 +2494,28 @@
23932495 // And it doesn't register an application/x-java-applet mime type like Mozilla does.
23942496 if ( invisibleJava && javaEnabled )
23952497 this.players.addPlayer( cortadoPlayer );
2396 -
 2498+
23972499 // ActiveX plugins
23982500 if($j.browser.msie){
2399 - // check for flash
2400 - if ( this.testActiveX( 'ShockwaveFlash.ShockwaveFlash')){
2401 - //try to get the flash version for omtk include:
 2501+ // check for flash
 2502+ if ( this.testActiveX( 'ShockwaveFlash.ShockwaveFlash')){
 2503+ //try to get the flash version for omtk include:
24022504 try {
24032505 a = new ActiveXObject(SHOCKWAVE_FLASH_AX + ".7");
24042506 d = a.GetVariable("$version"); // Will crash fp6.0.21/23/29
24052507 if (d) {
2406 - d = d.split(" ")[1].split(",");
 2508+ d = d.split(" ")[1].split(",");
24072509 //we need flash version 10 or greater:
24082510 if(parseInt( d[0]) >=10){
24092511 this.players.addPlayer( omtkPlayer );
24102512 }
2411 -
2412 - }
2413 - }catch(e) {}
2414 -
2415 - //flowplayer has pretty good compatiablity
 2513+
 2514+ }
 2515+ }catch(e) {}
 2516+
 2517+ //flowplayer has pretty good compatiablity
24162518 // (but if we wanted to be fancy we would check for version of flash and update the mp4/h.264 support
2417 - this.players.addPlayer( flowPlayer );
 2519+ this.players.addPlayer( flowPlayer );
24182520 }
24192521 // VLC
24202522 if ( this.testActiveX( 'VideoLAN.VLCPlugin.2' ) )
@@ -2423,14 +2525,14 @@
24242526 this.players.addPlayer(cortadoPlayer);
24252527 // quicktime
24262528 //if ( this.testActiveX( 'QuickTimeCheckObject.QuickTimeCheck.1' ) )
2427 - // this.players.addPlayer(quicktimeActiveXPlayer);
2428 - }
 2529+ // this.players.addPlayer(quicktimeActiveXPlayer);
 2530+ }
24292531 // <video> element
24302532 if ( typeof HTMLVideoElement == 'object' // Firefox, Safari
24312533 || typeof HTMLVideoElement == 'function' ) // Opera
24322534 {
2433 - //do another test for safari:
2434 - if( $j.browser.safari ){
 2535+ //do another test for safari:
 2536+ if( $j.browser.safari ){
24352537 try{
24362538 var dummyvid = document.createElement("video");
24372539 if (dummyvid.canPlayType && dummyvid.canPlayType("video/ogg;codecs=\"theora,vorbis\"") == "probably")
@@ -2441,7 +2543,7 @@
24422544 but xiph qt registers mimetype via quicktime plugin */
24432545 this.players.addPlayer( videoElementPlayer );
24442546 } else {
2445 - //@@todo add some user nagging to install the xiph qt
 2547+ //@@todo add some user nagging to install the xiph qt
24462548 }
24472549 }catch(e){
24482550 js_log('could not run canPlayType in safari');
@@ -2449,8 +2551,8 @@
24502552 }else{
24512553 this.players.addPlayer( videoElementPlayer );
24522554 }
2453 - }
2454 -
 2555+ }
 2556+
24552557 // Mozilla plugins
24562558 if( navigator.mimeTypes && navigator.mimeTypes.length > 0) {
24572559 for ( var i = 0; i < navigator.mimeTypes.length; i++ ) {
@@ -2464,17 +2566,17 @@
24652567 if ( !pluginName ) {
24662568 // In case it is null or undefined
24672569 pluginName = '';
2468 - }
 2570+ }
24692571 if ( pluginName.toLowerCase() == 'vlc multimedia plugin' || pluginName.toLowerCase() == 'vlc multimedia plug-in' ) {
24702572 this.players.addPlayer(vlcMozillaPlayer, type);
24712573 continue;
24722574 }
2473 -
 2575+
24742576 if ( javaEnabled && type == 'application/x-java-applet' ) {
24752577 this.players.addPlayer(cortadoPlayer);
24762578 continue;
2477 - }
2478 -
 2579+ }
 2580+
24792581 if ( type == 'application/ogg' ) {
24802582 if ( pluginName.toLowerCase() == 'vlc multimedia plugin' ){
24812583 this.players.addPlayer(vlcMozillaPlayer, type);
@@ -2493,14 +2595,14 @@
24942596 continue;
24952597 }
24962598 }
2497 -
 2599+
24982600 /*if ( type == 'video/quicktime' ) {
24992601 this.players.addPlayer(vlcMozillaPlayer, type);
25002602 continue;
25012603 }*/
25022604 if(type=='application/x-shockwave-flash'){
25032605 this.players.addPlayer( flowPlayer );
2504 -
 2606+
25052607 //check version to add omtk:
25062608 var flashDescription = navigator.plugins["Shockwave Flash"].description;
25072609 var descArray = flashDescription.split(" ");
@@ -2509,7 +2611,7 @@
25102612 //js_log("version of flash: " + versionMajor);
25112613 if(versionMajor >= 10){
25122614 this.players.addPlayer( omtkPlayer );
2513 - }
 2615+ }
25142616 continue;
25152617 }
25162618 }
@@ -2528,5 +2630,5 @@
25292631 hasObj = false;
25302632 }
25312633 return hasObj;
2532 - }
 2634+ }
25332635 };
Index: trunk/phase3/js2/mwEmbed/example_usage/Player_RelatedVideos.html
@@ -0,0 +1,29 @@
 2+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 3+"http://www.w3.org/TR/html4/loose.dtd">
 4+<html>
 5+<head>
 6+ <title>Simple Video Tag Usage</title>
 7+ <script type="text/javascript" src="../mv_embed.js"></script>
 8+</head>
 9+<body>
 10+<h3> Simple Video Relational Audio and Video the Commons </h3>
 11+This Example search primitive video in the Wikimedia Commons
 12+<span id="default_attr">
 13+</span> <br />
 14+<br />
 15+ <table border="1" cellpadding="6" width="600">
 16+ <tr>
 17+ <td valign="top">
 18+ <video wikiTitleKey="File:B-36_bomber.ogg" durationHint="2" poster="http://upload.wikimedia.org/wikipedia/commons/thumb/0/0d/B-36_bomber.ogg/mid-B-36_bomber.ogg.jpg&size=400x300" src="http://upload.wikimedia.org/wikipedia/commons/0/0d/B-36_bomber.ogg"></video></td>
 19+ <td valign="top"><b>Sample Relational Video And Audio</b><br />
 20+ <pre>The Example Code ::: </pre>
 21+ &lt;video wikiTitleKey="File:B-36_bomber.ogg" durationHint="2"
 22+ poster="http://upload.wikimedia.org/wikipedia/commons/thumb/0/0d/B-36_bomber.ogg/mid-B-36_bomber.ogg.jpg&size=400x300"
 23+ src="http://upload.wikimedia.org/wikipedia/commons/0/0d/B-36_bomber.ogg"&gt;&lt;/video&gt;
 24+ </br>
 25+ </td>
 26+ </table>
 27+ <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />&nbsp;
 28+ </body>
 29+</html>
 30+

Status & tagging log