http://www.mediawiki.org/wiki/Special:Code/MediaWiki/72072
Revision: 72072
Author: dale
Date: 2010-09-01 00:17:06 +0000 (Wed, 01 Sep 2010)
Log Message:
-----------
* improved panzoom layout support
* improved integration support gadget helper
Modified Paths:
--------------
branches/MwEmbedStandAlone/modules/AddMedia/searchLibs/baseRemoteSearch.js
branches/MwEmbedStandAlone/modules/AddMedia/searchLibs/mediaWikiSearch.js
branches/MwEmbedStandAlone/modules/Sequencer/Sequencer.i18n.php
branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerAddByUrl.js
branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerServer.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.SmilAnimate.js
branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBuffer.js
branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilLayout.js
Modified:
branches/MwEmbedStandAlone/modules/AddMedia/searchLibs/baseRemoteSearch.js
===================================================================
--- branches/MwEmbedStandAlone/modules/AddMedia/searchLibs/baseRemoteSearch.js
2010-09-01 00:06:30 UTC (rev 72071)
+++ branches/MwEmbedStandAlone/modules/AddMedia/searchLibs/baseRemoteSearch.js
2010-09-01 00:17:06 UTC (rev 72072)
@@ -56,7 +56,7 @@
num_results : 0,
/**
- * Initialise the baseRemoteSearch
+ * Initialize the baseRemoteSearch
* @param {Object} options The set of options for the remote search class
*/
init: function( options ) {
Modified:
branches/MwEmbedStandAlone/modules/AddMedia/searchLibs/mediaWikiSearch.js
===================================================================
--- branches/MwEmbedStandAlone/modules/AddMedia/searchLibs/mediaWikiSearch.js
2010-09-01 00:06:30 UTC (rev 72071)
+++ branches/MwEmbedStandAlone/modules/AddMedia/searchLibs/mediaWikiSearch.js
2010-09-01 00:17:06 UTC (rev 72072)
@@ -49,7 +49,12 @@
},
getResourceFromUrl: function( url, callback ){
- this.getByTitle( this.getTitleKeyFromMwUrl( url ), callback );
+ var title = this.getTitleKeyFromMwUrl( url );
+ if( !title) {
+ callback( false );
+ return ;
+ }
+ this.getByTitle(title , callback );
},
/**
* Does best effort to get the title key from a mediawiki url
Modified: branches/MwEmbedStandAlone/modules/Sequencer/Sequencer.i18n.php
===================================================================
--- branches/MwEmbedStandAlone/modules/Sequencer/Sequencer.i18n.php
2010-09-01 00:06:30 UTC (rev 72071)
+++ branches/MwEmbedStandAlone/modules/Sequencer/Sequencer.i18n.php
2010-09-01 00:17:06 UTC (rev 72072)
@@ -8,7 +8,7 @@
$messages = array();
$messages['en'] = array(
- 'mwe-sequencer-loading-sequencer' => 'Loading sequencer ...',
+ 'mwe-sequencer-loading-sequencer' => 'Loading sequencer ...',
'mwe-sequencer-you-can-edit-this-video' => 'You can [$1 edit this
video]',
'mwe-sequencer-using-kaltura-video-editor' => 'Using the [$1 Kaltura]
video editor',
@@ -20,7 +20,7 @@
'mwe-sequencer-loading-timeline' => 'Loading timeline ...',
'mwe-sequencer-loading-player' => 'Loading player ...',
'mwe-sequencer-loading-menu' => 'Loading menu ...',
- 'mwe-sequencer-loading-asset' => 'Loading asset ...',
+ 'mwe-sequencer-loading-asset' => 'Loading asset ...',
'mwe-sequencer-no_selected_resource' => '<h3>No resource selected</h3>
Select a clip to enable editing.',
'mwe-sequencer-untitled-sequence' => 'Untitled sequence',
@@ -45,6 +45,8 @@
'mwe-sequencer-tools-panzoomhelper-desc' => 'Resize and move the
<i>layout helper</i> to update layout',
'mwe-sequencer-tools-panzoomhelper-resetlayout' => 'Reset layout',
+
+
'mwe-sequencer-tools-transitions' => 'Transitions',
'mwe-sequencer-tools-transitions-desc' => 'Set in and out Transitions',
'mwe-sequencer-clip-transin' => 'Transition in',
@@ -53,8 +55,8 @@
'mwe-sequencer-preview' => 'Preview',
'mwe-sequencer-apply-changes' => 'Apply changes',
'mwe-sequencer-start-time' => 'Start time',
-
+
'mwe-sequencer-loading_user_rights' => 'Loading user rights ...',
'mwe-sequencer-sequence-xml' => 'Sequence smil xml',
'mwe-sequencer-render-sequence' => 'Render sequence to file',
@@ -72,7 +74,7 @@
'mwe-sequencer-menu-sequence-open-desc' => 'Open a sequence for
editing',
'mwe-sequencer-menu-sequence-save' => 'Save',
- 'mwe-sequencer-menu-sequence-save-desc' => 'Save sequence changes',
+ 'mwe-sequencer-menu-sequence-save-desc' => 'Save sequence changes',
'mwe-sequencer-menu-sequence-publish' => 'Publish',
'mwe-sequencer-menu-sequence-publish-desc' => 'Publish sequence',
'mwe-sequencer-menu-sequence-renderdisk' => 'Render to disk',
@@ -91,18 +93,20 @@
'mwe-sequencer-menu-view-smilxml' => 'Sequence SMIL XML',
'mwe-sequencer-url-or-search' => 'URL or search term',
+ 'mwe-sequencer-import-url-not-supported' => 'Only asset page urls from
$1 presently supported',
+
'mwe-sequencer-get-media' => 'Get media',
'mwe-sequencer-insert-resource' => 'Insert resource into sequence',
'mwe-sequencer-insert'=> 'Insert into sequence',
'mwe-sequencer-no-server-defined' => 'No server has been defined for
this sequence session. You will not be able to save sequences',
-
+
'mwe-sequencer-no_edit_permissions' => 'Can not save sequence',
'mwe-sequencer-no_edit_permissions-desc' => 'You do not have
permissions to save changes to this sequence',
'mwe-sequencer-save-no-changes' => 'There are no new edits to save',
'mwe-sequencer-save-summary' => 'Please enter a short summary of
changes:',
- 'mwe-sequencer-edit_cancel' => 'Cancel sequence edit',
+ 'mwe-sequencer-edit_cancel' => 'Cancel sequence edit',
'mwe-sequencer-saving_wait' => 'Save in progress (please wait)',
'mwe-sequencer-save_done' => 'Save complete',
@@ -114,7 +118,7 @@
'mwe-sequencer-published-out-of-date' =>'This published sequence is not
the most recent version. Select <i>sequence -> publish</i> in the <b>[$1
sequence editor]</b> to publish this sequence',
'mwe-sequencer-already-published' => "The most recent version of this
sequence is already published",
-
+
'mwe-sequencer-loading-publish-render' => 'Loading publisher...',
'mwe-sequencer-please-save-publish' => 'Please save changes before you
publish',
'mwe-sequencer-running-publish' => 'Publishing sequence, please
wait...',
@@ -125,19 +129,19 @@
'mwe-sequencer-publishing-success' => 'Publish success',
'mwe-sequencer-publishing-success-desc' => 'Sequence has successfully
been published. [$1 Published file]',
-
+
'mwe-sequencer-effects' => 'Effects stack',
'mwe-sequencer-remove_transition' => 'Remove transition',
'mwe-sequencer-edit_transin' => 'Edit transition into clip',
'mwe-sequencer-edit_transout' => 'Edit transition out of clip',
'mwe-sequencer-add-transition' => 'Add a transition',
- 'mwe-sequencer-menu_clipedit' => 'Edit media',
+ 'mwe-sequencer-menu_clipedit' => 'Edit media',
'mwe-sequencer-menu_cliplib' => 'Add media',
'mwe-sequencer-menu_resource_overview' => 'Resource overview',
'mwe-sequencer-menu_options' => 'Options',
-
+
'mwe-sequencer-edit_cancel_confirm' => 'Are you sure you want to cancel
your edit? Changes will be lost.',
'mwe-sequencer-zoom_in' => 'Zoom in',
'mwe-sequencer-zoom_out' => 'Zoom out',
@@ -148,7 +152,7 @@
'mwe-sequencer-pixle2sec' => 'pixels to seconds',
'mwe-sequencer-rmclip' => 'Remove clip',
'mwe-sequencer-clip_in' => 'clip in',
- 'mwe-sequencer-clip_out' => 'clip out',
+ 'mwe-sequencer-clip_out' => 'clip out',
'mwe-sequencer-editor_options' => 'Editor options',
'mwe-sequencer-editor_mode' => 'Editor mode',
'mwe-sequencer-simple_editor_desc' => 'simple editor (iMovie style)',
Modified: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerAddByUrl.js
===================================================================
--- branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerAddByUrl.js
2010-09-01 00:06:30 UTC (rev 72071)
+++ branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerAddByUrl.js
2010-09-01 00:17:06 UTC (rev 72072)
@@ -27,8 +27,10 @@
* Uses remoteSearchDriver to help in retrieving entry info
* @param {Object} remoteSearchDriver The remote search driver
*/
- addByUrlDialog: function( remoteSearchDriver, url ){
- var _this = this;
+ addByUrlDialog: function( remoteSearchDriver, importUrl ){
+ var _this = this;
+ var importUrl = unescape( importUrl );
+ mw.log('SequencerAddByUrl::addByUrlDialog:'+ importUrl);
var $dialog = mw.addLoaderDialog( gM(
'mwe-sequencer-loading-asset' ) );
// Close / empty the toolWindow
@@ -37,27 +39,28 @@
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::"
+ if( mw.parseUri( provider.detailsUrl ).host ==
mw.parseUri( importUrl).host ){
+ foundImportUrl = true;
+ mw.log( "addByUrlDialog: matching host
getResourceFromUrl::"
+ mw.parseUri(
provider.detailsUrl ).host
- + ' == ' + mw.parseUri(
url).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 );
+ var titleKey =
provider.sObj.getTitleKeyFromMwUrl( importUrl );
if( !titleKey ){
+ $dialog.html(
gM('mwe-sequencer-import-url-not-supported', 'commons.wikimedia.org' ) )
// 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 ){
+
remoteSearchDriver.getResourceFromUrl( provider, importUrl, function( resource
){
if( ! resource
){
$dialog.html( 'Error loading asset');
return
;
@@ -83,8 +86,9 @@
});
if( ! foundImportUrl ){
- mw.closeLoaderDialog();
+ $dialog.html(
gM('mwe-sequencer-import-url-not-supported', 'commons.wikimedia.org' ) );
}
+
// xxx support direct asset include
if( mw.getConfig( 'Sequencer.AddAssetByUrl' )){
// try directly adding the asset
Modified: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerServer.js
===================================================================
--- branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerServer.js
2010-09-01 00:06:30 UTC (rev 72071)
+++ branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerServer.js
2010-09-01 00:17:06 UTC (rev 72072)
@@ -93,6 +93,10 @@
// set smil to empty string if unset:
if(!smilXml )
smilXml = '';
+
+ // Check for remote payload wrapper
+ smilXml = mw.getRemoteSequencerPayLoad( smilXml
);
+
// Cache the latest serverSmil ( for local
change checks )
// ( save requests automatically respond with
warnings on other user updates )
_this.serverSmilXml = smilXml;
@@ -133,7 +137,7 @@
'action' : 'edit',
'summary' : saveSummary,
'title' : _this.titleKey,
- 'text' : sequenceXML,
+ 'text' :
mw.getRemoteSequencerPageHelper( sequenceXML ),
'token': token
};
mw.getJSON( _this.getApiUrl(), request,
function( data ) {
@@ -149,8 +153,7 @@
}
})
})
- },
-
+ },
/**
* Check if the published file is up-to-date with the saved
sequence
* ( higher page revision for file than sequence )
Modified: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTimeline.js
===================================================================
--- branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTimeline.js
2010-09-01 00:06:30 UTC (rev 72071)
+++ branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTimeline.js
2010-09-01 00:17:06 UTC (rev 72072)
@@ -178,9 +178,10 @@
// Draw the node onto the timeline if the clip is not
already there:
var $timelineClip = $clipTrackSet.find( '#' +
_this.getTimelineClipId( $node ) )
if( $timelineClip.length == 0 ){
- mw.log(" ADD: " + _this.getTimelineClipId(
$node ) + ' to ' + $clipTrackSet.attr('id') );
+ mw.log("SequencerTimeline::drawTrackClips: 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 );
if( $previusClip ){
$previusClip.after(
@@ -198,24 +199,41 @@
// mw.log( 'indexOrder::' +
$timelineClip.attr('id') + ' '+ $timelineClip.data('indexOrder') + ' == ' +
$node.data('indexOrder'));
if( $timelineClip.data('indexOrder') !=
$node.data('indexOrder') ){
reOrderTimelineFlag = true;
- }
+ }
}
// 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(){
+ smil.getBuffer().bufferedSeekRelativeTime(
$node, 0, function(){
+ // Update the timeline clip layout
+
mw.log("getTrackClipInterface::bufferedSeekRelativeTime for " +
smil.getPageDomId( $node ));
_this.drawClipThumb( $node , 0,
function(){
+ // Clip is ready decrement the
thum render queue
thumbRenderStack--;
+
+ // XXX this is now called in a
few places need to refactor to call i
+ if( $node.attr('panZoom') ){
+ var $thumbTarget = $j(
'#' + _this.getTimelineClipId( $node ) ).find('.thumbTraget');
+
_this.sequencer.getSmil().getLayout().panZoomLayout( $node.get(0),
+ $thumbTarget,
+
$thumbTarget.find('img').get(0)
+ );
+ }
+ // check if all the sequence
track thumbs have been rendered can issue the sequence render callback:
if( thumbRenderStack == 0 ){
callback();
}
});
+
+ // Check for panZoom attribute
+
});
}
+
// Update the $previusClip
$previusClip = $timelineClip;
@@ -327,9 +345,7 @@
return $j('<li />')
.attr('id', _this.getTimelineClipId( $node ) )
- .data( {
- 'smilId': $node.attr('id'),
- })
+ .data( 'smilId', $node.attr('id') )
.css( 'height', this.getSequenceTrackHeight(
smilSequenceTrack) - 10 )
.addClass( 'timelineClip ui-corner-all' )
.loadingSpinner()
@@ -704,6 +720,10 @@
if( $thumbTarget.children().length == 0 ){
mw.log(
"SequencerTimeline::drawClipThumb: force image fallabck:: " + img.src);
$thumbTarget.html( img );
+ if( callback ){
+ callback();
+ callback = null;
+ }
}
}, 5000);
}
@@ -711,8 +731,13 @@
// Buffer the asset then render it into the layout target:
smil.getBuffer().bufferedSeekRelativeTime( $node, relativeTime,
function(){
// Add the seek, Add to canvas and draw thumb request
- smil.getLayout().drawElementThumb( $thumbTarget, $node,
relativeTime, callback );
-
+ smil.getLayout().drawElementThumb( $thumbTarget, $node,
relativeTime, function(){
+ // Run the callback and un-set it for the
current closure
+ if( callback ){
+ callback();
+ callback = null;
+ }
+ });
})
},
/**
Modified: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTools.js
===================================================================
--- branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTools.js
2010-09-01 00:06:30 UTC (rev 72071)
+++ branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTools.js
2010-09-01 00:17:06 UTC (rev 72072)
@@ -56,7 +56,7 @@
'type' : 'display',
'inputSize' : 15,
'title' : gM('mwe-sequencer-clip-panzoom' ),
- 'defaultValue' : '0, 0, 100%, 100%'
+ 'defaultValue' : '0%, 0%, 100%, 100%'
},
'transIn' : {
'type' : 'select',
@@ -153,12 +153,25 @@
'onChange': function( _this, target, smilClip ){
var panZoomVal = $j('#'
+_this.getEditToolInputId( 'panzoom', 'panZoom')).val();
mw.log("panzoom change:" + panZoomVal );
+
// Update on the current smil clip display:
_this.sequencer.getSmil()
.getLayout()
.panZoomLayout(
smilClip
);
+ var $thumbTraget = $j( '#' +
_this.sequencer.getTimeline().getTimelineClipId( smilClip )
).find('.thumbTraget');
+ // Update the timeline clip display
+ // xxx this should be abstracted to timeline
handler for clip updates
+ _this.sequencer.getSmil()
+ .getLayout()
+ .panZoomLayout(
+ smilClip,
+ $thumbTraget,
+ $thumbTraget.find('img').get(0)
+ )
+ // Register the change for undo redo
+ _this.sequencer.getActionsEdit().registerEdit();
},
'draw': function( _this, target, smilClip ){
var orginalHelperCss = {
@@ -230,11 +243,11 @@
var pz = startPanZoomVal.split(',');
// Set the new percent offset to x/2
if( layout.left ){
- pz[0] = ( parseInt( pz[0] ) - (
layout.left ) ) + '%';
+ pz[0] = ( parseInt( pz[0] ) - (
layout.left / 4 ) ) + '%';
}
if( layout.top ){
- pz[1] = ( parseInt( pz[1] ) - (
layout.top ) )+ '%';
+ pz[1] = ( parseInt( pz[1] ) - (
layout.top / 4 ) )+ '%';
}
if( layout.width ) {
@@ -244,7 +257,7 @@
pz[3] = parseInt( pz[2] ) *
_this.sequencer.getSmil().getLayout().getTargetAspectRatio();
// only have 2 significant
digits
- }
+ }
// Trim and round all % values
for(var i=0; i < pz.length; i++){
pz[i] = ( Math.round( parseInt(
pz[i] ) * 1000 ) / 1000 ) + '%';
@@ -282,6 +295,8 @@
// run the onChange ?
// Restore original css for the
layout helper
$j(this).css( orginalHelperCss )
+ // trigger the 'change'
+
_this.editWidgets.panzoom.onChange( _this, target, smilClip );
}
})
.css('cursor', 'move')
@@ -302,6 +317,8 @@
stop: function( event, ui){
// Restore original css
$j(this).css( orginalHelperCss )
+ // trigger the change
+
_this.editWidgets.panzoom.onChange( _this, target, smilClip );
}
})
@@ -353,26 +370,48 @@
$j('<div
/>').addClass('ui-helper-clearfix')
)
}
+ // The local scope fullClipDuration
+ var fullClipDuration = null;
- // Add a trim binding:
- $j('#' + _this.getEditToolInputId( 'trim',
'clipBegin') +
- ',#' + _this.getEditToolInputId( 'trim',
'dur') )
- .change( function(){
+ // Some slider functions
+ var sliderToTime = function( sliderval ){
+ return parseInt( fullClipDuration * (
sliderval / 1000 ) );
+ }
+ var timeToSlider = function( time ){
+ return parseInt( ( time /
fullClipDuration ) * 1000 );
+ }
+
+
+ var onInputChange = function( sliderIndex,
value ){
_this.editWidgets.trimTimeline.onChange( _this, target, smilClip);
- })
+ // Get the value
+ if( fullClipDuration ){
+ var uiValues =
$j(_this.sequencer.id + '_trimTimeline' ).slider( 'option', 'values');
+ uiValues[ sliderIndex,
timeToSlider( value) ];
+ // Set the value
+ $j( _this.sequencer.id +
'_trimTimeline' ).slider( 'option', 'values', uiValues);
+ }
+ }
- // Update the thumbnails:
- _this.editWidgets.trimTimeline.onChange( _this,
target, smilClip);
+ // Add a trim binding:
+ $j('#' + _this.getEditToolInputId( 'trim',
'clipBegin') )
+ .change( function(){
+ onInputChange( 0, $j(this).val() );
+ });
+ $j('#' + _this.getEditToolInputId( 'trim',
'dur') )
+ .change( function(){
+ onInputChange( 1, $j(this).val() );
+ });
+
+ // Update the thumbnails:
+ _this.editWidgets.trimTimeline.onChange( _this,
target, smilClip );
+
// Get the clip full duration to build out the
timeline selector
- smil.getBody().getClipAssetDuration( smilClip,
function( fullClipDuration ) {
-
- var sliderToTime = function( sliderval
){
- return parseInt(
fullClipDuration * ( sliderval / 1000 ) );
- }
- var timeToSlider = function( time ){
- return parseInt( ( time /
fullClipDuration ) * 1000 );
- }
+ smil.getBody().getClipAssetDuration( smilClip,
function( clipDuration ) {
+ // update the local scope global
+ fullClipDuration = clipDuration;
+
var startSlider = timeToSlider(
smil.parseTime( $j('#editTool_trim_clipBegin').val() ) );
var sliderValues = [
startSlider,
@@ -384,8 +423,8 @@
.attr( 'id', _this.sequencer.id
+ '_trimTimeline' )
.css({
'position': 'absolute',
- 'left' : '15px',
- 'right' : '15px',
+ 'left' : '25px',
+ 'right' : '35px',
'margin': '5px'
})
.slider({
Modified:
branches/MwEmbedStandAlone/modules/Sequencer/remotes/mw.MediaWikiRemoteSequencer.js
===================================================================
---
branches/MwEmbedStandAlone/modules/Sequencer/remotes/mw.MediaWikiRemoteSequencer.js
2010-09-01 00:06:30 UTC (rev 72071)
+++
branches/MwEmbedStandAlone/modules/Sequencer/remotes/mw.MediaWikiRemoteSequencer.js
2010-09-01 00:17:06 UTC (rev 72072)
@@ -47,8 +47,33 @@
url+='withJS=MediaWiki:MwEmbed.js';
}
return url;
-},
+};
+var SEQUENCER_PAYLOADKEY = '@gadgetsequencepayl...@_$%^%';
+
+
+mw.getRemoteSequencerPageHelper = function( xmlString ){
+ return 'To edit this sequence ' +
+ '[{{fullurl:{{FULLPAGENAME}}|withJS=MediaWiki:MwEmbed.js}}
enable the sequencer] for this page' +
+ "\n\n<!-- " + SEQUENCER_PAYLOADKEY + "\n" +
+ xmlString +
+ "\n\n " + SEQUENCER_PAYLOADKEY + " -->"
+};
+mw.getRemoteSequencerPayLoad = function( pageText ){
+ var startKey = '<!-- ' + SEQUENCER_PAYLOADKEY;
+ var endKey = SEQUENCER_PAYLOADKEY + ' -->';
+ // if the key is not found fail
+ if( pageText.indexOf( startKey ) == -1 || pageText.indexOf(endKey) ==
-1 ){
+ mw.log("Error could not find sequence payload");
+ return '';
+ }
+ var payload = pageText.substring( pageText.indexOf( startKey ) +
startKey.length,
+ pageText.indexOf(endKey )
+ );
+ // trim the output:
+ return $j.trim( payload );
+};
+
// Add player pause binding if config is set::
$j( mw ).bind( 'newEmbedPlayerEvent', function( event, embedPlayerId ) {
if( mw.getConfig( 'Sequencer.KalturaPlayerEditOverlay' )){
Modified: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilAnimate.js
===================================================================
--- branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilAnimate.js
2010-09-01 00:06:30 UTC (rev 72071)
+++ branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilAnimate.js
2010-09-01 00:17:06 UTC (rev 72072)
@@ -413,33 +413,37 @@
switch( namedValueOrder[i] ){
case 'left':
case 'width':
- percentValues[
namedValueOrder[i] ] =
- ( parseFloat(
targetValue[i] ) / naturalSize.width ) * 100
+ percentValues[
namedValueOrder[i] ] =
+ ( ( parseFloat(
targetValue[i] ) / naturalSize.width ) * 100 ) + '%';
break;
case 'height':
case 'top':
percentValues[
namedValueOrder[i] ] =
- ( parseFloat(
targetValue[i] ) / naturalSize.height ) * 100
+ ( ( parseFloat(
targetValue[i] ) / naturalSize.height ) * 100 ) + '%';
break;
}
} else {
- percentValues[ namedValueOrder[i] ] =
parseFloat( targetValue[i] );
- }
+ percentValues[ namedValueOrder[i] ] =
parseFloat( targetValue[i] ) + '%';
+ }
}
return percentValues;
},
// xxx need to refactor move to "smilLayout"
- updateElementLayout: function( smilElement, percentValues ){
+ updateElementLayout: function( smilElement, percentValues, $target,
htmlElement ){
var _this = this;
- mw.log("updateElementLayout::" + ' ' + percentValues.left + ' '
+ percentValues.top + ' ' + percentValues.width + ' ' + percentValues.height );
+ //mw.log("updateElementLayout::" + ' ' + percentValues.left + '
' + percentValues.top + ' ' + percentValues.width + ' ' + percentValues.height
);
// get a pointer to the html target:
- var $target = $j( '#' + this.smil.getPageDomId( smilElement ));
- var htmlElement = $j( '#' + this.smil.getPageDomId( smilElement
) ).get(0);
-
- // Wrap the target with its natura size ( if not already )
- if( $target.parent('.refTransformWrap').length == 0 ){
+ if( !$target ) {
+ $target = $j( '#' + this.smil.getPageDomId( smilElement
));
+ }
+ if( !htmlElement){
+ htmlElement = $j( '#' + this.smil.getPageDomId(
smilElement ) ).get(0);
+ }
+
+ // Wrap the target with its natural size ( if not already )
+ if( $target.parent( '.refTransformWrap' ).length == 0 ){
$target
.wrap(
$j( '<div />' )
@@ -451,19 +455,23 @@
'width' : '100%',
'height' : '100%'
} )
- .addClass('refTransformWrap')
+ .addClass( 'refTransformWrap' )
)
}
_this.smil.getLayout().getNaturalSize( htmlElement, function(
natrualSize ){
// XXX note we have locked aspect so we can use 'width'
here:
- var sizeCss =
_this.smil.getLayout().getDominateAspectTransform( natrualSize, null,
percentValues.width );
+
+ var sizeCss =
_this.smil.getLayout().getDominateAspectTransform( natrualSize, null,
percentValues.width );
+ //mw.log( ' w: ' + sizeCss.width + ' h ' +
sizeCss.height + ' of : ' + $target.get(0).nodeName );
// Run the css transform
$target.css( {
- 'position' : 'absolute',
+ 'position' : 'absolute',
'left' : percentValues.left,
- 'top' : percentValues.top
- }).css( sizeCss );
+ 'top' : percentValues.top
+ })
+ .css( sizeCss );
+ //mw.log(' target width: ' + $target.css('width') );
});
},
Modified: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBuffer.js
===================================================================
--- branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBuffer.js
2010-09-01 00:06:30 UTC (rev 72071)
+++ branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBuffer.js
2010-09-01 00:17:06 UTC (rev 72072)
@@ -121,8 +121,6 @@
// Get all active elements for requested bufferTime
this.smil.getBody().getElementsForTime( bufferTime, function(
smilElement){
// If the element is in "activePlayback" ( don't try to
load it )
- /*mw.log('continueBufferLoad::' +
_this.smil.getPageDomId( smilElement )
- + $j( smilElement
).data('activePlayback' ));*/
if( ! $j( smilElement ).data('activePlayback' ) ){
// Start loading active assets
_this.loadElement( smilElement );
@@ -138,7 +136,7 @@
var timeBuffered = _this.getBufferedPercent() *
_this.smil.getDuration();
//mw.log( 'ContinueBufferLoad::Timed buffered: ' +
timeBuffered );
_this.continueBufferLoad( timeBuffered );
- }, this.smil.embedPlayer.monitorRate * 2 );
+ }, this.smil.embedPlayer.monitorRate * 4 );
},
@@ -156,7 +154,8 @@
// because DOM update are displayed at a given dom draw
rate )
_this.smil.getLayout().hideElement( smilElement );
mw.log('loadElement::Add:' + this.smil.getPageDomId(
smilElement )+ ' len: ' + $j( '#' + this.smil.getPageDomId( smilElement )
).length );
- }
+ }
+
// Start "loading" the asset (for now just video )
// but in theory we could set something up with large images
switch( this.smil.getRefType( smilElement ) ){
Modified: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilLayout.js
===================================================================
--- branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilLayout.js
2010-09-01 00:06:30 UTC (rev 72071)
+++ branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilLayout.js
2010-09-01 00:17:06 UTC (rev 72072)
@@ -127,6 +127,7 @@
}
switch ( this.smil.getRefType( $node ) ){
case 'img':
+ // XXX should refactor and to use same path as
player embed
// xxx we should use canvas here but for now
just hack it up:
var $playerImage = this.getSmilImgHtml( $node
);
$target.html(
@@ -136,7 +137,7 @@
})
);
var img = $target.find('img').get(0)
- _this.getNaturalSize( img, function(
natrualSize ){
+ _this.getNaturalSize( img, function(
natrualSize ){
_this.fitMeetBest(
img,
natrualSize,
@@ -145,6 +146,11 @@
'height' :
$target.height()
}
)
+ // Check for panZoom attribute
+ //( if animation is set it will
override this value )
+ if( $node.attr('panZoom') ){
+ _this.panZoomLayout(
$node.get(0), $target, img );
+ }
});
break;
case 'cdata_html':
@@ -517,10 +523,10 @@
'height' : this.smil.embedPlayer.getHeight()
}
this.fitMeetBest(
- $j( '#' + this.smil.getPageDomId(
smilElement ) ).get(0),
- naturalSize,
- targetSize
- );
+ $j( '#' + this.smil.getPageDomId( smilElement )
).get(0),
+ naturalSize,
+ targetSize
+ );
} else {
mw.log("Layout mode: " + fitMode + ' not yet
supported');
}
@@ -536,14 +542,16 @@
fitMeetBest: function( element, natrualSize, targetSize ){
var _this = this;
+
// xxx Should read smil "imgElement" fill type
var imageCss = _this.getDominateAspectTransform( natrualSize,
targetSize, 100 );
-
+ mw.log('SmilLayout::fitMeetBest: ns'+ natrualSize.width + ' ts:
' + targetSize.width +
+ ' css: w:' + imageCss.width + ' h:' +
imageCss.height);
// update the layout of the element
$j( element ).css( imageCss );
},
- getDominateAspectTransform: function(natrualSize, targetSize,
transformPercent ){
+ getDominateAspectTransform: function( natrualSize, targetSize,
transformPercent ){
var _this = this;
var transformCss = {}
if( ! targetSize ){
@@ -553,21 +561,31 @@
};
}
// Fit the image per the provided targetWidth closure
- if( natrualSize.width / natrualSize.height > targetSize.width /
targetSize.height ){
- transformCss.width = transformPercent + '%';
- transformCss.height = ( transformPercent * (
+ /* mw.log( 'getDominateAspectTransform:: naspect:' +
+ ( natrualSize.width / natrualSize.height ) +
+ ' taspect: ' + targetSize.width + '/' +
targetSize.height + ' = ' + ( targetSize.width / targetSize.height )
+ );
+ */
+ var targetAspect = ( parseFloat( targetSize.width ) /
parseFloat( targetSize.height ) )
+ var natrualAspect = ( natrualSize.width / natrualSize.height );
+
+ // pad the natural size ratio by .01 so that aspect ratio
rounding does not
+ // xxx height domination here may be confused refactor this
check
+ if( natrualAspect >= targetAspect ){
+ transformCss.width = parseFloat( transformPercent ) +
'%';
+ transformCss.height = ( parseFloat( transformPercent )
* (
( natrualSize.height /
natrualSize.width ) /
- _this.getTargetAspectRatio()
+ ( targetSize.height /
targetSize.width )
)
) + '%';
}
// Fit vertically
- if(! transformCss.height || natrualSize.width /
natrualSize.height < targetSize.width / targetSize.height ){
- transformCss.height = transformPercent + '%';
- transformCss.width = ( transformPercent *
+ if(! transformCss.height || natrualAspect < targetAspect ){
+ transformCss.height = parseFloat( transformPercent ) +
'%';
+ transformCss.width = ( parseFloat( transformPercent ) *
( natrualSize.width /
natrualSize.height ) /
- _this.getTargetAspectRatio()
+ ( targetSize.width / targetSize.height )
) + '%';
}
return transformCss;
@@ -576,10 +594,12 @@
/**
* layout function
*/
- panZoomLayout: function( smilElement ){
+ panZoomLayout: function( smilElement, $target, img ){
var _this = this;
var panZoom = $j( smilElement).attr('panZoom').split(',');
- var img = $j( '#' + this.smil.getPageDomId( smilElement )
).get(0);
+ if( !img ){
+ var img = $j( '#' + this.smil.getPageDomId( smilElement
) ).get(0);
+ }
_this.getNaturalSize( img, function( natrualSize ){
// Check if the transfrom is needed:
@@ -596,9 +616,9 @@
}
// Get percent values
var percentValues =
_this.smil.getAnimate().getPercentFromPanZoomValues( panZoom, natrualSize );
-
+ //mw.log('panZoomLayout::' + 'l:' + percentValues.left
+ ' t:' + percentValues.top + ' w:' + percentValues.width + ' h:' +
percentValues.height );
// Update the layout via the animation engine
updateElementLayout method
- _this.smil.getAnimate().updateElementLayout(
smilElement, percentValues );
+ _this.smil.getAnimate().updateElementLayout(
smilElement, percentValues, $target, img );
});
},
/**
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs