<html>
<head>
<title>Sample Themed Player</title>
+ <!-- <script type="text/javascript" src="../jsScriptLoader.php?class=mv_embed,embedVideo&urid=1"></script> -->
<script type="text/javascript" src="../mv_embed.js?debug=true"></script>
</head>
<script type="text/javascript">
transOut="xFade"
type="video/ogg"
fill="transition"
+ durationHint="15"
dur="7s"
poster="http://upload.wikimedia.org/wikipedia/commons/thumb/d/d3/Okapia_johnstoni5.ogg/mid-Okapia_johnstoni5.ogg.jpg"/>
region="video_region"
fill="transition"
dur="10s"
+ durationHint="70"
type="video/ogg"
poster="http://upload.wikimedia.org/wikipedia/commons/thumb/0/0d/B-36_bomber.ogg/mid-B-36_bomber.ogg.jpg"/>
</seq>
// Try and keep aspect ratio for the thumbnail that we clicked:
var tRatio = $j( rsdElement ).height() / $j( rsdElement ).width();
- if ( ! tRatio )
+ if (! tRatio )
var tRatio = 1; // set ratio to 1 if tRatio did not work.
js_log( 'Set from ' + tRatio + ' to init thumbimage to ' + maxWidth + ' x ' + parseInt( tRatio * maxWidth ) );
'left':'5px',
'width': maxWidth + 'px',
'height': parseInt( tRatio * maxWidth ) + 'px'
- }, "slow" ); // do it slow to give it a chance to finish loading the HQ version
+ }, "slow" ); // Do it slow to give it a chance to finish loading the HQ version
if ( mediaType == 'image' ) {
_this.loadHQImg( rObj, { 'width':maxWidth }, 'rsd_edit_img', function() {
.btnBind()
.click( function() {
$j( _this.target_container ).dialog( 'close' );
- } )
-
+ } );
},
/* getClipEditControlActions
* Set-up the control actions for clipEdit with relevant callbacks
closeAll:function() {
var _this = this;
js_log( "close all:: " + _this.target_container );
- _this.cancelClipEditCB();
- $j( _this.target_container ).dialog( 'close' );
+ _this.cancelClipEditCB();
+ // Give a chance for the events to complete
+ // (somehow at least in firefox a rare condition occurs where
+ // the modal of the edit-box stick around even after the
+ // close request has been issued. )
+ setTimeout(function(){
+ $j( _this.target_container ).dialog( 'close' );
+ },10);
},
setResultBarControl:function( ) {
var _this = this;
var list_light_url = mv_skin_img_path + 'list_layout_icon.png';
var about_desc = '';
- if ( this.content_providers[this.disp_item] ) {
+ if ( this.content_providers[ this.disp_item ] ) {
var cp = this.content_providers[this.disp_item];
about_desc = '<span style="position:relative;top:0px;font-style:italic;">' +
- '<i>' + gM( 'mwe-results_from', [cp.homepage, gM( 'rsd-' + this.disp_item + '-title' ) ] ) + '</i></span>';
+ '<i>' + gM( 'mwe-results_from', [ cp.homepage, gM( 'rsd-' + this.disp_item + '-title' ) ] ) + '</i></span>';
$j( '#tab-' + this.disp_item ).append( '<div id="rds_results_bar">' +
'<span style="float:left;top:0px;font-style:italic;">' +
gM( 'rsd_layout' ) + ' ' +
'<span id="rsd_paging_ctrl" style="float:right;"></span>' +
'</div>'
);
- // get paging with bindings:
+ // Get paging with bindings:
this.getPaging( '#rsd_paging_ctrl' );
$j( '#msc_box_layout' ).hover( function() {
// roe url (for xml based metadata)
"roe" : null,
- // if roe includes metadata tracks we can expose a link to metadata
+
+ // If roe includes metadata tracks we can expose a link to metadata
"show_meta_link" : true,
// default state attributes per html5 spec:
"linkback" : null,
"embed_link" : true,
"download_link" : true,
- "type" :null, // the content type of the media
+ "type" :null // the content type of the media
};
/*
* the base source attribute checks
$j( element ).attr( "id", 'v' + mw.player_list.length );
}
js_log( "mvEmbed::rewrite:: " + $j( element ).attr( "id" ) + ' tag: ' + element.tagName.toLowerCase() );
+
// Store a global reference to the id
mw.player_list.push( $j( element ).attr( "id" ) );
if ( $j( video_element ).attr( 'wikiTitleKey' ) )
this.wikiTitleKey = $j( video_element ).attr( 'wikiTitleKey' );
-
+
if ( $j( video_element ).attr( 'durationHint' ) ) {
this.durationHint = $j( video_element ).attr( 'durationHint' );
// convert duration hint if needed:
- var sc = this.durationHint.split( ':' );
- if ( sc.length >= 1 ) {
- this.duration = npt2seconds( this.durationHint );
- } else {
- this.duration = parseFloat( this.durationHint );
- }
+ this.duration = npt2seconds( this.durationHint );
}
// Process the video_element as a source element:
}
// Set the skin name from the class
- var sn = element.getAttribute( 'class' );
+ var sn = $j(element).attr( 'class' );
if ( sn && sn != '' ) {
for ( var n = 0; n < mw.valid_skins.length; n++ ) {
if ( sn.indexOf( mw.valid_skins[n] ) !== -1 ) {
doNativeWarningCheck:function() {
if ( $j.cookie( 'dismissNativeWarn' ) && $j.cookie( 'dismissNativeWarn' ) === true ) {
return false;
- } else {
- // see if we have native support for ogg:
- var supporting_players = embedTypes.players.getMIMETypePlayers( 'video/ogg' );
- for ( var i = 0; i < supporting_players.length; i++ ) {
- if ( supporting_players[i].id == 'videoElement' ) {
- return false;
- }
+ }
+
+ // See if we have native support for ogg:
+ var supporting_players = embedTypes.players.getMIMETypePlayers( 'video/ogg' );
+ for ( var i = 0; i < supporting_players.length; i++ ) {
+ if ( supporting_players[i].id == 'videoElement' ) {
+ return false;
}
- // see if we are using mv_embed without a ogg source in which case no point in promoting firefox :P
- if ( this.media_element && this.media_element.sources ) {
- var foundOgg = false;
- var playable_sources = this.media_element.getPlayableSources();
- for ( var sInx = 0; sInx < playable_sources.length; sInx++ ) {
- var mime_type = playable_sources[sInx].mime_type;
- if ( mime_type == 'video/ogg' ) {
- foundOgg = true;
- }
+ }
+ // See if we are using mv_embed without a ogg source in which case no point in promoting firefox :P
+ if ( this.media_element && this.media_element.sources ) {
+ var foundOgg = false;
+ var playable_sources = this.media_element.getPlayableSources();
+ for ( var sInx = 0; sInx < playable_sources.length; sInx++ ) {
+ var mime_type = playable_sources[sInx].mime_type;
+ if ( mime_type == 'video/ogg' ) {
+ foundOgg = true;
}
- // no ogg src... no point in download firefox link
- if ( !foundOgg )
- return false;
-
}
+ // no ogg src... no point in download firefox link
+ if ( !foundOgg )
+ return false;
+
}
return true;
},
return this.media_element.selected_source.start_ntp + et;
},
getDuration:function() {
- // update some local pointers for the selected source:
+ // Update some local pointers for the selected source:
if ( this.media_element && this.media_element.selected_source && this.media_element.selected_source.duration ) {
this.duration = this.media_element.selected_source.duration;
this.start_offset = this.media_element.selected_source.start_offset;
this.start_ntp = this.media_element.selected_source.start_ntp;
this.end_ntp = this.media_element.selected_source.end_ntp;
}
- // update start end_ntp if duration !=0 (set from plugin)
+ // Update start end_ntp if duration !=0 (set from plugin)
if ( !this.start_ntp )
this.start_ntp = '0:0:0';
if ( !this.end_ntp && this.duration )
this.end_ntp = seconds2npt( this.duration );
- // return the duration
+ // Return the duration
return this.duration;
},
/*
// Do seek function (should be overwritten by implementing embedLibs)
// to check if seek can be done on locally downloaded content.
doSeek : function( perc ) {
+ var _this = this;
if ( this.supportsURLTimeEncoding() ) {
// make sure this.seek_time_sec is up-to-date:
this.seek_time_sec = npt2seconds( this.start_ntp ) + parseFloat( perc * this.getDuration() );
this.setSliderValue( perc );
}
// do play in 100ms (give things time to clear)
- setTimeout( '$j(\'#' + this.id + '\').get(0).play()', 100 );
+ setTimeout( function(){
+ _this.play()
+ }, 100 );
},
/*
* seeks to the requested time and issues a callback when ready
var _this = this;
// @todo: hook events to two a's for swapping in and out code for link vs. embed;
// hook events for changing active class of li based on a.
+ var o = '';
o += '<h2>' + gM( 'mwe-share_this_video' ) + '</h2>' +
'<ul>' +
- '<li><a href="#" class="active">' + gM( 'mwe-embed_site_or_blog' ) + '</a></li>';
- if ( this.linkback ) {
- o += '<li><a href="#" id="k-share-link">' + this.linkback + '</a></li>';
- }
- o += '</ul>' +
- '<div class="source_wrap"><textarea>' + embed_code + '</textarea></div>' +
- '<button class="ui-state-default ui-corner-all copycode">' + gM( 'mwe-copy-code' ) + '</button>' +
- '<div class="ui-state-highlight ui-corner-all">' + gM( 'mwe-read_before_embed' ) + '</div>' +
+ '<li><a href="#" class="active">' + gM( 'mwe-embed_site_or_blog' ) + '</a></li>';
+ if ( this.linkback )
+ o += '<li><a href="#" id="k-share-link">' + this.linkback + '</a></li>';
+ o +='</ul>' +
+ '<div class="source_wrap">'+
+ '<textarea>' + embed_code + '</textarea>'+
+ '</div>' +
+ '<button class="ui-state-default ui-corner-all copycode">' + gM( 'mwe-copy-code' ) + '</button>' +
+ '<div class="ui-state-highlight ui-corner-all">' +
+ gM( 'mwe-read_before_embed' ) +
'</div>';
$target.html( o );
$cpBtn = $j( '#' + this.id + ' .copycode' );
* underling plugin objects are responsible for updating currentTime
*/
monitor:function() {
- // js_log(' ct: ' + this.currentTime + ' dur: ' + ( parseInt( this.duration ) + 1 ) + ' is seek: ' + this.seeking );
+ //js_log(' ct: ' + this.currentTime + ' dur: ' + ( parseInt( this.duration ) + 1 ) + ' is seek: ' + this.seeking );
if ( this.currentTime && this.currentTime > 0 && this.duration ) {
if ( !this.userSlide && !this.seeking ) {
if ( this.start_offset ) {
}
// VLC
if ( this.testActiveX( 'VideoLAN.VLCPlugin.2' ) )
- this.players.addPlayer( vlcActiveXPlayer );
+ this.players.addPlayer( vlcPlayer );
// Java ActiveX
if ( this.testActiveX( 'JavaWebStart.isInstalled' ) )
var ct = new Date();
this.clockStartTime = ct.getTime();
- // start up monitor:
+ // Start up monitor:
this.monitor();
},
stop:function() {
var ct = new Date();
this.pauseTime = this.currentTime;
js_log( 'pause time: ' + this.pauseTime );
-
+
window.clearInterval( this.monitorTimerId );
},
- // monitor just needs to keep track of time (do it at frame rate time) .
+ doSeek:function( perc ){
+ this.pauseTime = perc * this.getDuration();
+ this.play();
+ },
+ setCurrentTime:function( perc, callback ){
+ this.pauseTime = perc * this.getDuration();
+ if( callback )
+ callback();
+ },
+ // Monitor just needs to keep track of time
monitor:function() {
- // js_log('html:monitor: '+ this.currentTime);
+ //js_log('html:monitor: '+ this.currentTime);
var ct = new Date();
this.currentTime = ( ( ct.getTime() - this.clockStartTime ) / 1000 ) + this.pauseTime;
var ct = new Date();
// js_log('mvPlayList:monitor trueTime: '+ this.currentTime);
-
- if ( ! this.monitorTimerId ) {
- if ( document.getElementById( this.id ) ) {
- if ( !MV_ANIMATION_CB_RATE )
- var MV_ANIMATION_CB_RATE = 33;
- this.monitorTimerId = window.setInterval( '$j(\'#' + this.id + '\').get(0).monitor()', 250 );
- }
- }
+
+ // Once currentTime is updated call parent_monitor
+ this.parent_monitor();
},
- // set up minimal media_element emulation:
+ // set up minimal media_element emulation:
media_element: {
autoSelectSource:function() {
return true;
},
selectedPlayer: {
- library:"html"
+ library : "html"
},
selected_source: {
URLTimeEncoding:false
var font_perc = ( Math.round( scale_perc * 100 ) < 80 ) ? 80 : Math.round( scale_perc * 100 );
var thumb_class = ( typeof options['thumb_class'] != 'undefined' ) ? options['thumb_class'] : '';
$j( 'body' ).append( '<div id="' + thumb_render_id + '" style="display:none">' +
- '<div class="' + thumb_class + '" ' +
- 'style="width:' + options.width + 'px;height:' + options.height + 'px;" >' +
- this.getThumbnailHTML( {
- 'width': options.width,
- 'height': options.height
- } ) +
- '</div>' +
- '</div>'
- );
+ '<div class="' + thumb_class + '" ' +
+ 'style="width:' + options.width + 'px;height:' + options.height + 'px;" >' +
+ this.getThumbnailHTML( {
+ 'width': options.width,
+ 'height': options.height
+ } ) +
+ '</div>' +
+ '</div>'
+ );
// scale down the fonts:
$j( '#' + thumb_render_id + ' *' ).filter( 'span,div,p,h,h1,h2,h3,h4,h5,h6' ).css( 'font-size', font_perc + '%' )
-
+
// replace out links:
$j( '#' + thumb_render_id + ' a' ).each( function() {
$j( this ).replaceWith( "<span>" + $j( this ).html() + "</span>" );
} );
-
+
// scale images that have width or height:
$j( '#' + thumb_render_id + ' img' ).filter( '[width]' ).each( function() {
$j( this ).attr( {
- 'width': Math.round( $j( this ).attr( 'width' ) * scale_perc ),
- 'height': Math.round( $j( this ).attr( 'height' ) * scale_perc )
- } );
+ 'width': Math.round( $j( this ).attr( 'width' ) * scale_perc ),
+ 'height': Math.round( $j( this ).attr( 'height' ) * scale_perc )
+ }
+ );
} );
}
return $j( '#' + thumb_render_id ).html();
},
- // nothing to update in static html display: (return a static representation)
+ // nothing to update in static html display: (return a static representation)
// @@todo render out a mini text "preview"
updateThumbTime:function( float_time ) {
return ;
},
getEmbedHTML:function() {
js_log( 'f:html:getEmbedHTML: ' + this.id );
- // set up the css for our parent div:
+ // set up the css for our parent div:
$j( this ).css( {
'width':this.pc.pp.width,
'height':this.pc.pp.height,
'overflow':"hidden"
} );
- // @@todo support more smil animation layout stuff:
+ // @@todo support more smil animation layout stuff:
// wrap output in videoPlayer_ div:
$j( this ).html( '<div id="videoPlayer_' + this.id + '">' + this.getThumbnailHTML() + '</div>' );
this.getEmbedHTML();
},
getDuration:function() {
- if ( this.pc.dur )
- return this.pc.dur;
- // return default value:
- return pcHtmlEmbedDefaults.dur;
+ if( !this.duration ){
+ if( this.pc.dur ){
+ this.duration = this.pc.dur;
+ }else if( pcHtmlEmbedDefaults.dur ){
+ this.duration =pcHtmlEmbedDefaults.dur ;
+ }
+ }
+ return this.parent_getDuration();
},
updateVideoTime:function( start_ntp, end_ntp ) {
// since we don't really have timeline for html elements just take the delta and set it as the duration
this.ready_to_play = true;
return ;
}
-};
+};
\ No newline at end of file
canPlayThrough:false,
grab_try_count:0,
onlyLoadFlag:false,
+ onLoadedCallback : new Array(),
urlAppend:'',
prevCurrentTime: -1,
supports: {
js_log( 'could not grab vid obj trying again:' + typeof this.vid );
this.grab_try_count++;
if ( this.grab_count == 20 ) {
- js_log( ' could not get vid object after 10 tries re-run: getEmbedObj()' ) ;
+ js_log( ' could not get vid object after 20 tries re-run: getEmbedObj() ?' ) ;
} else {
- setTimeout( '$j(\'#' + this.id + '\').get(0).postEmbedJS()', 200 );
+ setTimeout( function(){
+ _this.postEmbedJS();
+ }, 200 );
}
}
},
this.setStatus( gM( 'mwe-seeking' ) );
},
onseeked: function() {
+ js_log("onseeked");
this.seeking = false;
},
doSeek:function( perc ) {
}
readyForSeek();
},
- setCurrentTime: function( pos, callback ) {
+ setCurrentTime: function( pos, callback ) {
var _this = this;
+ js_log( 'native:setCurrentTime::: ' + pos + ' : dur: ' + _this.getDuration() );
this.getVID();
if ( !this.vid ) {
- this.load();
- var loaded = function( event ) {
- js_log( 'native:setCurrentTime (after load): ' + pos + ' : dur: ' + this.getDuration() );
- _this.vid.currentTime = pos;
- var once = function( event ) {
- callback();
- _this.vid.removeEventListener( 'seeked', once, false )
- };
- _this.vid.addEventListener( 'seeked', once, false );
- _this.removeEventListener( 'loadedmetadata', loaded, false );
- };
- _this.addEventListener( 'loadedmetadata', loaded, false );
+ this.load( function() {
+ _this.doSeekedCb( pos, callback );
+ } );
} else {
- // js_log('native:setCurrentTime: ' + pos + ' : ' + this.supportsURLTimeEncoding() + ' dur: ' + this.getDuration() + ' sts:' + this.seek_time_sec );
- _this.vid.currentTime = pos;
- var once = function( event ) {
- callback();
- _this.vid.removeEventListener( 'seeked', once, false )
- };
- _this.vid.addEventListener( 'seeked', once, false );
+ _this.doSeekedCb( pos, callback );
}
},
+ doSeekedCb : function( pos, cb ){
+ var _this = this;
+ this.getVID();
+ var once = function( event ) {
+ js_log("did seek cb");
+ cb();
+ _this.vid.removeEventListener( 'seeked', once, false );
+ };
+ // Assume we will get to add the Listener before the seek is done
+ _this.vid.currentTime = pos;
+ _this.vid.addEventListener( 'seeked', once, false );
+ },
monitor : function() {
this.getVID(); // make sure we have .vid obj
if ( !this.vid ) {
return true;
}
- // do a seek check (on seeked does not seem fire consistantly)
+ // Do a seek check (on seeked does not seem fire consistently)
if ( this.prevCurrentTime != -1 && this.prevCurrentTime != 0
&& this.prevCurrentTime < this.currentTime && this.seeking )
this.seeking = false;
* native callbacks for the video tag:
*/
oncanplaythrough : function() {
- // js_log('f:oncanplaythrough');
+ js_log('f:oncanplaythrough');
this.getVID();
if ( ! this.paused )
- this.vid.play();
+ this.vid.play();
},
onloadedmetadata: function() {
this.getVID();
js_log( 'updaed duration via native video duration: ' + this.vid.duration )
this.duration = this.vid.duration;
}
+ //fire "onLoaded" flags if set
+ while( this.onLoadedCallback.length ){
+ this.onLoadedCallback.pop()();
+ }
},
onprogress: function( e ) {
this.bufferedPercent = e.loaded / e.total;
if ( this.vid )
return this.vid.duration;
},
- load:function() {
- this.getVID();
+ load:function( callback ) {
+ this.getVID();
if ( !this.vid ) {
// no vid loaded
js_log( 'native::load() ... doEmbed' );
this.onlyLoadFlag = true;
this.doEmbedHTML();
+ this.onLoadedCallback.push( callback );
} else {
- // won't happen offten
+ // should not happen offten
this.vid.load();
+ if( callback)
+ callback();
}
},
// get the embed vlc object
getVID : function () {
this.vid = $j( '#' + this.pid ).get( 0 );
- },
- /*
- * playlist driver
- * mannages native playlist calls
- */
+ }
};
/*
- * handles driving the firefogg render system
+ * Handles driving the firefogg render system
*/
var mvFirefoggRender = function( iObj ) {
return this.init( iObj );
};
var default_render_options = {
"videoQuality" : 10,
- "framerate" : 30,
- "width" : 400,
- "height" : 300
+ "framerate" : 30
}
var default_FirefoggRender_options = {
start_time:0,
this.player = $j( iObj.player_target ).get( 0 );
this.player_target = iObj.player_target;
- // setup the render options (with defaults)
- for ( var i in default_render_options ) {
- if ( iObj['render_options'][i] ) {
- this.renderOptions[ i ] = iObj['render_options'][i];
- } else {
- this.renderOptions[ i ] = default_render_options[i];
- }
+ // Extend the render options with any provided details
+ if( iObj['render_options'] )
+ $j.extend(this.renderOptions, iObj['render_options']);
+
+ // If no height width provided use target DOM width/height
+ if( !this.renderOptions.width && !this.renderOptions.height ){
+ this.renderOptions.width = $j(this.player_target).width();
+ this.renderOptions.height = $j(this.player_target).height();
}
+
+
// Setup the application options (with defaults)
for ( var i in default_FirefoggRender_options ) {
if ( iObj[ i ] ) {
this[ i ] = default_FirefoggRender_options[i];
}
}
- // Set up targets and local vars
+ // Should be exteranlly controlled
if ( iObj.target_startRender ) {
$j( iObj.target_startRender ).click( function() {
js_log( "Start render" );
var interval = 1 / this.renderOptions.framerate
// issue a load request on the player:
- this.player.load();
+ //this.player.load();
// init the Render
this.fogg.initRender( JSON.stringify( _this.renderOptions ), 'foggRender' );
// add audio if we had any:
// request a target (should support rendering to temp location too)
- this.fogg.saveVideoAs();
+ //this.fogg.saveVideoAs();
// set the continue rendering flag to true:
this.continue_rendering = true;
var doNextFrame = function() {
$j( _this.target_timeStatus ).val( " on " + ( Math.round( t * 10 ) / 10 ) + " of " +
( Math.round( _this.player.getDuration() * 10 ) / 10 ) );
- _this.player.setCurrentTime( t, function() {
- _this.fogg.addFrame( $j( _this.player_target ).attr( 'id' ) );
- t += interval;
+ _this.player.setCurrentTime( t, function() {
+ //_this.fogg.addFrame( $j( _this.player_target ).attr( 'id' ) );
+ t += interval;
if ( t >= _this.player.getDuration() ) {
_this.doFinalRender();
} else {
if ( _this.continue_rendering ) {
doNextFrame();
} else {
+ js_log('done with render');
// else quit:
- _this.doFinalRender();
+ //_this.doFinalRender();
}
}
} );
// update the title and status bar
this.updateBaseStatus();
+ this.doSmilActions( true );
},
setupClipDisplay:function() {
js_log( 'mvPlaylist:setupClipDisplay:: clip len:' + this.default_track.clips.length );
this.cur_clip.embed.seek_time_sec = ( float_sec - pl_sum_time );
// render effects ontop: (handled by doSmilActions)
- this.doSmilActions( single_line = true );
+ this.doSmilActions( true );
},
updateBaseStatus:function() {
var _this = this;
setStatus:function( value ) {
$j( '#' + this.id + ' .time-disp' ).text( value );
},
- setSliderValue:function( value ) {
+ setSliderValue:function( value ) {
// slider is on 1000 scale:
var val = parseInt( value * 1000 );
- js_log( 'update slider: #' + this.id + ' .play_head to ' + val );
+ //js_log( 'update slider: #' + this.id + ' .play_head to ' + val );
$j( '#' + this.id + ' .play_head' ).slider( 'value', val );
},
getPlayHeadPos: function( prec_done ) {
this.cur_clip.embed.stop();
this.updateCurrentClip( next_clip );
-
+ //if part of a transition should continue playing where it left off
this.cur_clip.embed.play();
},
onClipDone:function() {
js_log( "pl onClipDone" );
this.cur_clip.embed.stop();
},
- updateCurrentClip:function( new_clip ) {
+ updateCurrentClip : function( new_clip , into_perc) {
js_log( 'f:updateCurrentClip:' + new_clip.id );
- // make sure we are not switching to the current
- if ( this.cur_clip.id == new_clip.id ) {
- js_log( 'trying to updateCurrentClip to same clip' );
- return false;
- }
// keep the active play clip in sync (stop the other clip)
if ( this.cur_clip ) {
+ // make sure we are not switching to the current
+ if ( this.cur_clip.id == new_clip.id ) {
+ js_log( 'trying to updateCurrentClip to same clip' );
+ return false;
+ }
+
if ( !this.cur_clip.embed.isStoped() )
this.cur_clip.embed.stop();
this.activeClipList.remove( this.cur_clip )
- }
-
- this.activeClipList.add( new_clip );
-
+
+ //hide the current clip
+ $j( '#clipDesc_' + this.cur_clip.id ).hide();
+ }
+ this.activeClipList.add( new_clip );
// do swap:
- $j( '#clipDesc_' + this.cur_clip.id ).hide();
this.cur_clip = new_clip;
$j( '#clipDesc_' + this.cur_clip.id ).show();
- // update the playhead:
- this.setSliderValue( this.cur_clip.dur_offset / this.getDuration() );
+
+ // Update the playhead:
+ if( this.controls ){
+ // Check if we have into_perc
+ if( into_perc ){
+ var clip_time = this.cur_clip.dur_offset + ( into_perc * this.cur_clip.getDuration() );
+ }else{
+ var clip_time = this.cur_clip.dur_offset;
+ }
+
+ this.setSliderValue( clip_time / this.getDuration() );
+ }
},
playPrev: function() {
// advance the playhead to the previous clip
*/
load:function() {
// do nothing right now)
+ alert('load pl');
},
toggleMute:function() {
this.cur_clip.embed.toggleMute();
doSeek:function( v ) {
js_log( 'pl:doSeek:' + v + ' sts:' + this.seek_time_sec );
var _this = this;
- var prevClip = null;
+ var time = v * this.getDuration()
+ _this.currentTime = time;
+ var relative_perc = _this.updateClipByTime();
+
+ // Update the clip relative seek_time_sec
+ _this.cur_clip.embed.doSeek( relative_perc );
+ _this.monitor();
+
+ return '';
+ },
+ setCurrentTime: function( time, callback ) {
+ js_log( 'pl:setCurrentTime:' + time );
+ var _this = this;
+ _this.currentTime = time;
+
+ var pl_perc = time / this.getDuration();
+ var relative_perc = _this.updateClipByTime();
+ var clip_time = relative_perc * _this.cur_clip.embed.getDuration();
+ _this.cur_clip.embed.setCurrentTime( clip_time, function() {
+ //update the smil actions:
+ _this.doSmilActions( true );
+ //say we are "ready"
+ if ( callback )
+ callback();
+ } );
+ },
+ /*
+ * updateClipByTime::
+ *
+ * @returns the relative offsets of the current clip (given the playlist time)
+ */
+ updateClipByTime: function(){
+ var _this = this;
+ var prevClip = null;
+ //set the current percent done:
+ var pt = this.currentTime / _this.getDuration();
// jump to the clip in the current percent.
var perc_offset = 0;
var next_perc_offset = 0;
var clip = _this.default_track.clips[i];
next_perc_offset += ( clip.getDuration() / _this.getDuration() ) ;
// js_log('on ' + clip.getDuration() +' next_perc_offset:'+ next_perc_offset);
- if ( next_perc_offset > v ) {
- // pass along the relative percentage to embed object:
- // js_log('seek:'+ v +' - '+perc_offset + ') / (' + next_perc_offset +' - '+ perc_offset);
- var relative_perc = ( v - perc_offset ) / ( next_perc_offset - perc_offset );
+ if ( next_perc_offset > pt ) {
+ // js_log('seek:'+ pt +' - '+perc_offset + ') / (' + next_perc_offset +' - '+ perc_offset);
+ var relative_perc = ( pt - perc_offset ) / ( next_perc_offset - perc_offset );
// update the current clip:
- _this.updateCurrentClip( clip );
-
- // update the clip relative seek_time_sec
- _this.cur_clip.embed.doSeek( relative_perc );
- this.play();
- return '';
+ _this.updateCurrentClip( clip, relative_perc );
+ return relative_perc;
}
perc_offset = next_perc_offset;
}
- },
- setCurrentTime: function( pos, callback ) {
- js_log( 'pl:setCurrentTime:' + pos + ' sts:' + this.seek_time_sec );
- var _this = this;
- var prevClip = null;
-
- // jump to the clip at pos
- var currentOffset = 0;
- var nextTime = 0;
- for ( var i in _this.default_track.clips ) {
- var clip = _this.default_track.clips[i];
- nextTime = clip.getDuration();
- if ( currentOffset + nextTime > pos ) {
- // update the clip relative seek_time_sec
- clipTime = pos - currentOffset;
- if ( _this.cur_clip.id != clip.id ) {
- _this.updateCurrentClip( clip );
- }
- _this.cur_clip.embed.setCurrentTime( clipTime, function() {
- if ( callback )
- callback();
- } );
- _this.currentTime = pos;
- _this.doSmilActions();
- }
- currentOffset += nextTime;
- }
+ return 0;
},
// gets playlist controls large control height for sporting
// next prev button and more status display
// setup the embed object:
setUpEmbedObj:function() {
js_log( 'mvClip:setUpEmbedObj()' );
- // init:
-
this.embed = null;
// js_log('setup embed for clip '+ this.id + ':id is a function?');
// if(this.pp.sequencer=='true'){
init_pl_embed.embed_link = null;
init_pl_embed.linkback = null;
-
+
+ if( this.durationHint )
+ init_pl_embed.durationHint = this.durationHint;
if ( this.poster )init_pl_embed['thumbnail'] = this.poster;
// status updates handled by playlist obj
},
setSliderValue:function( value ) {
- js_log( 'PlMvEmbed:setSliderValue:' + value );
- // setSlider value handled by playlist obj
+ //js_log( 'PlMvEmbed:setSliderValue:' + value );
+ // setSlider value handled by playlist obj
}
}
// update/setup all transitions (will render current transition state)
var in_range = false;
// pretty similar actions per transition types so group into a loop:
- var tran_types = { 'transIn':true, 'transOut':true };
+ var tran_types = {
+ 'transIn' : true,
+ 'transOut':true
+ };
for ( var tid in tran_types ) {
eval( 'var tObj = _clip.' + tid );
if ( !tObj )
return overlay_selector_id;
},
doUpdate:function( tObj, percent ) {
- // init the transition if nessesary:
+ // init the transition if necessary:
if ( !tObj.overlay_selector_id )
this.doInitTransition( tObj );
- // @@todo we should ensure visability outside of doUpate loop
+ // @@todo we should ensure viability outside of doUpate loop
if ( !$j( '#' + tObj.overlay_selector_id ).is( ':visible' ) )
$j( '#' + tObj.overlay_selector_id ).show();
},
tryAddMedia:function( mediaElement, order, track_id ) {
js_log( 'SMIL:tryAddMedia:' + mediaElement );
+
var _this = this;
// set up basic mvSMILClip send it the mediaElemnt & mvClip init:
var clipObj = { };
var cConfig = {
- "id":'p_' + _this.id + '_c_' + order,
- "pp":this, // set the parent playlist object pointer
- "order": order
+ "id" : 'p_' + _this.id + '_c_' + order,
+ "pp" : this, // set the parent playlist object pointer
+ "order" : order
};
var clipObj = new mvSMILClip( mediaElement, cConfig );
-
// set optional params track
if ( typeof track_id != 'undefined' )
clipObj["track_id"] = track_id;
// parse duration / begin times:
if ( this.dur )
this.dur = smilParseTime( this.dur );
+
// parse the media duration hint ( the source media length)
if ( this.durationHint )
this.durationHint = smilParseTime( this.durationHint );
for ( var i in msgSet ) {
gMsg[ i ] = msgSet[i];
}
- },
+ }
/**
* loadRS function
for ( var k in e[j] ) {
if ( e[j][k] && typeof( e[j][k] ) == 'object' ) {
var sn = e[j][k].getAttribute( 'class' );
+ // Try "className" for good ol IE
+ if(!sn){
+ var sn = e[j][k].getAttribute( 'className' );
+ }
if ( sn && sn != '' ) {
for ( var n = 0; n < mw.valid_skins.length; n++ ) {
if ( sn.indexOf( mw.valid_skins[n] ) !== -1 ) {
$.fn.firefoggRender = function( iObj, callback ) {
// Check if we already have render loaded then just pass on updates/actions
var sElm = $j( this.selector ).get( 0 );
+ //add a special attribute to the selector:
if ( sElm['fogg_render'] ) {
if ( sElm['fogg_render'] == 'loading' ) {
js_log( "Error: called firefoggRender while loading" );
'mvFirefogg',
'mvFirefoggRender'
], function() {
+ // Attach the firefoggRender obj to the selected elm:
sElm['fogg_render'] = new mvFirefoggRender( iObj );
if ( callback && typeof callback == 'function' )
callback( sElm['fogg_render'] );
'position':'absolute',
'left':'0px',
'right':'0px',
- 'bottom':'0px',
+ 'bottom':'0px'
} );
}
// js_log('npt2seconds:not valid ntp:'+ntp);
return false;
}
- // Strip "npt:" time definition if present
- npt_str = npt_str.replace( 'npt:', '' );
+ // Strip {npt:}01:02:20 or 32{s} from time if present
+ npt_str = npt_str.replace( /npt:|s/g, '' );
var hour = 0;
var min = 0;
js_log( 'f:controlsBuilder:: opt:' + this.options );
this.id = ( embedObj.pc ) ? embedObj.pc.pp.id:embedObj.id;
this.available_width = embedObj.playerPixelWidth();
- // make pointer to the embedObj
+
+ // Make pointer to the embedObj
this.embedObj = embedObj;
var _this = this;
for ( var i in embedObj.supports ) {
_this.supports[i] = embedObj.supports[i];
};
- // special case vars:
+ // Special case vars:
if ( ( embedObj.roe ||
embedObj.wikiTitleKey ||
( embedObj.media_element.timedTextSources &&
this.supports['closed_captions'] = true;
- // append options to body (if not already there)
+ // Append options to body (if not already there)
if ( _this.body_options && $j( '#mv_vid_options_' + this.id ).length == 0 )
$j( 'body' ).append( this.components['mv_embedded_options'].o( this ) );
for ( var i in this.components ) {
if ( this.supports[i] ) {
if ( this.available_width > this.components[i].w ) {
- // special case with playhead don't add unless we have 60px
+ // Special case with playhead don't add unless we have 60px
if ( i == 'play_head' && this.available_width < 60 )
continue;
o += this.components[i].o( this );
// add play hook:
- $tp.find( '.play-btn' ).unbind().btnBind().click( function() {
- $j( '#' + embedObj.id ).get( 0 ).play();
- } )
-
- // do play-btn-large binding:
- $tp.find( '.play-btn-large' ).unbind().btnBind().click( function() {
- $j( '#' + embedObj.id ).get( 0 ).play();
+ $tp.find( '.play-btn,.play-btn-large' ).unbind().btnBind().click( function() {
+ embedObj.play();
} );
// add recommend firefox if we have non-native playback:
// captions binding:
$tp.find( '.timed-text' ).unbind().btnBind().click( function() {
- $j( '#' + embedObj.id ).get( 0 ).showTextInterface();
+ embedObj.showTextInterface();
} );
// options binding:
$tp.find( '.options-btn' ).unbind().btnBind().click( function() {
- $j( '#' + embedObj.id ).get( 0 ).doOptionsHTML();
+ embedObj.doOptionsHTML();
} );
// fullscreen binding:
$tp.find( '.fullscreen-btn' ).unbind().btnBind().click( function() {
- $j( '#' + embedObj.id ).get( 0 ).fullscreen();
+ embedObj.fullscreen();
} );
js_log( " should add slider binding: " + $tp.find( '.play_head' ).length );
var id = ( embedObj.pc != null ) ? embedObj.pc.pp.id:embedObj.id;
embedObj.userSlide = true;
$j( id + ' .play-btn-large' ).fadeOut( 'fast' );
- // if playlist always start at 0
+ // If playlist always start at 0
embedObj.start_time_sec = ( embedObj.instanceOf == 'mvPlayList' ) ? 0:
npt2seconds( embedObj.getTimeReq().split( '/' )[0] );
},
} else {
embedObj.setStatus( embedObj.jump_time );
}
- // update the thumbnail / frame
+ // Update the thumbnail / frame
if ( embedObj.isPlaying == false ) {
embedObj.updateThumbPerc( perc );
}
},
change:function( event, ui ) {
- // only run the onChange event if done by a user slide:
+ // only run the onChange event if done by a user slide
+ // (otherwise it runs times it should not)
if ( embedObj.userSlide ) {
embedObj.userSlide = false;
embedObj.seeking = true;
var urlparts = getRemoteEmbedPath();
var mwEmbedHostPath = urlparts[0];
-var mwRemoteVersion = '1.07';
+var mwRemoteVersion = '1.08';
var mwUseScriptLoader = true;
// setup up request Params: