From 29c56c9776076c19be84bc761f2aa7211941e94e Mon Sep 17 00:00:00 2001 From: Michael Dale Date: Fri, 16 Oct 2009 17:32:40 +0000 Subject: [PATCH] * (bug 21152) fixed position of playhead to seek position on native html5 seeking --- js2/mwEmbed/libEmbedVideo/embedVideo.js | 9 ++++---- js2/mwEmbed/libEmbedVideo/nativeEmbed.js | 24 +++++++++++++++------- js2/mwEmbed/php/languages/mwEmbed.i18n.php | 3 ++- 3 files changed, 24 insertions(+), 12 deletions(-) diff --git a/js2/mwEmbed/libEmbedVideo/embedVideo.js b/js2/mwEmbed/libEmbedVideo/embedVideo.js index 61bda8e402..ae503a7843 100644 --- a/js2/mwEmbed/libEmbedVideo/embedVideo.js +++ b/js2/mwEmbed/libEmbedVideo/embedVideo.js @@ -49,7 +49,8 @@ loadGM({ "mwe-playerselect" : "Players", "mwe-read_before_embed" : "Please read the security notes on remote embedding<\/a> before actually embedding!", "mwe-embed_site_or_blog" : "Embed on your site or blog", - "mwe_related_videos" : "Related videos" + "mwe-related_videos" : "Related videos", + "mwe-seeking": "seeking" }); //set the globals: @@ -1043,7 +1044,7 @@ embedVideo.prototype = { return 'function getEmbedHTML should be overitten by embedLib '; }, //do seek function (should be overwritten by implementing embedLibs) - // first check if seek can be done on locally downloaded content. + // to check if seek can be done on locally downloaded content. doSeek : function( perc ){ if( this.supportsURLTimeEncoding() ){ //make sure this.seek_time_sec is up-to-date: @@ -1199,7 +1200,7 @@ embedVideo.prototype = { if( this.wikiTitleKey){ $j('#dc_'+this.id).append( ''); @@ -2060,7 +2061,7 @@ embedVideo.prototype = { //plugin objects are responsible for updating currentTime monitor:function(){ if( this.currentTime && this.currentTime > 0 && this.duration){ - if( !this.userSlide ){ + if( !this.userSlide && ! this.seeking ){ if( this.start_offset ){ //if start offset include that calculation this.setSliderValue( ( this.currentTime - this.start_offset ) / this.duration ); diff --git a/js2/mwEmbed/libEmbedVideo/nativeEmbed.js b/js2/mwEmbed/libEmbedVideo/nativeEmbed.js index 2936508698..405e4e660a 100644 --- a/js2/mwEmbed/libEmbedVideo/nativeEmbed.js +++ b/js2/mwEmbed/libEmbedVideo/nativeEmbed.js @@ -36,11 +36,14 @@ var nativeEmbed = { eb+='autoplay="true" ';*/ //continue with the other attr: - eb+= 'oncanplaythrough="$j(\'#'+this.id+'\').get(0).oncanplaythrough();return false;" ' + - 'onloadedmetadata="$j(\'#'+this.id+'\').get(0).onloadedmetadata();return false;" ' + - 'loadedmetadata="$j(\'#'+this.id+'\').get(0).onloadedmetadata();return false;" ' + - 'onprogress="$j(\'#'+this.id+'\').get(0).onprogress( event );return false;" '+ - 'onended="$j(\'#'+this.id+'\').get(0).onended();return false;" >' + + eb+= 'oncanplaythrough="$j(\'#'+this.id+'\').get(0).oncanplaythrough();return false;" ' + + 'onloadedmetadata="$j(\'#'+this.id+'\').get(0).onloadedmetadata();return false;" ' + + 'loadedmetadata="$j(\'#'+this.id+'\').get(0).onloadedmetadata();return false;" ' + + 'onprogress="$j(\'#'+this.id+'\').get(0).onprogress( event );return false;" '+ + 'onended="$j(\'#'+this.id+'\').get(0).onended();return false;" '+ + 'onseeking="$j(\'#'+this.id+'\').get(0).onseeking();" ' + + 'onseeked="$j(\'#'+this.id+'\').get(0).onseeked();" ' + + '>' + ''; return eb; }, @@ -68,7 +71,14 @@ var nativeEmbed = { } } }, - doSeek:function(perc){ + onseeking:function(){ + this.seeking = true; + this.setStatus( '' + gM('mwe-seeking') + '' ); + }, + onseeked: function(){ + this.seeking = false; + }, + doSeek:function(perc){ //js_log('native:seek:p: ' + perc+ ' : ' + this.supportsURLTimeEncoding() + ' dur: ' + this.getDuration() + ' sts:' + this.seek_time_sec ); //@@todo check if the clip is loaded here (if so we can do a local seek) if( this.supportsURLTimeEncoding() || !this.vid){ @@ -100,7 +110,7 @@ var nativeEmbed = { _this.getVID(); //if we have duration then we are ready to do the seek if(this.vid && this.vid.duration){ - _this.doSeek(perc); + _this.doSeek( perc ); }else{ //try to get player for 10 seconds: if( rfsCount < 200 ){ diff --git a/js2/mwEmbed/php/languages/mwEmbed.i18n.php b/js2/mwEmbed/php/languages/mwEmbed.i18n.php index 1f8a7381dd..9d4d3515d4 100644 --- a/js2/mwEmbed/php/languages/mwEmbed.i18n.php +++ b/js2/mwEmbed/php/languages/mwEmbed.i18n.php @@ -278,7 +278,8 @@ $messages['en'] = array( 'mwe-playerselect' => 'Players', 'mwe-read_before_embed' => 'Please read the security notes on remote embedding before actually embedding!', 'mwe-embed_site_or_blog' => 'Embed on your site or blog', - 'mwe_related_videos' => 'Related videos', + 'mwe-related_videos' => 'Related videos', + 'mwe-seeking' => "seeking", ); /** Message documentation (Message documentation) -- 2.20.1