r40114 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r40113‎ | r40114 | r40115 >
Date:22:48, 27 August 2008
Author:dale
Status:old
Tags:
Comment:
improved playhead support for firefox native video
Modified paths:
  • /trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_nativeEmbed.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_vlcEmbed.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/example_usage/sample_page.php (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed.js (modified) (history)

Diff [purge]

Index: trunk/extensions/MetavidWiki/skins/mv_embed/example_usage/sample_page.php
@@ -61,7 +61,7 @@
6262 $sample_embed[3]['desc'] = 'Demo2 of json ROE attribute';
6363
6464
65 -$sample_embed[2]['tag'] = '<video id="v2" controls="true" src="sample_fish.ogg" poster="sample_fish.jpg"></video>';
 65+$sample_embed[2]['tag'] = '<video id="v2" controls="true" src="sample_fish.ogg?t=0:0:0/0:0:26" poster="sample_fish.jpg"></video>';
6666 $sample_embed[2]['desc'] = 'simple video with controls and thumbnail';
6767
6868 //playlist tags:
Index: trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_nativeEmbed.js
@@ -7,7 +7,8 @@
88 setTimeout('$j(\'#'+this.id+'\').get(0).postEmbedJS()', 150);
99 //set a default duration of 30 seconds: cortao should detect duration.
1010 var embed_code = this.getEmbedObj();
11 - js_log('EMBED CODE: ' + embed_code);
 11+ js_log('embed code: ' + embed_code);
 12+ js_log("DURATION: "+ this.getDuration() );
1213 return this.wrapEmebedContainer( embed_code);
1314 },
1415 getEmbedObj:function(){
@@ -17,14 +18,16 @@
1819 'src="'+this.media_element.selected_source.uri+'" ' +
1920 'controls="false" ' +
2021 'oncanplaythrough="$j(\'#'+this.id+'\').get(0).oncanplaythrough();return false;" ' +
21 - 'onloadedmetadata="$j(\'#'+this.id+'\').get(0).onloadedmetadata();return false;" >' +
 22+ 'onloadedmetadata="$j(\'#'+this.id+'\').get(0).onloadedmetadata();return false;" ' +
 23+ 'loadedmetadata="$j(\'#'+this.id+'\').get(0).onloadedmetadata();return false;" >' +
2224 '</video>';
2325 },
2426 //@@todo : loading progress
2527 postEmbedJS:function(){
2628 this.getVID();
2729 if(this.vid){
28 - this.vid.load();
 30+ this.vid.play();
 31+ //this.vid.load(); //does not seem to work so well
2932 setTimeout('$j(\'#'+this.id+'\').get(0).monitor()',100);
3033 }else{
3134 js_log('could not grab vid obj:' + typeof this.vid);
@@ -33,11 +36,27 @@
3437 },
3538 monitor : function(){
3639 this.getVID(); //make shure we have .vid obj
37 - js_log('time loaded: ' + this.vid.TimeRanges() );
38 - //update load progress and
 40+ js_log('time loaded: ' + this.vid.TimeRanges );
 41+ js_log('current time: '+ this.vid.currentTime + ' dur: ' + this.duration);
 42+
 43+ //update duration if not set
 44+ this.duration =(this.vid.duration==0)?this.getDuration():this.vid.duration;
 45+
 46+ //update pointers (should just have a loop):
 47+ this.currentTime = this.vid.currentTime;
 48+
 49+ if( this.currentTime > 0 ){
 50+ if(! this.userSlide){
 51+ this.setSliderValue(this.currentTime/this.duration );
 52+ this.setStatus( seconds2ntp(this.currentTime) + '/'+ seconds2ntp(this.duration));
 53+ }else{
 54+ this.setStatus('seek to: ' + seconds2ntp(Math.round( (this.sliderVal*this.duration)) ));
 55+ }
 56+ }
 57+ //update load progress if nessisary
3958 if( ! this.monitorTimerId ){
4059 if(document.getElementById(this.id)){
41 - this.monitorTimerId = setInterval('$j(\'#'+this.id+'\').get(0).monitor()', 1000);
 60+ this.monitorTimerId = setInterval('$j(\'#'+this.id+'\').get(0).monitor()', 250);
4261 }
4362 }
4463 },
@@ -49,20 +68,33 @@
5069 this.play();
5170 },
5271 onloadedmetadata: function(){
53 - js_log('f:onloadedmetadata get duration');
 72+ js_log('f:onloadedmetadata get duration: ' +this.vid.duration);
5473 //this.
5574 },
56 - pause : function(){
57 - document.getElementById(this.pid).pause();
 75+ onloadedmetadata: function(){
 76+ js_log('f:onloadedmetadata metadata ready');
 77+ //set the clip duration
5878 },
 79+ pause : function(){
 80+ this.vid.pause();
 81+ //stop updates:
 82+ if( this.monitorTimerId != 0 )
 83+ {
 84+ clearInterval(this.monitorTimerId);
 85+ this.monitorTimerId = 0;
 86+ }
 87+ },
5988 play:function(){
60 - if(!document.getElementById(this.pid) || this.thumbnail_disp){
 89+ this.getVID();
 90+ if(!this.vid || this.thumbnail_disp){
6191 this.parent_play();
6292 }else{
63 - document.getElementById(this.pid).play();
 93+ this.vid.play();
 94+ //re-start the monitor:
 95+ this.vid.monitor();
6496 }
6597 },
66 - // get the embed vlc object
 98+ // get the embed vlc object
6799 getVID : function (){
68100 this.vid = $j('#'+this.pid).get(0);
69101 }
Index: trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_vlcEmbed.js
@@ -178,7 +178,7 @@
179179 if( this.duration > 0 || this.vlc.input.time > 0){
180180 ///set mediaLen via request Url
181181 if(this.duration==0)
182 - this.duration=this.media_element.selected_source.duration;
 182+ this.duration=this.getDuration();
183183
184184 if(!this.start_offset)
185185 this.start_offset=this.media_element.selected_source.start_offset;
Index: trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed.js
@@ -1721,7 +1721,8 @@
17221722 return this.media_element.selected_source.start_ntp+'/'+this.media_element.selected_source.end_ntp;
17231723 },
17241724 getDuration:function(){
1725 - return this.media_element.selected_source.duration;
 1725+ this.duration = this.media_element.selected_source.duration;
 1726+ return this.duration;
17261727 },
17271728 /* get the duration in ntp format */
17281729 getDurationNTP:function(){