Index: trunk/extensions/MetavidWiki/includes/MV_GlobalFunctions.php |
— | — | @@ -243,7 +243,7 @@ |
244 | 244 | $wgOut->addScript("<script type=\"{$wgJsMimeType}\" src=\"{$mvgScriptPath}/skins/mv_embed/jquery/plugins/jquery.autocomplete.js\"></script>"); |
245 | 245 | $wgOut->addScript("<script type=\"{$wgJsMimeType}\" src=\"{$mvgScriptPath}/skins/mv_embed/jquery/plugins/jquery.hoverIntent.js\"></script>"); |
246 | 246 | |
247 | | - $wgOut->addScript("<script type=\"{$wgJsMimeType}\" src=\"{$mvgScriptPath}/skins/mv_embed/mv_embed.js?".time."\"></script>"); |
| 247 | + $wgOut->addScript("<script type=\"{$wgJsMimeType}\" src=\"{$mvgScriptPath}/skins/mv_embed/mv_embed.js\"></script>"); |
248 | 248 | $wgOut->addScript("<script type=\"{$wgJsMimeType}\" src=\"{$mvgScriptPath}/skins/mv_allpages.js\"></script>"); |
249 | 249 | $wgOut->addScript("<script type=\"{$wgJsMimeType}\" src=\"{$mvgScriptPath}/skins/mv_search.js\"></script>"); |
250 | 250 | |
Index: trunk/extensions/MetavidWiki/includes/MV_DefaultSettings.php |
— | — | @@ -45,6 +45,7 @@ |
46 | 46 | //metadata helpers for annotative layer (anno_en) |
47 | 47 | // 'property'=>category for auto_complete (ALL LOWER CASE) |
48 | 48 | $mvMetaDataHelpers = array('anno_en'=>array('speech_by'=>'person', 'bill'=>'bill')); |
| 49 | + |
49 | 50 | //by default categories are handled differently enable or disable below: |
50 | 51 | $mvMetaCategoryHelper=true; |
51 | 52 | |
Index: trunk/extensions/MetavidWiki/includes/specials/MV_SpecialExport.php |
— | — | @@ -335,7 +335,7 @@ |
336 | 336 | //do mvd_index query: |
337 | 337 | $mvd_rows = MV_Index::getMVDInRange($streamTitle->getStreamId(), |
338 | 338 | $streamTitle->getStartTimeSeconds(), |
339 | | - $streamTitle->getEndTimeSeconds(), $tracks); |
| 339 | + $streamTitle->getEndTimeSeconds(), $tracks, $getText=false, 'Speech_by,Bill,category'); |
340 | 340 | //get the stream stream req |
341 | 341 | if(!$inline)header('Content-Type: text/xml'); |
342 | 342 | //print the header: |
— | — | @@ -345,12 +345,27 @@ |
346 | 346 | if(count($mvd_rows)!=0){ |
347 | 347 | global $wgOut; |
348 | 348 | $MV_Overlay = new MV_Overlay(); |
349 | | - foreach($mvd_rows as $mvd){ |
| 349 | + foreach($mvd_rows as $mvd){ |
350 | 350 | if(!isset($tracks[$mvd->mvd_type]))$tracks[$mvd->mvd_type]=''; |
351 | 351 | $tracks[$mvd->mvd_type].=' |
352 | 352 | <'.$ns.'clip id="mvd_'.htmlentities($mvd->id).'" start="npt:'.htmlentities(seconds2ntp($mvd->start_time)).'" end="npt:'.htmlentities(seconds2ntp($mvd->end_time)).'"> |
353 | | - <'.$ns.'img src="'.htmlentities($streamTitle->getFullStreamImageURL(null, seconds2ntp($mvd->start_time))).'"/> |
354 | | - <'.$ns.'body><![CDATA[ |
| 353 | + <'.$ns.'img src="'.htmlentities($streamTitle->getFullStreamImageURL(null, seconds2ntp($mvd->start_time))).'"/>'; |
| 354 | + //output all metadata @@todo we should generalize the semantic properties. |
| 355 | + $tracks[$mvd->mvd_type].=(isset($mvd->Speech_by) && trim($mvd->Speech_by)!='' ) ?'<meta name="Speech_by" content="'.htmlentities($mvd->Speech_by).'"/>':''; |
| 356 | + $tracks[$mvd->mvd_type].=(isset($mvd->Bill) && trim($mvd->Bill)!='')?'<meta name="Bill" content="'.htmlentities($mvd->Bill).'"/>':''; |
| 357 | + |
| 358 | + //add in categories as "keywords" |
| 359 | + if(count($mvd->category)!=0){ |
| 360 | + $tracks[$mvd->mvd_type].='<meta name="keywords" content="'; |
| 361 | + $coma=''; |
| 362 | + foreach($mvd->category as $cat){ |
| 363 | + $tracks[$mvd->mvd_type].=$coma . htmlentities($cat); |
| 364 | + $coma=','; |
| 365 | + } |
| 366 | + $tracks[$mvd->mvd_type].='"/>'; |
| 367 | + } |
| 368 | + |
| 369 | + $tracks[$mvd->mvd_type].='<'.$ns.'body><![CDATA[ |
355 | 370 | '. $MV_Overlay->getMVDhtml($mvd, $absolute_links=true).' |
356 | 371 | ]]></'.$ns.'body> |
357 | 372 | </'.$ns.'clip>'; |
Index: trunk/extensions/MetavidWiki/skins/mv_stream.js |
— | — | @@ -214,11 +214,14 @@ |
215 | 215 | }); |
216 | 216 | }, |
217 | 217 | mvdOver:function(mvd_id){ |
218 | | - js_log('do mv_fdOver ' + mvd_id ); |
219 | | - if($j('#embed_vid').get(0).isPlaying()){ |
220 | | - this.delay_cur_mvd_id= mvd_id; |
221 | | - setTimeout("mv_init_interface.delayDoVidMvdUpdate()", 250); |
222 | | - }else{ |
| 218 | + js_log('f:mvdOver' + mvd_id ); |
| 219 | + var vid_elm = $j('#embed_vid').get(0); |
| 220 | + if( vid_elm.isPlaying() ){ |
| 221 | + if(!vid_elm.onClipDone_disp){ |
| 222 | + this.delay_cur_mvd_id= mvd_id; |
| 223 | + setTimeout("mv_init_interface.delayDoVidMvdUpdate()", 250); |
| 224 | + } |
| 225 | + }else{ |
223 | 226 | this.cur_mvd_id=this.delay_cur_mvd_id=mvd_id; |
224 | 227 | do_video_mvd_update(mvd_id); |
225 | 228 | } |
— | — | @@ -231,11 +234,9 @@ |
232 | 235 | de_highlight_tl_ts(mvd_id); |
233 | 236 | de_highlight_fd(mvd_id); |
234 | 237 | js_log('calling interface restore: '); |
235 | | - //give an additional 500ms (so if we jump from one mvd_id to another we don't restore original so quickly) |
236 | | - //dont restore: |
237 | | - //setTimeout("mv_init_interface.doRestore()", 500); |
| 238 | + setTimeout('mv_init_interface.doRestore()',500); |
238 | 239 | //activiate over on time restore |
239 | | - $j('#mv_stream_time').hoverIntent({ |
| 240 | + /*$j('#mv_stream_time').hoverIntent({ |
240 | 241 | interval:200, //polling interval |
241 | 242 | timeout:200, //delay before onMouseOut |
242 | 243 | over:function(){ |
— | — | @@ -244,35 +245,40 @@ |
245 | 246 | out:function(){ |
246 | 247 | |
247 | 248 | } |
248 | | - }); |
| 249 | + });*/ |
249 | 250 | }, |
250 | | - //delay video updates until we are not playing the clip: |
| 251 | + //delay video updates until we are not playing the clip and clipEnd is not displayed |
251 | 252 | delayDoVidMvdUpdate:function(){ |
252 | 253 | if($j('#embed_vid').get(0).isPlaying()){ |
253 | 254 | setTimeout("mv_init_interface.delayDoVidMvdUpdate()", 250); |
254 | 255 | }else{ |
255 | | - if(this.cur_mvd_id!=this.delay_cur_mvd_id){ |
256 | | - this.cur_mvd_id = this.delay_cur_mvd_id; |
257 | | - do_video_mvd_update(this.cur_mvd_id); |
| 256 | + //only restore if the onClipDone_disp is false |
| 257 | + if( !$j('#embed_vid').get(0).onClipDone_disp){ |
| 258 | + if(this.cur_mvd_id!=this.delay_cur_mvd_id){ |
| 259 | + this.cur_mvd_id = this.delay_cur_mvd_id; |
| 260 | + do_video_mvd_update(this.cur_mvd_id); |
| 261 | + } |
258 | 262 | } |
259 | 263 | } |
260 | 264 | }, |
261 | 265 | /* based on a a mvd_id update the video thumbnail to the correct location |
262 | | - * if scriptaculus is loaded fade between images |
263 | 266 | */ |
264 | 267 | doRestore:function(){ |
265 | 268 | var vid_elm = $j('#embed_vid').get(0); |
266 | 269 | if(vid_elm){ |
267 | | - if( vid_elm.isPlaying() ){ |
268 | | - //js_log('vid elm is playing delay restore:') |
269 | | - setTimeout("mv_init_interface.doRestore()", 500); |
| 270 | + if( vid_elm.isPlaying()){ |
| 271 | + //js_log('vid elm is playing delay restore:') |
| 272 | + setTimeout("mv_init_interface.doRestore()", 500); |
270 | 273 | }else{ |
271 | | - //only restore if the cur_mvd = 'base' and interface updates are not locked |
272 | | - if(this.cur_mvd_id=='base'){ |
273 | | - vid_elm.updateThumbnail(org_thum_src); |
274 | | - vid_elm.updateVideoTimeReq(org_vid_time_req); |
275 | | - //vid_elm.updateVideoSrc(org_vid_src); |
276 | | - $j('#mv_videoPlayerTime').html(org_vid_title); |
| 274 | + //only restore if onClipDone_disp is false |
| 275 | + if(!vid_elm.onClipDone_disp){ |
| 276 | + //only restore if the cur_mvd = 'base' and interface updates are not locked |
| 277 | + if(this.cur_mvd_id=='base'){ |
| 278 | + vid_elm.updateThumbnail(org_thum_src); |
| 279 | + vid_elm.updateVideoTimeReq(org_vid_time_req); |
| 280 | + //vid_elm.updateVideoSrc(org_vid_src); |
| 281 | + $j('#mv_videoPlayerTime').html(org_vid_title); |
| 282 | + } |
277 | 283 | } |
278 | 284 | } |
279 | 285 | } |
— | — | @@ -788,8 +794,12 @@ |
789 | 795 | function mv_play_or_pause(){ |
790 | 796 | //issue a stop since we want mouse_overs to work |
791 | 797 | var ebvid = $j('#embed_vid').get(0); |
792 | | - if(!ebvid.paused) |
| 798 | + if(!ebvid.paused){ |
793 | 799 | mv_do_stop(); |
| 800 | + ebvid.pauseed=true; |
| 801 | + }else{ |
| 802 | + mv_do_play(); |
| 803 | + } |
794 | 804 | } |
795 | 805 | function mv_do_stop(){ |
796 | 806 | $j('#mv_videoPlayerTime').fadeIn('fast'); |
— | — | @@ -912,6 +922,8 @@ |
913 | 923 | //get the current thumbnail |
914 | 924 | var vid_elm = document.getElementById('embed_vid'); |
915 | 925 | if(!vid_elm)return ''; |
| 926 | + //make the play button visable again (if its hidden) : |
| 927 | + $j('#big_play_link_embed_vid').show(); |
916 | 928 | do_video_time_update(time_ary[1], time_ary[2],mvd_id); |
917 | 929 | } |
918 | 930 | } |
— | — | @@ -927,8 +939,8 @@ |
928 | 940 | //set via mvd |
929 | 941 | if(mvd_id){ |
930 | 942 | if($j('#mv_fd_mvd_'+mvd_id).attr('image_url')!=$j('#embed_vid').get(0).thumbnail){ |
931 | | - $j('#embed_vid').get(0).updateThumbnail($j('#mv_fd_mvd_'+mvd_id).attr('image_url')); |
932 | | - return ; |
| 943 | + $j('#embed_vid').get(0).updateThumbnail($j('#mv_fd_mvd_'+mvd_id).attr('image_url')); |
| 944 | + return ; |
933 | 945 | } |
934 | 946 | } |
935 | 947 | //else set via org_thum_src |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_nativeEmbed.js |
— | — | @@ -28,7 +28,7 @@ |
29 | 29 | 'id="'+this.pid + '" ' + |
30 | 30 | 'style="width:'+this.width+'px;height:'+this.height+'px;" ' + |
31 | 31 | 'width="'+this.width+'" height="'+this.height+'" '+ |
32 | | - 'src="'+this.media_element.selected_source.uri+'" ' + |
| 32 | + 'src="' + this.media_element.selected_source.getURI(this.seek_time_sec) + '" ' + |
33 | 33 | 'oncanplaythrough="$j(\'#'+this.id+'\').get(0).oncanplaythrough();return false;" ' + |
34 | 34 | 'onloadedmetadata="$j(\'#'+this.id+'\').get(0).onloadedmetadata();return false;" ' + |
35 | 35 | 'loadedmetadata="$j(\'#'+this.id+'\').get(0).onloadedmetadata();return false;" ' + |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_quicktimeEmbed.js |
— | — | @@ -42,7 +42,7 @@ |
43 | 43 | "<param name='SCALE' value='Aspect'/>" + |
44 | 44 | "<param name='AUTOPLAY' value='True'/>" + |
45 | 45 | "<param name='src' value=" + mv_embed_path + 'null_file.mov' + "/>" + |
46 | | - "<param name='QTSRC' value=" + this.src + "/>" + |
| 46 | + "<param name='QTSRC' value=" + this.media_element.selected_source.getURI(this.seek_time_sec) + "/>" + |
47 | 47 | "</object></div>"; |
48 | 48 | }, |
49 | 49 | makeQuickTimePollFunction : function ( ) { |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_genericEmbed.js |
— | — | @@ -4,6 +4,6 @@ |
5 | 5 | getEmbedHTML:function(){ |
6 | 6 | return '<object type="application/ogg" '+ |
7 | 7 | 'width="'+this.width+'" height="'+this.height+'" ' + |
8 | | - 'data="' + this.src + '"></object>'; |
| 8 | + 'data="' + this.media_element.selected_source.getURI(this.seek_time_sec) + '"></object>'; |
9 | 9 | } |
10 | 10 | } |
\ No newline at end of file |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_flashEmbed.js |
— | — | @@ -21,9 +21,9 @@ |
22 | 22 | 'play_head':true, |
23 | 23 | 'play_or_pause':true, |
24 | 24 | 'stop':true, |
25 | | - 'fullscreen':true, |
| 25 | + //'fullscreen':true, |
26 | 26 | 'time_display':true, |
27 | | - 'volume_control':true, |
| 27 | + //'volume_control':true, |
28 | 28 | 'overlay':false |
29 | 29 | }, |
30 | 30 | flashParams : { |
— | — | @@ -60,7 +60,8 @@ |
61 | 61 | this.flashParams.height = this.height; |
62 | 62 | this.flashParams.id = this.pid; |
63 | 63 | |
64 | | - this.flashVars.config.videoFile = this.media_element.selected_source.uri; |
| 64 | + js_log('set flash videoFile: '+ this.media_element.selected_source.getURI(this.seek_time_sec) ); |
| 65 | + this.flashVars.config.videoFile = this.media_element.selected_source.getURI(this.seek_time_sec); |
65 | 66 | |
66 | 67 | if(this.muted) |
67 | 68 | this.flashVars.config.initialVolumePercentage=0; |
— | — | @@ -127,6 +128,17 @@ |
128 | 129 | setTimeout('$j(\'#'+this.id+'\').get(0).monitor()', 250); |
129 | 130 | } |
130 | 131 | }, |
| 132 | + toggleMute: function(){ |
| 133 | + parent_toggleMute(); |
| 134 | + this.getFLA(); |
| 135 | + if(this.fla){ |
| 136 | + if(this.muted){ |
| 137 | + |
| 138 | + }else{ |
| 139 | + |
| 140 | + } |
| 141 | + } |
| 142 | + }, |
131 | 143 | pause : function() |
132 | 144 | { |
133 | 145 | this.getFLA(); |
— | — | @@ -148,24 +160,25 @@ |
149 | 161 | |
150 | 162 | this.currentTime = this.fla.getTime(); |
151 | 163 | |
152 | | - if(this.currentTime > 0 ){ |
| 164 | + if(this.currentTime > 1 && !this.startedTimedPlayback){ |
153 | 165 | this.startedTimedPlayback=true; |
154 | 166 | js_log("time is "+ this.currentTime + " started playback"); |
155 | | - } |
| 167 | + } |
156 | 168 | |
157 | 169 | |
158 | | - //flash is giving bogus duration get from this |
| 170 | + //flash is giving bogus duration get from this (if available) |
159 | 171 | var end_ntp = (this.media_element.selected_source.end_ntp)? |
160 | 172 | this.media_element.selected_source.end_ntp : |
161 | 173 | seconds2ntp( this.fla.getDuration() ); |
162 | 174 | var start_ntp = (this.media_element.selected_source.start_ntp)? |
163 | 175 | this.media_element.selected_source.start_ntp : 0; |
164 | | - |
165 | | - if((this.currentTime - ntp2seconds(start_ntp))<0){ |
166 | | - this.setStatus('buffering...'); |
167 | | - }else{ |
168 | | - this.setStatus( seconds2ntp(this.currentTime) + '/' + end_ntp); |
169 | | - this.setSliderValue((time - ntp2seconds(start_ntp)) / (ntp2seconds(end_ntp)-ntp2seconds(start_ntp)) ); |
| 176 | + if(!this.userSlide){ |
| 177 | + if((this.currentTime - ntp2seconds(start_ntp))<0){ |
| 178 | + this.setStatus('buffering...'); |
| 179 | + }else{ |
| 180 | + this.setStatus( seconds2ntp(this.currentTime) + '/' + end_ntp); |
| 181 | + this.setSliderValue((this.currentTime - ntp2seconds(start_ntp)) / (ntp2seconds(end_ntp)-ntp2seconds(start_ntp)) ); |
| 182 | + } |
170 | 183 | } |
171 | 184 | //do monitor update: |
172 | 185 | if( ! this.monitorTimerId ){ |
— | — | @@ -173,15 +186,24 @@ |
174 | 187 | this.monitorTimerId = setInterval('$j(\'#'+this.id+'\').get(0).monitor()', 250); |
175 | 188 | } |
176 | 189 | } |
177 | | - js_log('cur perc loaded: ' + this.fla.getPercentLoaded() + |
178 | | - ' cur time : ' + (time - ntp2seconds(start_ntp)) +' / ' +(ntp2seconds(end_ntp)-ntp2seconds(start_ntp))); |
| 190 | + |
| 191 | + //super hackery to see if we have "probably" reached the end of playback: |
| 192 | + if(this.prevTime==this.currentTime && (this.currentTime > (ntp2seconds(end_ntp)-1)) ){ |
| 193 | + js_log('probablly reached end of stream: '+this.currentTime); |
| 194 | + this.onClipDone(); |
| 195 | + } |
| 196 | + |
| 197 | + this.prevTime = this.currentTime; |
| 198 | + |
| 199 | + //js_log('cur perc loaded: ' + this.fla.getPercentLoaded() +' cur time : ' + (this.currentTime - ntp2seconds(start_ntp)) +' / ' +(ntp2seconds(end_ntp)-ntp2seconds(start_ntp))); |
179 | 200 | }, |
180 | 201 | // get the embed fla object |
181 | 202 | getFLA : function (){ |
182 | 203 | this.fla = this.getPluginEmbed(); |
183 | 204 | }, |
184 | 205 | stop : function(){ |
185 | | - js_log('f:flashEmbed:stop'); |
| 206 | + js_log('f:flashEmbed:stop'); |
| 207 | + this.startedTimedPlayback=false; |
186 | 208 | if (this.monitorTimerId != 0 ) |
187 | 209 | { |
188 | 210 | clearInterval(this.monitorTimerId); |
— | — | @@ -197,6 +219,20 @@ |
198 | 220 | clearInterval(this.monitorTimerId); |
199 | 221 | this.monitorTimerId = 0; |
200 | 222 | } |
| 223 | + }, |
| 224 | + onClipDone: function(){ |
| 225 | + js_log('f:flash:onClipDone'); |
| 226 | + if( ! this.startedTimedPlayback){ |
| 227 | + js_log('clip done before timed playback started .. not good. (ignoring) '); |
| 228 | + //setTimeout('$j(\'#'+embed.id+'\').get(0).play()', 250); |
| 229 | + }else{ |
| 230 | + js_log('clip done and '+ this.startedTimedPlayback); |
| 231 | + //stop the clip if its not stoped already: |
| 232 | + this.stop(); |
| 233 | + this.setStatus("Clip Done..."); |
| 234 | + //run the onClip done action: |
| 235 | + this.parent_onClipDone(); |
| 236 | + } |
201 | 237 | } |
202 | 238 | } |
203 | 239 | function asString(obj) { |
— | — | @@ -237,7 +273,7 @@ |
238 | 274 | for(var i in global_ogg_list) |
239 | 275 | { |
240 | 276 | var embed = document.getElementById(global_ogg_list[i]); |
241 | | - if(embed.media_element.selected_source.uri.match(clip.fileName)) |
| 277 | + if(embed.media_element.selected_source.src.match(clip.fileName)) |
242 | 278 | { |
243 | 279 | //js_log('found flash embed'); |
244 | 280 | return embed; |
— | — | @@ -248,46 +284,41 @@ |
249 | 285 | /* flowplayer callbacks */ |
250 | 286 | function onFlowPlayerReady() |
251 | 287 | { |
252 | | - js_log('onFlowPlayerReady'); |
| 288 | + js_log('f:flash_CB:onFlowPlayerReady'); |
253 | 289 | } |
254 | 290 | |
255 | 291 | function onClipDone(clip) |
256 | 292 | { |
| 293 | + js_log('f:flash_CB:onClipDone'); |
257 | 294 | var embed = locateFlashEmbed(clip); |
258 | | - js_log('f:onClipDone:'+embed.id + ' embed time: '+ embed.time); |
259 | | - |
260 | | - if( ! embed.startedTimedPlayback){ |
261 | | - js_log('clip done before timed playback started .. not good...re-issuing play in .250 seconds'); |
262 | | - setTimeout('$j(\'#'+embed.id+'\').get(0).play()', 250); |
263 | | - }else{ |
264 | | - js_log('clip done and '+ embed.startedTimedPlayback); |
265 | | - embed.setStatus("Clip Done..."); |
266 | | - //stop the |
267 | | - embed.onClipDone(); |
268 | | - } |
| 295 | + embed.onClipDone(); |
269 | 296 | } |
270 | 297 | |
271 | 298 | function onLoadBegin(clip) |
272 | 299 | { |
273 | 300 | var embed = locateFlashEmbed(clip); |
| 301 | + js_log('f:flash_CB:onLoadBegin'); |
274 | 302 | embed.setStatus("Loading Begun..."); |
275 | 303 | } |
276 | 304 | |
277 | 305 | function onPlay(clip) |
278 | 306 | { |
279 | 307 | var embed = locateFlashEmbed(clip); |
| 308 | + js_log('f:flash_CB:onPlay'); |
280 | 309 | embed.setStatus("Playing..."); |
281 | 310 | } |
282 | 311 | |
283 | 312 | function onStop(clip) |
284 | 313 | { |
285 | 314 | var embed = locateFlashEmbed(clip); |
| 315 | + js_log('f:flash_CB:onStop'); |
286 | 316 | embed.setStatus("Stopped..."); |
287 | 317 | } |
288 | 318 | |
289 | 319 | function onPause(clip) |
290 | 320 | { |
291 | 321 | var embed = locateFlashEmbed(clip); |
| 322 | + js_log('f:flash_CB:onPause'); |
292 | 323 | embed.pause(); |
293 | 324 | embed.setStatus("Paused..."); |
294 | 325 | } |
— | — | @@ -295,11 +326,13 @@ |
296 | 327 | function onResume(clip) |
297 | 328 | { |
298 | 329 | var embed = locateFlashEmbed(clip); |
| 330 | + js_log('f:flash_CB:onResume'); |
299 | 331 | embed.setStatus("Resumed..."); |
300 | 332 | } |
301 | 333 | |
302 | 334 | function onStartBuffering(clip) |
303 | 335 | { |
304 | 336 | var embed = locateFlashEmbed(clip); |
| 337 | + js_log('f:flash_CB:onStartBuffering'); |
305 | 338 | embed.setStatus("Buffering Started..."); |
306 | 339 | } |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_javaEmbed.js |
— | — | @@ -12,7 +12,7 @@ |
13 | 13 | if(mv_java_iframe){ |
14 | 14 | //make sure iframe and embed path match (java security model) |
15 | 15 | var iframe_src=''; |
16 | | - var src = this.media_element.selected_source.uri; |
| 16 | + var src = this.media_element.selected_source.getURI(); |
17 | 17 | //if the src is relative add in current_url as path: |
18 | 18 | if(src[0]=='/'){ |
19 | 19 | js_log('java: media relative path'); |
— | — | @@ -45,7 +45,7 @@ |
46 | 46 | // (media must be on the same server or applet must be signed) |
47 | 47 | return ''+ |
48 | 48 | '<applet id="'+this.pid+'" code="com.fluendo.player.Cortado.class" archive="cortado-ovt-stripped_r34336.jar" width="'+this.width+'" height="'+this.height+'"> '+ "\n"+ |
49 | | - '<param name="url" value="'+this.media_element.selected_source.uri+'" /> ' + "\n"+ |
| 49 | + '<param name="url" value="'+this.media_element.selected_source.src+'" /> ' + "\n"+ |
50 | 50 | '<param name="local" value="false"/>'+ "\n"+ |
51 | 51 | '<param name="keepaspect" value="true" />'+ "\n"+ |
52 | 52 | '<param name="video" value="true" />'+"\n"+ |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_oggplayEmbed.js |
— | — | @@ -29,7 +29,7 @@ |
30 | 30 | getEmbedObj:function(){ |
31 | 31 | return '<embed type="application/liboggplay" ' + |
32 | 32 | 'id="'+this.pid + '" ' + |
33 | | - 'src="'+this.src+'" '+ |
| 33 | + 'src="'+this.media_element.selected_source.getURI(this.seek_time_sec)+'" '+ |
34 | 34 | 'width="'+this.width+'" height="'+this.height+'">' + |
35 | 35 | '</embed>'; |
36 | 36 | }, |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_vlcEmbed.js |
— | — | @@ -54,8 +54,9 @@ |
55 | 55 | this.vlc.style.width=this.width; |
56 | 56 | this.vlc.style.height=this.height; |
57 | 57 | this.vlc.playlist.items.clear(); |
58 | | - js_log('vlc play:' + this.media_element.selected_source.uri); |
59 | | - var itemId = this.vlc.playlist.add(this.media_element.selected_source.uri); |
| 58 | + //@@todo if client supports seeking no need to send seek_offset to URI |
| 59 | + js_log('vlc play:' + this.media_element.selected_source.getURI(this.seek_time_sec)); |
| 60 | + var itemId = this.vlc.playlist.add( this.media_element.selected_source.getURI(this.seek_time_sec) ); |
60 | 61 | if( itemId != -1 ){ |
61 | 62 | //play |
62 | 63 | this.vlc.playlist.playItem(itemId); |
— | — | @@ -117,7 +118,7 @@ |
118 | 119 | // current media has stopped |
119 | 120 | this.onStop(); |
120 | 121 | //assume we reached the end: (since it was not a js call to stop) |
121 | | - this.streamEnd(); |
| 122 | + this.onClipDone(); |
122 | 123 | } |
123 | 124 | else if( newState == 1 ) |
124 | 125 | { |
— | — | @@ -173,26 +174,25 @@ |
174 | 175 | }, |
175 | 176 | liveFeedRoll : 0, |
176 | 177 | onPlaying : function(){ |
177 | | - //update the duration attribute |
178 | | - if(this.duration!=this.vlc.input.length /1000){ |
| 178 | + //for now trust the duration from url over vlc input.length |
| 179 | + this.duration = (this.getDuration())?this.getDuration():this.vlc.input.length /1000; |
| 180 | + /*if(this.duration!=this.vlc.input.length /1000){ |
179 | 181 | this.duration = this.vlc.input.length /1000; |
180 | | - } |
| 182 | + }*/ |
181 | 183 | //update the currentTime attribute |
182 | | - this.currentTime =this.vlc.input.time/1000; |
183 | | - if( this.duration > 0 || this.vlc.input.time > 0){ |
184 | | - ///set mediaLen via request Url |
185 | | - if(this.duration==0) |
186 | | - this.duration=this.getDuration(); |
| 184 | + this.currentTime =this.vlc.input.time/1000; |
| 185 | + if( this.duration > 0 || this.vlc.input.time > 0){ |
| 186 | + this.start_offset=this.media_element.selected_source.start_offset; |
187 | 187 | |
188 | | - if(!this.start_offset) |
189 | | - this.start_offset=this.media_element.selected_source.start_offset; |
190 | | - |
191 | 188 | //if we have media duration procceed |
192 | 189 | if(this.duration){ |
193 | 190 | //as long as the user is not interacting with the playhead update: |
194 | | - if(! this.userSlide){ |
195 | | - //js_log('user slide is false' + this.userSlide + '(update)'); |
196 | | - if(this.vlc.input.position!=0){ |
| 191 | + if(! this.userSlide){ |
| 192 | + //slider pos is not accurate with flash: |
| 193 | + if(this.vlc.input.position!=0 && this.media_element.selected_source.mime_type!='video/x-flv'){ |
| 194 | + /*js_log(' set slider via input.position: ' + |
| 195 | + this.media_element.selected_source.mime_type + ' pos:'+ this.vlc.input.position); |
| 196 | + */ |
197 | 197 | this.setSliderValue(this.vlc.input.position); |
198 | 198 | }else{ |
199 | 199 | //set via time: |
— | — | @@ -204,9 +204,6 @@ |
205 | 205 | } |
206 | 206 | //js_log('set status: '+ seconds2ntp(this.currentTime) + ' e:'+seconds2ntp(this.duration+this.start_offset)); |
207 | 207 | this.setStatus(seconds2ntp(this.currentTime) + '/' + seconds2ntp(this.duration+this.start_offset) ); |
208 | | - }else{ |
209 | | - //update info to seek to: |
210 | | - this.setStatus('seek to: ' + seconds2ntp(Math.round( (this.sliderVal*this.duration)) )); |
211 | 208 | } |
212 | 209 | } |
213 | 210 | }else{ |
— | — | @@ -272,8 +269,10 @@ |
273 | 270 | this.vlc.playlist.togglePause(); |
274 | 271 | }, |
275 | 272 | fullscreen : function(){ |
276 | | - if(this.vlc) |
277 | | - this.vlc.video.toggleFullscreen(); |
| 273 | + if(this.vlc){ |
| 274 | + if(this.vlc.video) |
| 275 | + this.vlc.video.toggleFullscreen(); |
| 276 | + } |
278 | 277 | }, |
279 | 278 | /* returns current time in float seconds |
280 | 279 | * as per html5 we should just have an attribute by name of CurrentTime |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed.js |
— | — | @@ -1,5 +1,5 @@ |
2 | | -/** @fileoverview |
3 | | - * ~mv_embed~ |
| 2 | +/* |
| 3 | + * ~mv_embed version 1.0~ |
4 | 4 | * for details see: http://metavid.ucsc.edu/wiki/index.php/Mv_embed |
5 | 5 | * |
6 | 6 | * All Metavid Wiki code is Released under the GPL2 |
— | — | @@ -97,6 +97,12 @@ |
98 | 98 | gMsg['close']='close'; |
99 | 99 | gMsg['improve_transcript']='Improve Transcript'; |
100 | 100 | |
| 101 | +gMsg['next_clip_msg']='Play Next Clip'; |
| 102 | +gMsg['prev_clip_msg']='Play Previus Clip'; |
| 103 | +gMsg['current_clip_msg']='Continue Playing this Clip'; |
| 104 | + |
| 105 | +gMsg['seek_to']='Seek to'; |
| 106 | + |
101 | 107 | //grabs from the globalMsg obj |
102 | 108 | //@@todo integrate msg serving into CMS |
103 | 109 | function getMsg( key ) { |
— | — | @@ -556,7 +562,7 @@ |
557 | 563 | 'volume_control':{ |
558 | 564 | 'w':22, |
559 | 565 | 'o':function(){ |
560 | | - return '<div class="volume_icon"><a href="javascript:$j(\'#'+ctrlBuilder.id+'\').get(0).toggleMute();"></a></div>' |
| 566 | + return '<div id="volume_icon_'+ctrlBuilder.id+'" class="volume_icon"><a href="javascript:$j(\'#'+ctrlBuilder.id+'\').get(0).toggleMute();"></a></div>' |
561 | 567 | } |
562 | 568 | }, |
563 | 569 | 'time_display':{ |
— | — | @@ -1088,7 +1094,7 @@ |
1089 | 1095 | $j.each(this.pe.media_element.sources, function(inx, n){ |
1090 | 1096 | if(n.mime_type=='text/cmml'){ |
1091 | 1097 | _this.availableTracks[n.id] = { |
1092 | | - src:n.uri, |
| 1098 | + src:n.src, |
1093 | 1099 | title:n.title, |
1094 | 1100 | loaded:false, |
1095 | 1101 | display:false |
— | — | @@ -1356,9 +1362,9 @@ |
1357 | 1363 | { |
1358 | 1364 | js_log(element); |
1359 | 1365 | |
1360 | | - this.uri = $j(element).attr('src'); |
| 1366 | + this.src = $j(element).attr('src'); |
1361 | 1367 | if(ogg_chop_links) |
1362 | | - this.uri = this.uri.replace(".anx", ''); |
| 1368 | + this.src = this.src.replace(".anx", ''); |
1363 | 1369 | this.marked_default = false; |
1364 | 1370 | |
1365 | 1371 | var tag = element.tagName.toLowerCase(); |
— | — | @@ -1371,7 +1377,7 @@ |
1372 | 1378 | else if ($j(element).attr('content-type')) |
1373 | 1379 | this.mime_type = $j(element).attr('content-type'); |
1374 | 1380 | else |
1375 | | - this.mime_type = this.detectType(this.uri); |
| 1381 | + this.mime_type = this.detectType(this.src); |
1376 | 1382 | |
1377 | 1383 | js_log("MIME TYPE: "+ this.mime_type ); |
1378 | 1384 | |
— | — | @@ -1393,7 +1399,7 @@ |
1394 | 1400 | this.start = $j(element).attr("start"); |
1395 | 1401 | if($j(element).attr("end")) |
1396 | 1402 | this.start = $j(element).attr("end"); |
1397 | | - //js_log('Adding mediaSource of type ' + this.mime_type + ' and uri ' + this.uri + ' and title ' + this.title); |
| 1403 | + //js_log('Adding mediaSource of type ' + this.mime_type + ' and uri ' + this.src + ' and title ' + this.title); |
1398 | 1404 | this.parseURLDuration(); |
1399 | 1405 | }, |
1400 | 1406 | /** updates the src time and start & end |
— | — | @@ -1402,23 +1408,23 @@ |
1403 | 1409 | */ |
1404 | 1410 | updateSrcTime:function (start_ntp, end_ntp){ |
1405 | 1411 | js_log("f:updateSrcTime: "+ start_ntp+'/'+ end_ntp); |
1406 | | - //js_log("pre uri:" + this.uri); |
| 1412 | + //js_log("pre uri:" + this.src); |
1407 | 1413 | //if we have time we can use: |
1408 | 1414 | if(this.start_ntp!=null){ |
1409 | 1415 | var index_time_val = false; |
1410 | 1416 | var time_req_delimitator = ''; |
1411 | | - if(this.uri.indexOf('?t=')!=-1)index_time_val='?t='; |
1412 | | - if(this.uri.indexOf('&t=')!=-1)index_time_val='&t='; |
| 1417 | + if(this.src.indexOf('?t=')!=-1)index_time_val='?t='; |
| 1418 | + if(this.src.indexOf('&t=')!=-1)index_time_val='&t='; |
1413 | 1419 | if(index_time_val){ |
1414 | | - var end_req_string = (this.uri.indexOf('&', this.uri.indexOf(index_time_val)+3)==-1)? |
| 1420 | + var end_req_string = (this.src.indexOf('&', this.src.indexOf(index_time_val)+3)==-1)? |
1415 | 1421 | '': |
1416 | | - this.uri.indexOf('&', this.uri.indexOf(index_time_val)); |
1417 | | - this.uri = this.uri.substring(0, this.uri.indexOf(index_time_val) ) + index_time_val + start_ntp + '/'+end_ntp + end_req_string; |
| 1422 | + this.src.indexOf('&', this.src.indexOf(index_time_val)); |
| 1423 | + this.src = this.src.substring(0, this.src.indexOf(index_time_val) ) + index_time_val + start_ntp + '/'+end_ntp + end_req_string; |
1418 | 1424 | } |
1419 | 1425 | } |
1420 | 1426 | //update the duration |
1421 | 1427 | this.parseURLDuration(); |
1422 | | - //js_log("post uri:" + this.uri); |
| 1428 | + //js_log("post uri:" + this.src); |
1423 | 1429 | }, |
1424 | 1430 | /** MIME type accessor function. |
1425 | 1431 | @return the MIME type of the source. |
— | — | @@ -1429,12 +1435,22 @@ |
1430 | 1436 | return this.mime_type; |
1431 | 1437 | }, |
1432 | 1438 | /** URI accessor function. |
| 1439 | + * @param int seek_time_sec (used to adjust the URI for players that can't do local seeks well on given media types) |
1433 | 1440 | @return the URI of the source. |
1434 | 1441 | @type String |
1435 | 1442 | */ |
1436 | | - getURI : function() |
| 1443 | + getURI : function(seek_time_sec) |
1437 | 1444 | { |
1438 | | - return this.uri; |
| 1445 | + if(!seek_time_sec) |
| 1446 | + return this.src; |
| 1447 | + |
| 1448 | + pSrc = parseUri(this.src); |
| 1449 | + var new_url = pSrc.protocol +'://'+ pSrc.host + pSrc.path +'?'; |
| 1450 | + for(i in pSrc.queryKey){ |
| 1451 | + new_url +=(i=='t')?'t=' + seconds2ntp(seek_time_sec) +'/'+ this.end_ntp +'&' : |
| 1452 | + i+'='+ pSrc.queryKey[i]+'&'; |
| 1453 | + } |
| 1454 | + return new_url; |
1439 | 1455 | }, |
1440 | 1456 | /** Title accessor function. |
1441 | 1457 | @return the title of the source. |
— | — | @@ -1458,23 +1474,22 @@ |
1459 | 1475 | * supports media_url?t=ntp_start/ntp_end url request format |
1460 | 1476 | */ |
1461 | 1477 | parseURLDuration : function(){ |
1462 | | - js_log('f:parseURLDuration() for:' + this.uri); |
| 1478 | + js_log('f:parseURLDuration() for:' + this.src); |
1463 | 1479 | var index_time_val = false; |
1464 | | - if(this.uri.indexOf('?t=')!=-1)index_time_val='?t='; |
1465 | | - if(this.uri.indexOf('&t=')!=-1)index_time_val='&t='; |
| 1480 | + if(this.src.indexOf('?t=')!=-1)index_time_val='?t='; |
| 1481 | + if(this.src.indexOf('&t=')!=-1)index_time_val='&t='; |
1466 | 1482 | if(index_time_val){ |
1467 | | - var end_index = (this.uri.indexOf('&', this.uri.indexOf(index_time_val)+3)==-1)? |
1468 | | - this.uri.length: |
1469 | | - this.uri.indexOf('&', this.uri.indexOf(index_time_val)); |
1470 | | - this.start_ntp = this.uri.substring( |
1471 | | - this.uri.indexOf(index_time_val)+index_time_val.length, |
1472 | | - this.uri.indexOf('/', this.uri.indexOf(index_time_val) )); |
1473 | | - this.end_ntp = this.uri.substring( |
1474 | | - this.uri.indexOf('/', this.uri.indexOf(index_time_val))+1, end_index); |
| 1483 | + var end_index = (this.src.indexOf('&', this.src.indexOf(index_time_val)+3)==-1)? |
| 1484 | + this.src.length: |
| 1485 | + this.src.indexOf('&', this.src.indexOf(index_time_val)); |
| 1486 | + this.start_ntp = this.src.substring( |
| 1487 | + this.src.indexOf(index_time_val)+index_time_val.length, |
| 1488 | + this.src.indexOf('/', this.src.indexOf(index_time_val) )); |
| 1489 | + this.end_ntp = this.src.substring( |
| 1490 | + this.src.indexOf('/', this.src.indexOf(index_time_val))+1, end_index); |
1475 | 1491 | this.start_offset = ntp2seconds(this.start_ntp); |
1476 | 1492 | this.duration = ntp2seconds( this.end_ntp ) - this.start_offset; |
1477 | | - //keep values in float seconds |
1478 | | - this.start_offset = this.start_offset |
| 1493 | + |
1479 | 1494 | this.duration = this.duration; |
1480 | 1495 | }else{ |
1481 | 1496 | //else normal media request (can't predict the duration without the plugin reading it) |
— | — | @@ -1750,6 +1765,11 @@ |
1751 | 1766 | thumbnail_disp:true, |
1752 | 1767 | init_with_sources_loadedDone:false, |
1753 | 1768 | inDOM:false, |
| 1769 | + //for onClip done stuff: |
| 1770 | + anno_data_cache:null, |
| 1771 | + seek_time_sec:0, |
| 1772 | + base_seeker_slider_offset:null, |
| 1773 | + onClipDone_disp:false, |
1754 | 1774 | supports:{}, |
1755 | 1775 | //utility functions for property values: |
1756 | 1776 | hx : function ( s ) { |
— | — | @@ -1906,6 +1926,7 @@ |
1907 | 1927 | |
1908 | 1928 | js_log("READY TO PLAY:"+_this.id); |
1909 | 1929 | _this.ready_to_play=true; |
| 1930 | + _this.getDuration(); |
1910 | 1931 | _this.getHTML(); |
1911 | 1932 | }); |
1912 | 1933 | }, |
— | — | @@ -1927,7 +1948,7 @@ |
1928 | 1949 | if(!this.media_element.selected_source.start_ntp) |
1929 | 1950 | return default_time_req; |
1930 | 1951 | return this.media_element.selected_source.start_ntp+'/'+this.media_element.selected_source.end_ntp; |
1931 | | - }, |
| 1952 | + }, |
1932 | 1953 | getDuration:function(){ |
1933 | 1954 | this.duration = this.media_element.selected_source.duration; |
1934 | 1955 | return this.duration; |
— | — | @@ -1981,24 +2002,189 @@ |
1982 | 2003 | $j("#mv_play_pause_button_"+_this.id).attr('class', 'pause_button'); |
1983 | 2004 | }); |
1984 | 2005 | }, |
| 2006 | + /* todo abstract out onClipDone chain of functions and merge with textInterface */ |
1985 | 2007 | onClipDone:function(){ |
1986 | 2008 | //stop the clip (load the thumbnail etc) |
1987 | 2009 | this.stop(); |
1988 | 2010 | var _this = this; |
1989 | | - //now load roe if nessesary and showNextPrevLinks |
| 2011 | + |
| 2012 | + //if the clip resolution is < 320 don't do fancy onClipDone stuff |
| 2013 | + if(this.width<300){ |
| 2014 | + return ; |
| 2015 | + } |
| 2016 | + this.onClipDone_disp=true; |
| 2017 | + $j('#img_thumb_'+this.id).css('zindex',1); |
| 2018 | + $j('#big_play_link_'+this.id).hide(); |
| 2019 | + //add the liks_info_div black back |
| 2020 | + $j('#dc_'+this.id).append('<div id="liks_info_'+this.id+'" ' + |
| 2021 | + 'style="width:' +parseInt(parseInt(this.width)/2)+'px;'+ |
| 2022 | + 'height:'+ parseInt(parseInt(this.height)) +'px;'+ |
| 2023 | + 'position:absolute;top:10px;'+ |
| 2024 | + 'width: '+parseInt( ((parseInt(this.width)/2)-15) ) + 'px;'+ |
| 2025 | + 'left:'+ parseInt( ((parseInt(this.width)/2)+15) ) +'px;">'+ |
| 2026 | + '</div>' + |
| 2027 | + '<div id="black_back_'+this.id+'" ' + |
| 2028 | + 'style="z-index:-2;position:absolute;background:#000;' + |
| 2029 | + 'top:0px;left:0px;width:'+parseInt(this.width)+'px;' + |
| 2030 | + 'height:'+parseInt(this.height)+'px;">' + |
| 2031 | + '</div>'); |
| 2032 | + |
| 2033 | + //start animation (make thumb small in uper left add in div for "loading" |
| 2034 | + $j('#img_thumb_'+this.id).animate({ |
| 2035 | + width:parseInt(parseInt(_this.width)/2), |
| 2036 | + height:parseInt(parseInt(_this.height)/2), |
| 2037 | + top:20, |
| 2038 | + left:10 |
| 2039 | + }, |
| 2040 | + 1000, |
| 2041 | + function(){ |
| 2042 | + //animation done.. add "loading" to div if empty |
| 2043 | + if($j('#liks_info_'+_this.id).html()==''){ |
| 2044 | + $j('#liks_info_'+_this.id).html(getMsg('loading_txt')); |
| 2045 | + } |
| 2046 | + } |
| 2047 | + ) |
| 2048 | + //now load roe if nessesaryand showNextPrevLinks |
1990 | 2049 | if(this.roe && this.media_element.addedROEData==false){ |
1991 | 2050 | do_request(this.roe, function(data) |
1992 | 2051 | { |
1993 | 2052 | _this.media_element.addROE(data); |
1994 | | - _this.showNextPrevLinks(); |
| 2053 | + _this.getNextPrevLinks(); |
1995 | 2054 | }); |
1996 | 2055 | }else{ |
1997 | | - this.showNextPrevLinks(); |
| 2056 | + this.getNextPrevLinks(); |
1998 | 2057 | } |
1999 | 2058 | }, |
| 2059 | + //@@todo we should merge getNextPrevLinks with textInterface .. there is repeated code between them. |
| 2060 | + getNextPrevLinks:function(){ |
| 2061 | + js_log('f:getNextPrevLinks'); |
| 2062 | + var anno_track_url = null; |
| 2063 | + var _this = this; |
| 2064 | + //check for annoative track |
| 2065 | + $j.each(this.media_element.sources, function(inx, n){ |
| 2066 | + if(n.mime_type=='text/cmml'){ |
| 2067 | + if( n.id == 'Anno_en'){ |
| 2068 | + anno_track_url = n.src; |
| 2069 | + } |
| 2070 | + } |
| 2071 | + }); |
| 2072 | + if(anno_track_url){ |
| 2073 | + js_log('found annotative track'+ anno_track_url); |
| 2074 | + //zero out seconds (should improve cache hit rate and generally expands metadata search) |
| 2075 | + //@@todo this could be repalced with a regExp |
| 2076 | + var annoURL = parseUri(anno_track_url); |
| 2077 | + var times = annoURL.queryKey['t'].split('/'); |
| 2078 | + var stime_parts = times[0].split(':'); |
| 2079 | + var etime_parts = times[0].split(':'); |
| 2080 | + //zero out the hour: |
| 2081 | + var new_start = stime_parts[0]+':'+'0:0'; |
| 2082 | + //zero out the end sec |
| 2083 | + var new_end = (etime_parts[0]== stime_parts[0])? (etime_parts[0]+1)+':0:0' :etime_parts[0]+':0:0'; |
| 2084 | + |
| 2085 | + var etime_parts = times[1].split(':'); |
| 2086 | + |
| 2087 | + var new_anno_track_url = annoURL.protocol +'://'+ annoURL.host + annoURL.path +'?'; |
| 2088 | + for(i in annoURL.queryKey){ |
| 2089 | + new_anno_track_url +=(i=='t')?'t='+new_start+'/'+new_end +'&' : |
| 2090 | + i+'='+ annoURL.queryKey[i]+'&'; |
| 2091 | + } |
| 2092 | + var request_key = new_start+'/'+new_end; |
| 2093 | + //check the anno_data cache: |
| 2094 | + //@@todo search cache see if current is in range. |
| 2095 | + if(this.anno_data_cache){ |
| 2096 | + js_log('anno data found in cache: '+request_key); |
| 2097 | + this.showNextPrevLinks(); |
| 2098 | + }else{ |
| 2099 | + do_request(new_anno_track_url, function(cmml_data){ |
| 2100 | + js_log('raw response: '+ cmml_data); |
| 2101 | + if(typeof cmml_data == 'string') |
| 2102 | + { |
| 2103 | + var parser=new DOMParser(); |
| 2104 | + js_log('Parse CMML data:' + cmml_data); |
| 2105 | + cmml_data=parser.parseFromString(cmml_data,"text/xml"); |
| 2106 | + } |
| 2107 | + //init anno_data_cache |
| 2108 | + if(!_this.anno_data_cache) |
| 2109 | + _this.anno_data_cache={}; |
| 2110 | + //grab all metadata and put it into the anno_data_cache: |
| 2111 | + $j.each(cmml_data.getElementsByTagName('clip'), function(inx, clip){ |
| 2112 | + _this.anno_data_cache[ $j(clip).attr("id") ]={ |
| 2113 | + 'start_time_sec':ntp2seconds($j(clip).attr("start").replace('npt:','')), |
| 2114 | + 'end_time_sec':ntp2seconds($j(clip).attr("end").replace('npt:','')), |
| 2115 | + 'time_req':$j(clip).attr("start").replace('npt:','')+'/'+$j(clip).attr("end").replace('npt:','') |
| 2116 | + }; |
| 2117 | + //grab all its meta |
| 2118 | + _this.anno_data_cache[ $j(clip).attr("id") ]['meta']={}; |
| 2119 | + $j.each(clip.getElementsByTagName('meta'),function(imx, meta){ |
| 2120 | + //js_log('adding meta: '+ $j(meta).attr("name")+ ' = '+ $j(meta).attr("content")); |
| 2121 | + _this.anno_data_cache[$j(clip).attr("id")]['meta'][$j(meta).attr("name")]=$j(meta).attr("content"); |
| 2122 | + }); |
| 2123 | + }); |
| 2124 | + _this.showNextPrevLinks(); |
| 2125 | + }); |
| 2126 | + } |
| 2127 | + }else{ |
| 2128 | + js_log('no annotative track found'); |
| 2129 | + } |
| 2130 | + //query current request time +|- 60s to get prev next speech links. |
| 2131 | + }, |
2000 | 2132 | showNextPrevLinks:function(){ |
| 2133 | + //int requested links: |
| 2134 | + var link = { |
| 2135 | + 'prev':'', |
| 2136 | + 'current':'', |
| 2137 | + 'next':'' |
| 2138 | + } |
| 2139 | + var curTime = this.getTimeReq().split('/'); |
2001 | 2140 | |
| 2141 | + var s_sec = ntp2seconds(curTime[0]); |
| 2142 | + var e_sec = ntp2seconds(curTime[1]); |
| 2143 | + |
| 2144 | + //now we have all the data in anno_data_cache |
| 2145 | + for(var clip_id in this.anno_data_cache){ |
| 2146 | + var clip = this.anno_data_cache[clip_id]; |
| 2147 | + //js_log('on clip:'+ clip_id); |
| 2148 | + //set prev_link (if cur_link is still empty) |
| 2149 | + if(s_sec < clip.start_time_sec && link.current=='') |
| 2150 | + link.prev = clip_id; |
| 2151 | + |
| 2152 | + //clip is encapsulated by the current clip add current link: |
| 2153 | + if(s_sec > clip.start_time_sec && e_sec < clip.end_time_sec ) |
| 2154 | + link.current = clip_id; |
| 2155 | + |
| 2156 | + if(e_sec < clip.start_time_sec && link.next=='') |
| 2157 | + link.next = clip_id; |
| 2158 | + } |
| 2159 | + var html=''; |
| 2160 | + for(var link_type in link){ |
| 2161 | + var link_id = link[link_type]; |
| 2162 | + if(link_id!=''){ |
| 2163 | + var clip = this.anno_data_cache[link_id]; |
| 2164 | + |
| 2165 | + var title_msg=''; |
| 2166 | + for(var j in clip['meta']){ |
| 2167 | + title_msg+=j.replace(/_/g,' ') +': ' +clip['meta'][j].replace(/_/g,' ') +" \n"; |
| 2168 | + } |
| 2169 | + var time_req = clip.time_req; |
| 2170 | + if(link_type=='current') //if current start from end of current clip play to end of current meta: |
| 2171 | + time_req = curTime[1]+ '/' + seconds2ntp(clip.end_time_sec); |
| 2172 | + |
| 2173 | + html+='<p><a href="#" title="' +title_msg + '" '+ |
| 2174 | + 'onClick="$j(\'#'+this.id+'\').get(0).playByTimeReq(\''+ |
| 2175 | + time_req + '\'); return false; ">' + |
| 2176 | + getMsg(link_type+'_clip_msg') + |
| 2177 | + '</a></p>'; |
| 2178 | + } |
| 2179 | + } |
| 2180 | + //js_log("should set html:"+ html); |
| 2181 | + $j('#liks_info_'+this.id).html(html); |
2002 | 2182 | }, |
| 2183 | + playByTimeReq: function(time_req){ |
| 2184 | + js_log('f:playByTimeReq: '+time_req ); |
| 2185 | + this.stop(); |
| 2186 | + this.updateVideoTimeReq(time_req); |
| 2187 | + this.play(); |
| 2188 | + }, |
2003 | 2189 | doThumbnailHTML:function() |
2004 | 2190 | { |
2005 | 2191 | js_log('f:doThumbnailHTML'); |
— | — | @@ -2032,7 +2218,7 @@ |
2033 | 2219 | getHTML : function (){ |
2034 | 2220 | //@@todo check if we have sources avaliable |
2035 | 2221 | js_log('f : getHTML'); |
2036 | | - |
| 2222 | + var _this = this; |
2037 | 2223 | var html_code = ''; |
2038 | 2224 | html_code = '<div id="videoPlayer_'+this.id+'" style="width:'+this.width+'px;" class="videoPlayer">'; |
2039 | 2225 | html_code += '<div style="width:'+parseInt(this.width)+'px;height:'+parseInt(this.height)+'px;" id="mv_embedded_player_'+this.id+'">' + |
— | — | @@ -2053,7 +2239,44 @@ |
2054 | 2240 | } |
2055 | 2241 | html_code += '</div>'; //videoPlayer div close |
2056 | 2242 | js_log('should set: '+this.id); |
2057 | | - $j(this).html(html_code); |
| 2243 | + $j(this).html(html_code); |
| 2244 | + |
| 2245 | + if(!_this.base_seeker_slider_offset) |
| 2246 | + _this.base_seeker_slider_offset = $j('#mv_seeker_slider_'+_this.id).get(0).offsetLeft; |
| 2247 | + |
| 2248 | + _this.start_time_sec = ntp2seconds(_this.getTimeReq().split('/')[0]); |
| 2249 | + |
| 2250 | + js_log('start sec: '+_this.start_time_sec + ' base offset: '+_this.base_seeker_slider_offset); |
| 2251 | + |
| 2252 | + //buid dragable hook here: |
| 2253 | + $j('#mv_seeker_slider_'+this.id).draggable({ |
| 2254 | + containment:'parent', |
| 2255 | + axis:'x', |
| 2256 | + opacity:.6, |
| 2257 | + start:function(e, ui){ |
| 2258 | + _this.userSlide=true; |
| 2259 | + js_log("started draging set userSlide"+_this.userSlide) |
| 2260 | + }, |
| 2261 | + drag:function(e, ui){ |
| 2262 | + //@@todo get the -14 number from the skin somehow |
| 2263 | + var perc = (($j('#mv_seeker_slider_'+_this.id).get(0).offsetLeft-_this.base_seeker_slider_offset) |
| 2264 | + / |
| 2265 | + ($j('#mv_seeker_'+_this.id).width()-14)); |
| 2266 | + |
| 2267 | + this.jump_time = seconds2ntp(parseInt(_this.duration*perc)+ _this.start_time_sec); |
| 2268 | + js_log('perc:' + perc + ' * ' + _this.duration + ' jt:'+ this.jump_time); |
| 2269 | + _this.setStatus( getMsg('seek_to')+' '+this.jump_time ); |
| 2270 | + }, |
| 2271 | + stop:function(e, ui){ |
| 2272 | + _this.userSlide=false; |
| 2273 | + js_log('do jump to: '+this.jump_time) |
| 2274 | + //reset slider |
| 2275 | + _this.seek_time_sec=ntp2seconds(this.jump_time); |
| 2276 | + _this.stop(); |
| 2277 | + _this.play(); |
| 2278 | + } |
| 2279 | + }); |
| 2280 | + |
2058 | 2281 | //js_log('set this to: ' + $j(this).html() ); |
2059 | 2282 | //alert('stop'); |
2060 | 2283 | //if auto play==true directly embed the plugin |
— | — | @@ -2085,7 +2308,11 @@ |
2086 | 2309 | //update media |
2087 | 2310 | this.media_element.updateSourceTimes(start_time, end_time); |
2088 | 2311 | //update mv_time |
2089 | | - $j('#mv_time_'+ this.id).html(start_time+'/'+end_time); |
| 2312 | + this.setStatus(start_time+'/'+end_time); |
| 2313 | + //reset slider |
| 2314 | + this.setSliderValue(0); |
| 2315 | + //reset seek_offset: |
| 2316 | + this.seek_time_sec=0; |
2090 | 2317 | }, |
2091 | 2318 | //updates the video src |
2092 | 2319 | updateVideoSrc : function(src){ |
— | — | @@ -2430,20 +2657,23 @@ |
2431 | 2658 | //this.innerHTML = this.getPluginMissingHTML(); |
2432 | 2659 | //$j(this).html(this.getPluginMissingHTML()); |
2433 | 2660 | $j('#'+this.id).html(this.getPluginMissingHTML()); |
2434 | | - }else |
| 2661 | + }else{ |
2435 | 2662 | this.doEmbedHTML(); |
| 2663 | + this.onClipDone_disp=false; |
| 2664 | + } |
2436 | 2665 | }else{ |
2437 | 2666 | //the plugin is already being displayed |
2438 | 2667 | js_log("we are already playing" ); |
2439 | 2668 | } |
2440 | 2669 | }, |
2441 | | - toggleMute:function(){ |
| 2670 | + toggleMute:function(){ |
2442 | 2671 | if(this.muted){ |
2443 | 2672 | this.muted=false; |
| 2673 | + $j('#volume_icon_'+this.id).removeClass('volume_off').addClass('volume_on'); |
2444 | 2674 | }else{ |
2445 | 2675 | this.muted=true; |
| 2676 | + $j('#volume_icon_'+this.id).removeClass('volume_on').addClass('volume_off'); |
2446 | 2677 | } |
2447 | | - //update audio icon: |
2448 | 2678 | }, |
2449 | 2679 | play_or_pause : function(){ |
2450 | 2680 | js_log('base play or pause'); |
— | — | @@ -2469,7 +2699,7 @@ |
2470 | 2700 | //if we are not in playlist mode stop: |
2471 | 2701 | if(!this.pc){ |
2472 | 2702 | this.stop(); |
2473 | | - } |
| 2703 | + } |
2474 | 2704 | }, |
2475 | 2705 | /* |
2476 | 2706 | * base embed pause |
— | — | @@ -2491,6 +2721,7 @@ |
2492 | 2722 | }else{ |
2493 | 2723 | //rewrite the html to thumbnail disp |
2494 | 2724 | this.doThumbnailHTML(); |
| 2725 | + this.setSliderValue(0); |
2495 | 2726 | } |
2496 | 2727 | if(this.update_interval) |
2497 | 2728 | { |
— | — | @@ -2580,25 +2811,7 @@ |
2581 | 2812 | }); |
2582 | 2813 | //if(!slider_id)slider_id=this.id; |
2583 | 2814 | //get a pointer to this id (as this in onSlide context is not "this") |
2584 | | - /*var parent_id = this.id; */ |
2585 | | - /*this.slider = new Control.Slider('playhead_'+this.id, 'track_'+this.id,{ |
2586 | | - sliderValue:0, |
2587 | | - onSlide:function(v){ |
2588 | | - if(! thisVid.userSlide){ |
2589 | | - //user slide clip: |
2590 | | - thisVid.userSlide=true; |
2591 | | - js_log('user slide: ' + thisVid.userSlide); |
2592 | | - } |
2593 | | - }, |
2594 | | - onChange:function(v){ |
2595 | | - if(thisVid.userSlide==true){ |
2596 | | - //seek to a given position: |
2597 | | - js_log('this.userSlide seek to: ' + v); |
2598 | | - thisVid.doSeek(v); |
2599 | | - thisVid.userSlide=false; |
2600 | | - } |
2601 | | - } |
2602 | | - });*/ |
| 2815 | + /*var parent_id = this.id; */ |
2603 | 2816 | }, |
2604 | 2817 | setSliderValue: function(perc){ |
2605 | 2818 | var id = (this.pc)?this.pc.pp.id:this.id; |
— | — | @@ -2606,8 +2819,10 @@ |
2607 | 2820 | if(!this.mv_seeker_width) |
2608 | 2821 | this.mv_seeker_width = $j('#mv_seeker_slider_'+id).width(); |
2609 | 2822 | |
| 2823 | + js_log('currentTime:'+ this.currentTime); |
| 2824 | + |
2610 | 2825 | var val = Math.round( perc * $j('#mv_seeker_'+id).width() - (this.mv_seeker_width*perc)); |
2611 | | - $j('#mv_seeker_slider_'+id).css('marginLeft', val ); |
| 2826 | + $j('#mv_seeker_slider_'+id).css('left', (val+41)+'px' ); |
2612 | 2827 | //js_log('perc in: ' + perc + ' * ' + $j('#mv_seeker_'+id).width() + ' = set to: '+ val + ' - '+ Math.round(this.mv_seeker_width*perc) ); |
2613 | 2828 | //js_log('op:' + offset_perc + ' *('+perc+' * ' + $j('#slider_'+id).width() + ')'); |
2614 | 2829 | }, |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/skin/styles.css |
— | — | @@ -70,21 +70,25 @@ |
71 | 71 | display: inline; |
72 | 72 | background: url(images/player_button_play.png) 2px 0 no-repeat; |
73 | 73 | } |
74 | | - |
75 | | -.videoPlayer a { |
76 | | -display: block; |
77 | | -height: 100%; |
78 | | -width: 100%; |
| 74 | +.controls a{ |
| 75 | + display: block; |
| 76 | + height: 100%; |
| 77 | + width: 100%; |
79 | 78 | } |
80 | | - |
81 | 79 | .videoPlayer .volume_icon { |
82 | 80 | float: right; |
83 | 81 | display: inline; |
84 | 82 | width: 22px; |
85 | 83 | height: 29px; |
86 | 84 | padding: 0 0 0 0; |
| 85 | + |
| 86 | +} |
| 87 | +.volume_on { |
87 | 88 | background: url(images/player_volume_tag.png) 0 8px no-repeat; |
88 | 89 | } |
| 90 | +.volume_off{ |
| 91 | + background: url(images/player_volume_tag_off.png) 0 8px no-repeat; |
| 92 | +} |
89 | 93 | |
90 | 94 | .videoPlayer .volume_control { |
91 | 95 | width: 42px; |