http://www.mediawiki.org/wiki/Special:Code/MediaWiki/71873
Revision: 71873
Author: dale
Date: 2010-08-29 08:38:50 +0000 (Sun, 29 Aug 2010)
Log Message:
-----------
* improved addByUrl support
* refactor tool support for per tool tabs
* added callback chain for track drawing operaionts.
* audio, by default goes into audio track
Modified Paths:
--------------
branches/MwEmbedStandAlone/modules/AddMedia/mw.RemoteSearchDriver.js
branches/MwEmbedStandAlone/modules/AddMedia/mw.UploadForm.js
branches/MwEmbedStandAlone/modules/AddMedia/searchLibs/baseRemoteSearch.js
branches/MwEmbedStandAlone/modules/AddMedia/searchLibs/flickrSearch.js
branches/MwEmbedStandAlone/modules/AddMedia/searchLibs/mediaWikiSearch.js
branches/MwEmbedStandAlone/modules/Sequencer/Sequencer.i18n.php
branches/MwEmbedStandAlone/modules/Sequencer/css/mw.style.Sequencer.css
branches/MwEmbedStandAlone/modules/Sequencer/mw.Sequencer.js
branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerAddByUrl.js
branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerAddMedia.js
branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTimeline.js
branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTools.js
branches/MwEmbedStandAlone/modules/Sequencer/remotes/mw.MediaWikiRemoteSequencer.js
branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBuffer.js
branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilLayout.js
branches/MwEmbedStandAlone/modules/TimedText/remotes/RemoteMwTimedText.js
Modified: branches/MwEmbedStandAlone/modules/AddMedia/mw.RemoteSearchDriver.js
===================================================================
--- branches/MwEmbedStandAlone/modules/AddMedia/mw.RemoteSearchDriver.js
2010-08-29 05:48:07 UTC (rev 71872)
+++ branches/MwEmbedStandAlone/modules/AddMedia/mw.RemoteSearchDriver.js
2010-08-29 08:38:50 UTC (rev 71873)
@@ -297,7 +297,8 @@
'homepage': 'http://kaltura.com',
'apiUrl':
'http://kaldev.kaltura.com/michael/aggregator.php',
- 'detailsUrl' : wgServer + wgArticlePath,
+ 'detailsUrl' : 'http://videos.kaltura.com/$1',
+
'lib': 'kaltura',
'resource_prefix' : '',
'tab_image':false
@@ -310,6 +311,8 @@
'enabled': 1,
'homepage':
'http://commons.wikimedia.org/wiki/Main_Page',
'apiUrl': 'http://commons.wikimedia.org/w/api.php',
+ 'detailsUrl' : 'http://commons.wikimedia.org/wiki/$1',
+
'lib': 'mediaWiki',
'tab_img': true,
@@ -335,6 +338,8 @@
'homepage': 'http://www.archive.org/about/about.php',
'apiUrl': 'http://www.archive.org/advancedsearch.php',
+ 'detailsUrl' : 'http://www.archive.org/details/$1',
+
'lib': 'archiveOrg',
'local': false,
'resource_prefix': 'AO_',
@@ -346,9 +351,10 @@
*/
'flickr': {
'enabled': 1,
- 'homepage': 'http://www.flickr.com/about/',
-
+ 'homepage': 'http://www.flickr.com/about/',
'apiUrl': 'http://www.flickr.com/services/rest/',
+ 'detailsUrl' : 'http://www.flickr.com/photos/',
+
'lib': 'flickr',
'local': false,
// Just prefix with Flickr_ for now.
@@ -363,6 +369,8 @@
'enabled': 1,
'homepage': 'http://metavid.org/wiki/Metavid_Overview',
'apiUrl':
'http://metavid.org/w/index.php?title=Special:MvExportSearch',
+ 'detailsUrl' : 'http://metavid.org/wiki/Stream:$1',
+
'lib': 'metavid',
'local': false,
@@ -1631,7 +1639,21 @@
callback( provider );
} );
},
+ /**
+ * get a resource from a url loads the provider if not already
initialized
+ */
+ getResourceFromUrl: function ( provider, url, callback){
+ if (!provider.sObj) {
+ this.loadSearchLib( provider, function( provider ){
+ provider.sObj.getResourceFromUrl( url,
callback);
+ });
+ }
+ else {
+ provider.sObj.getResourceFromUrl( url, callback);
+ }
+ },
+
/**
* Get a resource object from a resource id
*
Modified: branches/MwEmbedStandAlone/modules/AddMedia/mw.UploadForm.js
===================================================================
--- branches/MwEmbedStandAlone/modules/AddMedia/mw.UploadForm.js
2010-08-29 05:48:07 UTC (rev 71872)
+++ branches/MwEmbedStandAlone/modules/AddMedia/mw.UploadForm.js
2010-08-29 08:38:50 UTC (rev 71873)
@@ -401,7 +401,7 @@
remoteSearchDriver.addResourceEditLoader();
//Add the uploaded
result
-
searchProvider.sObj.addByTitle( wTitle, function( resource ) {
+
searchProvider.sObj.getByTitle( wTitle, function( resource ) {
// Update the
recent uploads ( background task )
remoteSearchDriver.showUserRecentUploads( uploadTargetId );
// Pull up
resource editor:
Modified:
branches/MwEmbedStandAlone/modules/AddMedia/searchLibs/baseRemoteSearch.js
===================================================================
--- branches/MwEmbedStandAlone/modules/AddMedia/searchLibs/baseRemoteSearch.js
2010-08-29 05:48:07 UTC (rev 71872)
+++ branches/MwEmbedStandAlone/modules/AddMedia/searchLibs/baseRemoteSearch.js
2010-08-29 08:38:50 UTC (rev 71873)
@@ -67,6 +67,10 @@
return this;
},
+ getResourceFromUrl: function( url, callback ){
+ mw.log("Error getResourceFromUrl must be implemented by
remoteSearch provider");
+ },
+
/**
* Base search results
* Does some common initialisation for search results
Modified: branches/MwEmbedStandAlone/modules/AddMedia/searchLibs/flickrSearch.js
===================================================================
--- branches/MwEmbedStandAlone/modules/AddMedia/searchLibs/flickrSearch.js
2010-08-29 05:48:07 UTC (rev 71872)
+++ branches/MwEmbedStandAlone/modules/AddMedia/searchLibs/flickrSearch.js
2010-08-29 08:38:50 UTC (rev 71873)
@@ -15,8 +15,7 @@
var flickrSearch = function ( options ) {
this.init( options );
}
-flickrSearch.prototype = {
- detailsUrl : 'http://www.flickr.com/photos/',
+flickrSearch.prototype = {
// @@todo probably would be good to read the api-key from configuration
apikey : '2867787a545cc66c0bce6f2e57aca1d1',
// What license we are interested in
Modified:
branches/MwEmbedStandAlone/modules/AddMedia/searchLibs/mediaWikiSearch.js
===================================================================
--- branches/MwEmbedStandAlone/modules/AddMedia/searchLibs/mediaWikiSearch.js
2010-08-29 05:48:07 UTC (rev 71872)
+++ branches/MwEmbedStandAlone/modules/AddMedia/searchLibs/mediaWikiSearch.js
2010-08-29 08:38:50 UTC (rev 71873)
@@ -28,33 +28,48 @@
* @param {String} title Title of the resource to be added
* @param {Function} callback Function called once title resource
acquired
*/
- addByTitle:function( title , callback, redirect_count ) {
+ getByTitle:function( title , callback ) {
- mw.log( "AddByTitle::" + title );
+ mw.log( "MediaWikiSearch:: getByTitle:" + title );
- var _this = this;
- if ( !redirect_count )
- redirect_count = 0;
- if ( redirect_count > 5 ) {
- mw.log( 'Error: addByTitle too many redirects' );
- callback( false );
- return false;
- }
+ var _this = this;
+
var request = {
- 'titles':'File:' + title,
- 'prop':'imageinfo|revisions|categories',
- 'iiprop':'url|mime|size',
- 'iiurlwidth': parseInt( this.rsd.thumb_width ),
- 'rvprop':'content',
+ 'titles' : 'File:' + title.replace(/File:|Image:/ig,
''),
+ 'prop' : 'imageinfo|revisions|categories',
+ 'iiprop' : 'url|mime|size|metadata',
+ 'iiurlwidth' : parseInt( this.rsd.thumb_width ),
+ 'rvprop' : 'content',
'redirects' : true
}
- mw.getJSON(this.provider.apiUrl, request, function( data ) {
+ mw.getJSON( this.provider.apiUrl, request, function( data ) {
// call addSingleResult
callback( _this.addSingleResult( data ) );
});
},
-
+
+ getResourceFromUrl: function( url, callback ){
+ this.getByTitle( this.getTitleKeyFromMwUrl( url ), callback );
+ },
/**
+ * Does best effort to get the title key from a mediawiki url
+ */
+ getTitleKeyFromMwUrl: function( url ){
+ // try for title key param
+ var titleKey = mw.parseUri( url ).queryKey['title'];
+ if( titleKey ){
+ return titleKey;
+ }
+ // else try for title url map
+ titleKey = url.replace( this.provider.detailsUrl.replace( '$1',
''), '' );
+ if( titleKey != url ){
+ return titleKey;
+ }
+ mw.log("Error: mediaWikiSearch:: getResourceFromUrl could not
get title form url: " + url );
+ return false;
+ },
+
+ /**
* Get recent upload by user and add them as results
*
* @param {String} user Name of the user
@@ -88,7 +103,7 @@
var resourceQuery = {
'titles' : titleStr,
'prop' :
'imageinfo|revisions|categories',
- 'iiprop' : 'url|mime|size',
+ 'iiprop' : 'url|mime|size|metadata',
'iiurlwidth': parseInt( _this.rsd.thumb_width ),
'rvprop':'content'
};
@@ -205,10 +220,16 @@
'desc' :
page.revisions[0]['*'],
// add pointer to parent search obj:
'pSobj' :_this,
+
'meta': {
'categories':page.categories
}
- };
+ };
+ for( var i in page.imageinfo[0].metadata ){
+ if( page.imageinfo[0].metadata[i].name
== 'length' ){
+ resource.duration =
page.imageinfo[0].metadata[i].value;
+ }
+ }
/*
//to use once we get the wiki-text parser in
shape
@@ -251,8 +272,10 @@
this.resultsObj[page_id] = resource;
// If returnFirst flag:
- if ( returnFirst )
+ // xxx this is kind of hacky .. we should have
abstract getter / adder to result list
+ if ( returnFirst ){
return this.resultsObj[page_id];
+ }
this.num_results++;
Modified: branches/MwEmbedStandAlone/modules/Sequencer/Sequencer.i18n.php
===================================================================
--- branches/MwEmbedStandAlone/modules/Sequencer/Sequencer.i18n.php
2010-08-29 05:48:07 UTC (rev 71872)
+++ branches/MwEmbedStandAlone/modules/Sequencer/Sequencer.i18n.php
2010-08-29 08:38:50 UTC (rev 71873)
@@ -27,8 +27,12 @@
'mwe-sequencer-audio-track' => 'Audio track',
'mwe-sequencer-sequencer_credit_line' => 'Developed by [$1 Kaltura,
Inc] in partnership with the [$1 Wikimedia Foundation]',
'mwe-sequencer-no-sequence-create' => 'Sequence does not exists, You
can [$1 start a sequence]',
- 'mwe-sequencer-cliptool-trim' => 'Trim clip',
- 'mwe-sequencer-cliptool-duration' => 'Set duration',
+
+ 'mwe-sequencer-tools-trim' => 'Trim',
+ 'mwe-sequencer-tools-trim-desc' => 'Set clip in and out points',
+ 'mwe-sequencer-tools-duration' => 'Duration',
+ 'mwe-sequencer-tools-duration-desc' => 'Set clip duration',
+
'mwe-sequencer-preview' => 'Preview',
'mwe-sequencer-apply-changes' => 'Apply changes',
'mwe-sequencer-start-time' => 'Start time',
Modified:
branches/MwEmbedStandAlone/modules/Sequencer/css/mw.style.Sequencer.css
===================================================================
--- branches/MwEmbedStandAlone/modules/Sequencer/css/mw.style.Sequencer.css
2010-08-29 05:48:07 UTC (rev 71872)
+++ branches/MwEmbedStandAlone/modules/Sequencer/css/mw.style.Sequencer.css
2010-08-29 08:38:50 UTC (rev 71873)
@@ -93,3 +93,12 @@
padding-left: 5px;
padding-right: 5px;
}
+
+/* Vertical Tabs
+----------------------------------*/
+.ui-tabs-vertical { width: 55em; }
+.ui-tabs-vertical .ui-tabs-nav { padding: .2em .1em .2em .2em; float: left;
width: 12em; }
+.ui-tabs-vertical .ui-tabs-nav li { clear: left; width: 100%;
border-bottom-width: 1px !important; border-right-width: 0 !important; margin:
0 -1px .2em 0; }
+.ui-tabs-vertical .ui-tabs-nav li a { display:block; }
+.ui-tabs-vertical .ui-tabs-nav li.ui-tabs-selected { padding-bottom: 0;
padding-right: .1em; border-right-width: 1px; border-right-width: 1px; }
+.ui-tabs-vertical .ui-tabs-panel { padding: 1em; float: right; width: 40em;}
Modified: branches/MwEmbedStandAlone/modules/Sequencer/mw.Sequencer.js
===================================================================
--- branches/MwEmbedStandAlone/modules/Sequencer/mw.Sequencer.js
2010-08-29 05:48:07 UTC (rev 71872)
+++ branches/MwEmbedStandAlone/modules/Sequencer/mw.Sequencer.js
2010-08-29 08:38:50 UTC (rev 71873)
@@ -124,12 +124,16 @@
mw.log( "Sequencer::updateSmilXML" );
var _this = this;
// Update the embedPlayer smil:
- this.getSmil().updateFromString( smilXML );
+ this.getSmil().updateFromString( smilXML );
+
// Get a duration ( forceRefresh to clear the cache )
this.getEmbedPlayer().getDuration( true );
// Redraw the timeline
- this.getTimeline().drawTimeline();
+ this.getTimeline().drawTimeline();
+
+ // if a tool is displayed update the tool:
+ this.getTools().updateToolDisplay();
},
/**
Modified: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerAddByUrl.js
===================================================================
--- branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerAddByUrl.js
2010-08-29 05:48:07 UTC (rev 71872)
+++ branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerAddByUrl.js
2010-08-29 08:38:50 UTC (rev 71873)
@@ -17,7 +17,7 @@
* Does a basic parseUri check to see if a string is likely a url:
*/
isUrl: function( inputString ){
- return ( mw.parseUri( inputString ).authority != mw.parseUri(
inputString ).host ) ;
+ return ( mw.parseUri( inputString ).protocol ) ;
},
/**
@@ -27,12 +27,65 @@
* Uses remoteSearchDriver to help in retrieving entry info
* @param {Object} remoteSearchDriver The remote search driver
*/
- addByUrlDialog: function( remoteSearchDriver, url ){
+ addByUrlDialog: function( remoteSearchDriver, url ){
+ var _this = this;
+ var $dialog = mw.addLoaderDialog( gM(
'mwe-sequencer-loading-asset' ) );
+
+ // Close / empty the toolWindow
+ _this.sequencer.getTools().setDefaultText();
+
+ var foundImportUrl = false;
// See if the asset matches the detailsUrl key type of any
enabled content provider:
$j.each( remoteSearchDriver.getEnabledProviders(),
function(providerName, provider){
-
+ if( mw.parseUri( provider.detailsUrl ).host ==
mw.parseUri( url).host ){
+ foundImportUrl = true ;
+
+ mw.log("addByUrlDialog: matching host
getResourceFromUrl::"
+ + mw.parseUri(
provider.detailsUrl ).host
+ + ' == ' + mw.parseUri(
url).host );
+
+ // Do special check for mediawiki templates and
pages as 'special' smil types
+ if( provider.lib == 'mediaWiki' ){
+ // xxx we should do a query to the api
to determine namespace instead of hard coded checks
+ remoteSearchDriver.loadSearchLib(
provider, function( provider ){
+ var titleKey =
provider.sObj.getTitleKeyFromMwUrl( url );
+ if( !titleKey ){
+ // continue for loop (
if we can't get a title from the mediaWiki url )
+ return true;
+ }
+ // Check the title type
+ // xxx should use
wgFormattedNamespacess
+ if( titleKey.indexOf('File:')
== 0 ){
+ // Asset is a file
import resource as a file:
+
remoteSearchDriver.getResourceFromUrl( provider, url, function( resource ){
+ if( ! resource
){
+
$dialog.html( 'Error loading asset');
+ return
;
+ }
+ // Get convert
resource to smilClip and insert into the timeline
+ _this
+ .sequencer
+ .getAddMedia()
+
.getSmilClipFromResource( resource, function( smilClip ) {
+
_this.sequencer.getTimeline().insertSmilClipEdit( smilClip );
+
mw.closeLoaderDialog();
+ });
+ });
+ } else {
+ // xxx special Template
resource import goes here
+ }
+
+ });
+ } else {
+ mw.log(" only MediaWiki URLs supported
as resources right now");
+ }
+ }
});
+ if( ! foundImportUrl ){
+ mw.closeLoaderDialog();
+ }
+ // xxx support direct asset include
if( mw.getConfig( 'Sequencer.AddAssetByUrl' )){
// try directly adding the asset
}
Modified: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerAddMedia.js
===================================================================
--- branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerAddMedia.js
2010-08-29 05:48:07 UTC (rev 71872)
+++ branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerAddMedia.js
2010-08-29 08:38:50 UTC (rev 71873)
@@ -122,29 +122,13 @@
// Check if input value can be handled by url
var inputValue =
_this.sequencer.getMenuTarget().find('input.searchMedia').val();
if( _this.sequencer.getAddByUrl().isUrl( inputValue) ){
- _this.sequencer.addByUrlDialog().addByUrl(
remoteSearchDriver, inputValue );
+ _this.sequencer.getAddByUrl().addByUrlDialog(
remoteSearchDriver, inputValue );
} else {
// Else just use the remoteSearchDriver search
interface
remoteSearchDriver.createUI();
}
});
- },
- /**
- * Handles url asset importing
- * xxx should probably re factor into separate class
- *
- * Checks for commons ulr profile, future profiles could include
flickr, youtube etc.
- * tries to ascertain content type by url and directly load the media
- * @param {String} url to be imported to the sequence
- */
- proccessUrlRequest: function( url ){
- // Check if its a local domain ( we can directly request the
"head" of the file to get its type )
-
- // Check url type
- var parsedUrl = mw.parseUri( url );
- if( host == 'commons.wikimedia.org' ){
- }
- },
+ },
/**
* Get the resource object from a provided asset
@@ -204,7 +188,10 @@
if( resource.mime.indexOf( 'image/' ) != -1 ){
tagType = 'img';
}
- if( resource.mime.indexOf( 'video/') != -1 ){
+ if( resource.mime.indexOf( 'video/') != -1
+ ||
+ resource.mime.indexOf( 'application/ogg' ) != -1 )
+ {
tagType = 'video';
}
if( resource.mime.indexOf( 'audio/') != -1 ){
@@ -212,11 +199,19 @@
}
var $smilRef = $j( '<' + tagType + ' />')
- // Set the default duration
+ // Set the default duration for images
if( tagType == 'img' ){
$smilRef.attr( 'dur', mw.getConfig(
'Sequencer.AddMediaImageDuration' ) );
}
+ // Set the default duration to the media duration:
+ if( resource.duration ){
+ // Set the media full duration
+ $smilRef.attr( 'durationHint', resource.duration );
+ // By default the imported resource is its entire
duration
+ $smilRef.attr( 'dur', resource.duration );
+ }
+
// Set all available params
var resourceAttributeMap = {
'type' : 'mime',
Modified: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTimeline.js
===================================================================
--- branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTimeline.js
2010-08-29 05:48:07 UTC (rev 71872)
+++ branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTimeline.js
2010-08-29 08:38:50 UTC (rev 71873)
@@ -81,24 +81,49 @@
return mw.getConfig( 'Sequencer.TimelineTrackHeight' )
}
},
- // Get the selected sequence track index ( for now its always zero )
- getSelectedTrackIndex: function(){
- return 0;
+ /*
+ * Get the track index by type and then by number
+ * @param {string} type Type of track 'audio' or 'video'
+ * @param {Number=} trackNumber Optional if not set the first track
index of selected type is returned
+ */
+ getTrackIndexType: function( trackType, trackNumber ){
+ if( !trackNumber )
+ trackNumber = 0;
+ var smilSequenceTracks =
this.sequencer.getSmil().getBody().getSeqElements();
+ var returnTrackIndex = false;
+ for(var trackIndex = 0; trackIndex < smilSequenceTracks.length;
trackIndex ++){
+ if( $j( smilSequenceTracks[ trackIndex
]).attr('tracktype') == trackType ){
+ if( trackNumber == 0 ){
+ return trackIndex;
+ }
+ trackNumber--;
+ }
+ };
+ mw.log("Error: SequencerTimelin:: getTrackIndexType: offset to
large ( " +
+ trackOffset + ' or no track of type ' + type );
+ return false;
},
// Draw the timeline
- drawTimeline: function(){
+ drawTimeline: function( callback ){
var _this = this;
// xxx TODO support multiple tracks :::
var smilSequenceTracks =
this.sequencer.getSmil().getBody().getSeqElements();
+ var trackStack =0;
// Draw all the tracks
$j.each(smilSequenceTracks, function( trackIndex,
smilSequenceTrack ){
- _this.drawSequenceTrack( trackIndex, smilSequenceTrack
);
+ trackStack++;
+ _this.drawSequenceTrack( trackIndex, smilSequenceTrack,
function(){
+ trackStack--;
+ if( trackStack == 0 && callback ){
+ callback();
+ }
+ });
})
},
- drawSequenceTrack: function( trackIndex, smilSequenceTrack ){
+ drawSequenceTrack: function( trackIndex, smilSequenceTrack, callback){
var _this = this;
// Tracks by default are video tracks
mw.log("SequenceTimeline::drawSequenceTrack: Track inx: " +
@@ -126,16 +151,16 @@
$clipTrackSet = $j( '#' + this.getTrackSetId(
trackIndex ));
}
// Draw sequence track clips ( checks for dom updates to
smilSequenceTrack )
- this.drawTrackClipsInterface( $clipTrackSet, smilSequenceTrack
);
+ this.drawTrackClips( $clipTrackSet, smilSequenceTrack, callback
);
},
/**
- * add Track Clips and Interface binding
+ * Add Track Clips and Interface binding
*/
- drawTrackClipsInterface: function( $clipTrackSet, smilSequenceTrack ){
+ drawTrackClips: function( $clipTrackSet, smilSequenceTrack, callback ){
var _this = this;
- mw.log( 'drawTrackClipsInterface:: existing lenght: ' +
- $clipTrackSet.children() + ' id: ' +
$clipTrackSet.attr('id') );
+ mw.log( 'drawTrackClips:: existing length: ' +
+ $clipTrackSet.children().length + ' id: ' +
$clipTrackSet.attr('id') );
// Setup a local pointer to the smil engine:
var smil = this.sequencer.getSmil();
@@ -147,12 +172,13 @@
// Get all the refs that are children of the smilSequenceTrack
with associated offsets and durations
// for now assume all tracks start at zero time:
var startOffset = 0;
+ var thumbRenderStack = 0;
smil.getBody().getRefElementsRecurse( smilSequenceTrack,
startOffset, function( $node ){
- var reRenderThumbFlag = false;
- mw.log("ADD: " + _this.getTimelineClipId( $node ) + '
to ' + $clipTrackSet.attr('id') );
+ var reRenderThumbFlag = false;
// Draw the node onto the timeline if the clip is not
already there:
var $timelineClip = $clipTrackSet.find( '#' +
_this.getTimelineClipId( $node ) )
- if( $timelineClip.length == 0 ){
+ if( $timelineClip.length == 0 ){
+ mw.log(" ADD: " + _this.getTimelineClipId(
$node ) + ' to ' + $clipTrackSet.attr('id') );
$timelineClip = _this.getTimelineClip(
smilSequenceTrack, $node );
// Set the index order on the clip
$timelineClip.data( 'indexOrder',
$clipTrackSet.children().length );
@@ -175,19 +201,24 @@
}
}
- // xxx Check if the start time was changed to set
reRenderThumbFlag
-
- if ( reRenderThumbFlag ){
- // issue a draw Thumb request ( since we
reinserted into the dom )
- // Check Buffer for when the first frame of the
smilNode can be grabbed:
- smil.getBuffer().bufferedSeek( $node, 0,
function(){
-
//mw.log("getTrackClipInterface::bufferedSeek for " + smil.getPageDomId( $node
));
- _this.drawClipThumb( $node , 0);
+ // xxx Check if the start time was changed to set
reRenderThumbFlag
+ if ( reRenderThumbFlag ){
+ thumbRenderStack++;
+ // Issue a relative draw Thumb request for the
start time
+ smil.getBuffer().bufferedSeekRelativeTime(
$node, 0, function(){
+
mw.log("getTrackClipInterface::bufferedSeekRelativeTime for " +
smil.getPageDomId( $node ));
+ _this.drawClipThumb( $node , 0,
function(){
+ thumbRenderStack--;
+ if( thumbRenderStack == 0 ){
+ callback();
+ }
+ });
});
}
// Update the $previusClip
$previusClip = $timelineClip;
+
// Update the natural order index
seqOrder ++;
});
@@ -210,14 +241,14 @@
( this.timelineThumbSize.width + 12 )
);
- // Add global TrackClipInterface bindings:
+ // Add TrackClipInterface bindings:
var keyBindings = this.sequencer.getKeyBindings();
$j( keyBindings ).bind('escape', function(){
// If a clips are selected deselect
var selectedClips = _this.getTimelineContainer().find(
'.selectedClip' )
if( selectedClips.length ){
selectedClips.removeClass( 'selectedClip' );
- return;
+ return false;
}
// Else trigger an exit request
_this.sequencer.getActionsSequence().exit();
@@ -312,8 +343,7 @@
var smil = this.sequencer.getSmil();
// get the smil element for the edit tool:
var smilClip = smil.$dom.find( '#' + $j( selectedClip
).data('smilId') );
- var toolTarget = this.sequencer.getEditToolTarget();
- this.sequencer.getTools().drawClipEditTools( toolTarget,
smilClip );
+ this.sequencer.getTools().drawClipEditTools( smilClip );
},
/**
@@ -366,7 +396,12 @@
var _this = this;
// Handle optional arguments
if( typeof trackIndex == 'undefined' ){
- trackIndex = this.getSelectedTrackIndex();
+ // default audio to audio track
+ if( _this.sequencer.getSmil().getRefType( smilClip ) ==
'audio' ){
+ trackIndex = this.getTrackIndexType('audio');
+ } else {
+ trackIndex = this.getTrackIndexType('video');
+ }
}
var $clipTrackSet = $j( '#' + this.getTrackSetId( trackIndex )
);
if( $clipTrackSet.length == 0 ){
@@ -389,27 +424,31 @@
)
}
- // Update the dom timeline
- this.drawTimeline();
+ // Update the dom timeline
+ _this.drawTimeline(function(){
+
+ // Invalidate / update embedPlayer duration / clip
offsets
+ _this.sequencer.getEmbedPlayer().getDuration( true );
+
+ // Register the insert edit action
+ _this.sequencer.getActionsEdit().registerEdit();
+
+ // Select the current clip
+ var $timelineClip = $clipTrackSet.find('#' +
this.getTimelineClipId( smilClip ) )
+ if( $timelineClip.length == 0 ){
+ mw.log("Error: insertSmilClipEdit: could not
find clip: " + this.getTimelineClipId( smilClip ) );
+ }
+ _this.getTimelineContainer().find( '.selectedClip'
).removeClass( 'selectedClip' );
+ $timelineClip.addClass( 'selectedClip' );
+
+ // Seek to the added clip
+ // xxx should have a callback for drawTimeline
+ _this.seekToStartOfClip( $timelineClip );
+
+ // Display the edit interface
+ _this.editClip( $timelineClip );
+ });
- // Invalidate / update embedPlayer duration / clip offsets
- this.sequencer.getEmbedPlayer().getDuration( true );
-
- // Register the insert edit action
- _this.sequencer.getActionsEdit().registerEdit();
-
- // Select the current clip
- var $timelineClip = $clipTrackSet.find('#' +
this.getTimelineClipId( smilClip ) )
- if( $timelineClip.length == 0 ){
- mw.log("Error: insertSmilClipEdit: could not find clip:
" + this.getTimelineClipId( smilClip ) );
- }
- this.getTimelineContainer().find( '.selectedClip'
).removeClass( 'selectedClip' );
- $timelineClip.addClass( 'selectedClip' );
- // Seek to the added clip
- this.seekToStartOfClip( $timelineClip );
-
- // Display the edit interface with 'special' cancel button
- this.editClip( $timelineClip );
},
handleReorder: function ( movedClip ){
@@ -568,7 +607,7 @@
},
// Draw a clip thumb into the timeline clip target
- drawClipThumb: function ( $node , relativeTime ){
+ drawClipThumb: function ( $node , relativeTime, callback ){
var _this = this;
var smil = this.sequencer.getSmil();
@@ -655,23 +694,24 @@
})
.attr( 'src', smil.getAssetUrl( $node.attr('poster') ) )
.load( function(){
- if( $thumbTarget.children().length == 0 ){
+ if( $thumbTarget.children().length == 0 ){
$thumbTarget.html( img );
}
});
// Sometimes the load event does not fire. Force the
fallback image after 5 seconds
- setTimeout( function(){
+ setTimeout( function(){
if( $thumbTarget.children().length == 0 ){
- $thumbTarget.html( img );
+ mw.log(
"SequencerTimeline::drawClipThumb: force image fallabck:: " + img.src);
+ $thumbTarget.html( img );
}
}, 5000);
}
// Buffer the asset then render it into the layout target:
- smil.getBuffer().bufferedSeek( $node, relativeTime, function(){
- // Add the seek, add to canvas and draw thumb request
- smil.getLayout().drawElementThumb( $thumbTarget, $node,
relativeTime );
+ smil.getBuffer().bufferedSeekRelativeTime( $node, relativeTime,
function(){
+ // Add the seek, Add to canvas and draw thumb request
+ smil.getLayout().drawElementThumb( $thumbTarget, $node,
relativeTime, callback );
})
},
Modified: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTools.js
===================================================================
--- branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTools.js
2010-08-29 05:48:07 UTC (rev 71872)
+++ branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTools.js
2010-08-29 08:38:50 UTC (rev 71873)
@@ -14,27 +14,37 @@
init: function( sequencer ){
this.sequencer = sequencer;
},
+ // The current selected tool
+ currentToolId: null,
+
+ // JSON tools config
tools:{
'trim':{
- 'title': gM('mwe-sequencer-cliptool-trim'),
'editWidgets' : [ 'trimTimeline' ],
'editableAttributes' : ['clipBegin','dur' ],
- 'editActions' : ['preview', 'cancel']
+ 'contentTypes': ['video', 'audio']
},
- 'duration':{
- 'title': gM('mwe-sequencer-cliptool-duration'),
+ 'duration':{
'editableAttributes' : [ 'dur' ],
- 'editActions' : ['preview', 'cancel']
+ 'contentTypes': ['image']
+ },
+ 'panzoom' : {
+ 'editableAttributes' : [ 'panZoom' ],
+ 'contentTypes': ['video', 'image']
}
},
editableAttributes:{
'clipBegin':{
'type': 'time',
- 'title' : gM('mwe-sequencer-start-time' ),
+ 'title' : gM('mwe-sequencer-start-time' )
},
'dur' :{
'type': 'time',
- 'title' : gM('mwe-sequencer-clip-duration' ),
+ 'title' : gM('mwe-sequencer-clip-duration' )
+ },
+ 'panZoom' :{
+ 'type' : 'panzoom',
+ 'title' : gM('mwe-sequencer-clip-layout' )
}
},
editableTypes: {
@@ -65,7 +75,7 @@
'preview' : {
'icon' : 'play',
'title' : gM('mwe-sequencer-preview'),
- 'action': function( _this, smilClip, toolId ){
+ 'action': function( _this, smilClip ){
_this.sequencer.getPlayer().previewClip(
smilClip );
// xxx todo update preview button to "pause" /
"play"
}
@@ -73,15 +83,22 @@
'cancel':{
'icon': 'close',
'title' : gM('mwe-cancel'),
- 'action' : function( _this, smilClip, toolId ){
- var tool = _this.tools[toolId];
- for( var i=0; i <
tool.editableAttributes.length ; i++ ){
- var attributeName =
tool.editableAttributes[i];
- var $editToolInput = $j('#' +
_this.getEditToolId( toolId, attributeName ) );
- // Restore all original attribute values
- smilClip.attr( attributeName,
$editToolInput.data('initialValue') );
- }
-
+ 'action' : function( _this, smilClip ){
+ $j.each(
+ _this.getToolSet(
+
_this.sequencer.getSmil().getRefType( smilClip )
+ ),
+ function( inx, toolId ){
+ var tool = _this.tools[toolId];
+ for( var i=0; i <
tool.editableAttributes.length ; i++ ){
+ var attributeName =
tool.editableAttributes[i];
+ var $editToolInput =
$j('#' + _this.getEditToolInputId( toolId, attributeName ) );
+ // Restore all original
attribute values
+ smilClip.attr(
attributeName, $editToolInput.data('initialValue') );
+ }
+ }
+ );
+
// Update the clip duration :
_this.sequencer.getEmbedPlayer().getDuration(
true );
@@ -91,17 +108,30 @@
);
// Close / empty the toolWindow
- _this.sequencer.getEditToolTarget().html(
- _this.getDefaultText()
- )
+ _this.setDefaultText();
}
}
},
editWidgets: {
'trimTimeline':{
- 'update': function( _this, target, smilClip ){
+ 'onChange': function( _this, target, smilClip ){
var smil = _this.sequencer.getSmil();
// Update the preview thumbs
+
+ // (local function so it can be updated after
the start time is done with its draw )
+ var updateDurationThumb = function(){
+ // Check the duration:
+ var clipDur =
$j('#editTool_trim_dur').val();
+ if( clipDur ){
+ // Render a thumbnail for the
updated duration
+
smil.getLayout().drawElementThumb(
+ $j( target
).find('.trimEndThumb'),
+ smilClip,
+ clipDur
+ );
+ }
+ }
+
var clipBeginTime =
$j('#editTool_trim_clipBegin').val();
if( !clipBeginTime ){
$j(target).find('.trimStartThumb').hide();
@@ -111,22 +141,10 @@
smil.getLayout().drawElementThumb(
$j( target
).find('.trimStartThumb'),
smilClip,
- 0
+ 0,
+ updateDurationThumb()
)
}
- // Check the duration:
- var clipDur = $j('#editTool_trim_dur').val();
- if( clipDur ){
- mw.log("Should update trimStartThumb::"
+ $j(smilClip).attr('clipBegin') );
- // Render a thumbnail for the updated
duration
- smil.getLayout().drawElementThumb(
- $j( target
).find('.trimEndThumb'),
- smilClip,
- clipDur
- );
- }
-
- mw.log( "editWidgets::trimTimeline:update:: " +
clipBeginTime + ' dur: ' + clipDur);
},
// Return the trimTimeline edit widget
'draw': function( _this, target, smilClip ){
@@ -144,10 +162,10 @@
// Add a trim binding:
$j('#editTool_trim_clipBegin,#editTool_trim_dur').change(function(){
- _this.editWidgets.trimTimeline.update(
_this, target, smilClip);
+
_this.editWidgets.trimTimeline.onChange( _this, target, smilClip);
})
// Update the thumbnails:
- _this.editWidgets.trimTimeline.update( _this,
target, smilClip);
+ _this.editWidgets.trimTimeline.onChange( _this,
target, smilClip);
// Get the clip full duration to build out the
timeline selector
smil.getBody().getClipAssetDuration( smilClip,
function( fullClipDuration ) {
@@ -162,13 +180,14 @@
var sliderValues = [
startSlider,
startSlider + timeToSlider(
smil.parseTime( $j('#editTool_trim_dur').val() ) )
- ];
+ ];
// Return a trim tool binded to
smilClip id update value events.
$j(target).append(
$j('<div />')
.attr( 'id', _this.sequencer.id
+ '_trimTimeline' )
.css({
- 'width': '100%',
+ 'left' : '5px',
+ 'right' : '15px',
'margin': '5px'
})
.slider({
@@ -186,23 +205,16 @@
},
change: function(
event, ui ) {
var
attributeValue = 0, sliderIndex = 0;
- if(
sliderValues[0] != ui.values[0] ){
- var
attributeChanged = 'clipBegin';
-
sliderIndex = 0;
-
attributeValue = sliderToTime( ui.values[ 0 ] )
- } else {
- var
attributeChanged = 'dur';
-
sliderIndex = 1;
-
attributeValue = sliderToTime( ui.values[ 1 ]- ui.values[0] )
- }
- sliderValues[
sliderIndex ] = ui.values[ sliderIndex ];
- // update start
and end time:
-
_this.editableTypes['time'].update( _this, smilClip, attributeChanged,
attributeValue)
-
- // update the
widget
-
_this.editWidgets.trimTimeline.update( _this, target, smilClip);
+ // Update
clipBegin
+
_this.editableTypes['time'].update( _this, smilClip, 'clipBegin',
sliderToTime( ui.values[ 0 ] ) );
+ // Update dur
+
_this.editableTypes['time'].update( _this, smilClip, 'dur', sliderToTime(
ui.values[ 1 ]- ui.values[0] ) );
+
+ // update the
widget display
+
_this.editWidgets.trimTimeline.onChange( _this, target, smilClip);
+
// Register the
edit state for undo / redo
_this.sequencer.getActionsEdit().registerEdit();
@@ -220,85 +232,152 @@
getDefaultText: function(){
return gM('mwe-sequencer-no_selected_resource');
},
- getEditToolId: function( toolId, attributeName){
+ setDefaultText: function(){
+ this.sequencer.getEditToolTarget().html(
+ this.getDefaultText()
+ )
+ },
+ getEditToolInputId: function( toolId, attributeName){
return 'editTool_' + toolId + '_' + attributeName;
- },
-
- drawClipEditTools: function( $target, smilClip){
-
+ },
+ /**
+ * update the current displayed tool ( when an undo, redo or history
jump changes smil state )
+ */
+ updateToolDisplay: function(){
+ var _this = this;
+ // Update all tool input values:: trigger change event if
changed
+ var smilClip = this.getCurrentSmilClip();
+
+ $j.each(
+ _this.getToolSet(
+ _this.sequencer.getSmil().getRefType( smilClip
)
+ ),
+ function( inx, toolId ){
+ var tool = _this.tools[toolId];
+ for( var i=0; i <
tool.editableAttributes.length ; i++ ){
+ var attributeName =
tool.editableAttributes[i];
+ var $editToolInput = $j('#' +
_this.getEditToolInputId( toolId, attributeName ) );
+ // Sync with smilClip value
+ if( smilClip.attr( attributeName ) !=
$editToolInput.val() ){
+ $editToolInput.val(
smilClip.attr( attributeName ) );
+ // trigger change event:
+ $editToolInput.change();
+ }
+ }
+ }
+ );
+ },
+ getToolSet: function( refType ){
+ var toolSet = [];
+ for( var toolId in this.tools){
+ if( this.tools[toolId].contentTypes){
+ if( $j.inArray( refType,
this.tools[toolId].contentTypes) != -1 ){
+ toolSet.push( toolId );
+ }
+ }
+ }
+ return toolSet;
+ },
+ drawClipEditTools: function( smilClip ){
+ var _this = this;
var toolId = '';
- // get the toolId based on what "ref type" smilClip is:
- switch( this.sequencer.getSmil().getRefType( smilClip ) ){
- case 'video':
- case 'audio':
- toolId = 'trim';
- break;
- default:
- toolId = 'duration';
- break;
- }
+ var $target = this.sequencer.getEditToolTarget();
+ // Set the current smilClip
+ this.currentSmilClip = smilClip;
- // Make sure the toolid exists
- if( !this.tools[ toolId ] ){
- mw.log("Error: tool " + toolId + ' not found');
- return ;
- }
- var tool = this.tools[ toolId ];
- // Append the title:
$target.empty().append(
- $j('<div />').addClass( 'editToolsContainer' )
- ,
- $j('<h3 />' ).append(
- tool.title
+ $j('<div />')
+ .addClass( 'editToolsContainer' )
+ .append(
+ $j('<ul />')
)
);
-
- // Build out the attribute list:
- for( var i=0; i < tool.editableAttributes.length ; i++ ){
- attributeName = tool.editableAttributes[i];
- $target.append(
- this.getEditableAttribute( smilClip, toolId,
attributeName )
+
+ // get the toolId based on what "ref type" smilClip is:
+ $j.each( this.getToolSet( this.sequencer.getSmil().getRefType(
smilClip ) ), function( inx, toolId ){
+
+ var tool = _this.tools[ toolId ];
+
+ // set the currentTool if not already set
+ if(!_this.currentToolId){
+ _this.currentToolId = toolId;
+ }
+
+ // Append the title to the ul list
+ $target.find( 'ul').append(
+ $j('<li />').append(
+ $j('<a />')
+ .attr('href', '#tooltab_' + toolId )
+ .text( gM('mwe-sequencer-tools-' +
toolId) )
+ )
);
- }
+
+ // Append the tooltab container
+ $target.append(
+ $j('<div />')
+ .attr('id', 'tooltab_' + toolId )
+ )
+ var $toolContainer = $target.find( '#tooltab_' + toolId
);
+
+ // Build out the attribute list for the given tool:
+ for( var i=0; i < tool.editableAttributes.length ; i++
){
+ attributeName = tool.editableAttributes[i];
+ $toolContainer.append(
+ _this.getEditableAttribute( smilClip,
toolId, attributeName )
+ );
+ }
+
+ // Output a float divider:
+ $toolContainer.append( $j('<div
/>').addClass('ui-helper-clearfix') );
+
+ // Build out tool widgets
+ if( tool.editWidgets ){
+ for( var i =0 ; i < tool.editWidgets.length ; i
++ ){
+ var editWidgetId = tool.editWidgets[i];
+ if( ! _this.editWidgets[editWidgetId] ){
+ mw.log("Error: not recogonized
widget: " + editWidgetId);
+ continue;
+ }
+ // Append a target for the edit widget:
+ $toolContainer.append(
+ $j('<div />')
+ .attr('id', 'editWidgets_' +
editWidgetId)
+ );
+ // Draw the binded widget:
+ _this.editWidgets[editWidgetId].draw(
+ _this,
+ $j( '#editWidgets_' +
editWidgetId ),
+ smilClip
+ )
+ // Output a float divider:
+ $toolContainer.append( $j('<div
/>').addClass( 'ui-helper-clearfix' ) );
+ }
+ }
+ });
- // output a float divider:
- $target.append( $j('<div />').addClass('ui-helper-clearfix') );
-
- // Build out widgets
- if( tool.editWidgets ){
- for( var i =0 ; i < tool.editWidgets.length ; i ++ ){
- var editWidgetId = tool.editWidgets[i];
- if( ! this.editWidgets[editWidgetId] ){
- mw.log("Error: not recogonized widget:
" + editWidgetId);
- continue;
- }
- // Append a target for the edit widget:
- $target.append(
- $j('<div />')
- .attr('id', 'editWidgets_' +
editWidgetId)
- );
- // Draw the binded widget:
- this.editWidgets[editWidgetId].draw(
- this,
- $j( '#editWidgets_' + editWidgetId ),
- smilClip
- )
- // Output a float divider:
- $target.append( $j('<div />').addClass(
'ui-helper-clearfix' ) );
- }
- }
-
- // Build out edit Actions buttons
- for( var i=0; i < tool.editActions.length ; i++){
- var editActionId = tool.editActions[i];
+ // Add tab bindings
+ $target.find('.editToolsContainer').tabs({
+ select: function(event, ui) {
+ debugger;
+ }
+ })
+ // Build out global edit Actions buttons ( per 'current tool' )
+ for( var editActionId in this.editActions ){
$target.append(
- this.getEditAction( smilClip, toolId,
editActionId )
+ this.getEditAction( smilClip, editActionId )
)
}
},
- getEditAction: function( smilClip, toolId, editActionId ){
+ getCurrentSmilClip: function(){
+ return this.currentSmilClip;
+ },
+ getCurrentToolId: function(){
+ return this.currentToolId;
+ },
+
+ getEditAction: function( smilClip, editActionId ){
if(! this.editActions[ editActionId ]){
mw.log("Error: getEditAction: " + editActionId + ' not
found ');
return ;
@@ -314,7 +393,7 @@
'margin': '5px'
})
.click( function(){
- editAction.action( _this, smilClip, toolId );
+ editAction.action( _this, smilClip );
})
return $actionButton;
},
@@ -350,7 +429,7 @@
$j('<input />')
.attr( {
- 'id' : _this.getEditToolId( toolId,
attributeName),
+ 'id' : _this.getEditToolInputId(
toolId, attributeName),
'size': 6
})
.data('initialValue', initialValue )
Modified:
branches/MwEmbedStandAlone/modules/Sequencer/remotes/mw.MediaWikiRemoteSequencer.js
===================================================================
---
branches/MwEmbedStandAlone/modules/Sequencer/remotes/mw.MediaWikiRemoteSequencer.js
2010-08-29 05:48:07 UTC (rev 71872)
+++
branches/MwEmbedStandAlone/modules/Sequencer/remotes/mw.MediaWikiRemoteSequencer.js
2010-08-29 08:38:50 UTC (rev 71873)
@@ -177,7 +177,7 @@
gM('mwe-sequencer-not-published',
$j('<a
/>').click( function(){
_this.showEditor();
- })
+
}).css('cursor', 'pointer')
)
)
.addClass( 'ui-state-highlight'
)
@@ -197,7 +197,7 @@
gM('mwe-sequencer-published-out-of-date',
$j('<a />').click( function(){
_this.showEditor();
-
})
+
}).css('cursor', 'pointer')
)
).addClass( 'ui-state-highlight' )
)
Modified: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBuffer.js
===================================================================
--- branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBuffer.js
2010-08-29 05:48:07 UTC (rev 71872)
+++ branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBuffer.js
2010-08-29 08:38:50 UTC (rev 71873)
@@ -295,8 +295,8 @@
/**
* Clip ready for grabbing a frame such as a canvas thumb
*/
- bufferedSeek: function( smilElement, relativeTime, callback ){
- mw.log("SmilBuffer::bufferedSeek:" + this.smil.getPageDomId(
smilElement ) + ' time:' + relativeTime );
+ bufferedSeekRelativeTime: function( smilElement, relativeTime, callback
){
+ mw.log("SmilBuffer::bufferedSeekRelativeTime:" +
this.smil.getPageDomId( smilElement ) + ' time:' + relativeTime );
var absoluteTime = relativeTime;
if( $j( smilElement ).attr('clipBegin') ){
Modified: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilLayout.js
===================================================================
--- branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilLayout.js
2010-08-29 05:48:07 UTC (rev 71872)
+++ branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilLayout.js
2010-08-29 08:38:50 UTC (rev 71873)
@@ -113,7 +113,7 @@
}
},
- drawElementThumb: function( $target, $node, relativeTime ){
+ drawElementThumb: function( $target, $node, relativeTime, callback){
mw.log('SmilLayout::drawElementThumb: ' + $node.attr('id') + '
relative time:' + relativeTime );
if( $target.length == 0 ){
mw.log("Error drawElementThumb to empty target");
@@ -121,10 +121,12 @@
}
// parse the time in case it came in as human input
relativeTime = this.smil.parseTime( relativeTime );
- switch ( this.smil.getRefType( $node )){
- case 'video':
- this.getVideoCanvasThumb($target, $node,
relativeTime )
- break;
+
+ if( this.smil.getRefType( $node ) == 'video' ){
+ this.getVideoCanvasThumb($target, $node, relativeTime,
callback )
+ return ;
+ }
+ switch ( this.smil.getRefType( $node ) ){
case 'img':
// xxx we could eventually use canvas as well
but for now just add it at 100%
$target.html(
@@ -151,14 +153,20 @@
,
$j('<span />')
.attr('title', titleStr)
- .css({'position': 'absolute',
'left':'16px'})
+ .css({
+ 'position': 'absolute',
+ 'left':'16px',
+ 'font-size' : 'x-small'
+ })
.text( titleStr )
)
break;
- }
+ }
+ if( callback )
+ callback();
},
- getVideoCanvasThumb: function($target, $node, relativeTime ){
+ getVideoCanvasThumb: function($target, $node, relativeTime, callback ){
var _this = this;
var naturaSize = {};
var drawElement = $j( '#' + this.smil.getPageDomId( $node )
).get(0);
@@ -172,22 +180,28 @@
naturaSize.width = drawElement.videoWidth;
// Draw the thumb via canvas grab
- // NOTE I attempted to scale down the image using
canvas but failed
+ // NOTE canvas scale issue prevents redraw at thumb
resolution
// xxx should revisit thumb size issue:
- $target.html( $j('<canvas />')
- .attr({
- height: naturaSize.height,
- width : naturaSize.width
- }).css( {
- height:'100%',
- widht:'100%'
- })
- .addClass("ui-corner-all")
- )
- .find( 'canvas')
- .get(0)
- .getContext('2d')
- .drawImage( drawElement, 0, 0)
+ try{
+ $target.html( $j('<canvas />')
+ .attr({
+ height: naturaSize.height,
+ width : naturaSize.width
+ }).css( {
+ height:'100%',
+ widht:'100%'
+ })
+ .addClass("ui-corner-all")
+ )
+ .find( 'canvas')
+ .get(0)
+ .getContext('2d')
+ .drawImage( drawElement, 0, 0)
+ } catch (e){
+ mw.log("Error:: getVideoCanvasThumb : could not
draw canvas image");
+ }
+ if( callback )
+ callback();
}
// check if relativeTime transform matches current absolute
time then render directly:
@@ -201,7 +215,7 @@
// span new draw element
var $tmpFrameNode = $node.clone();
$tmpFrameNode.attr('id', $node.attr('id') +
'_tmpFrameNode' );
- this.smil.getBuffer().bufferedSeek( $tmpFrameNode,
relativeTime, function(){
+ this.smil.getBuffer().bufferedSeekRelativeTime(
$tmpFrameNode, relativeTime, function(){
// update the drawElement
drawElement = $j( '#' +
_this.smil.getPageDomId( $tmpFrameNode ) ).get(0);
drawFrame( drawElement );
Modified:
branches/MwEmbedStandAlone/modules/TimedText/remotes/RemoteMwTimedText.js
===================================================================
--- branches/MwEmbedStandAlone/modules/TimedText/remotes/RemoteMwTimedText.js
2010-08-29 05:48:07 UTC (rev 71872)
+++ branches/MwEmbedStandAlone/modules/TimedText/remotes/RemoteMwTimedText.js
2010-08-29 08:38:50 UTC (rev 71873)
@@ -158,7 +158,7 @@
_this.embedByTitle( pt[1],
callback);
return ;
} else {
- mw.log( 'Error: addByTitle
could not process redirect' );
+ mw.log( 'Error:
getTitleResource could not process redirect' );
callback( false );
return false;
}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs