http://www.mediawiki.org/wiki/Special:Code/MediaWiki/70597
Revision: 70597
Author: dale
Date: 2010-08-06 21:17:18 +0000 (Fri, 06 Aug 2010)
Log Message:
-----------
Modified Paths:
--------------
branches/MwEmbedStandAlone/modules/EmbedPlayer/loader.js
branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayer.js
branches/MwEmbedStandAlone/modules/Playlist/loader.js
branches/MwEmbedStandAlone/modules/Playlist/mw.Playlist.js
branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerAddMedia.js
branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerMenu.js
branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTimeline.js
branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTools.js
Modified: branches/MwEmbedStandAlone/modules/EmbedPlayer/loader.js
===================================================================
--- branches/MwEmbedStandAlone/modules/EmbedPlayer/loader.js 2010-08-06
21:10:18 UTC (rev 70596)
+++ branches/MwEmbedStandAlone/modules/EmbedPlayer/loader.js 2010-08-06
21:17:18 UTC (rev 70597)
@@ -111,7 +111,7 @@
* mwEmbed player is setup before any other mw.ready calls
*/
mw.addSetupHook( function( callback ) {
- mw.log( 'Document::' + mw.documentHasPlayerTags() );
+ mw.log( 'EmbedPlayer:: Document::' + mw.documentHasPlayerTags()
);
if( mw.documentHasPlayerTags() ) {
var rewriteElementCount = 0;
Modified: branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayer.js
===================================================================
--- branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayer.js
2010-08-06 21:10:18 UTC (rev 70596)
+++ branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayer.js
2010-08-06 21:17:18 UTC (rev 70597)
@@ -436,11 +436,10 @@
// Update the list of dependent libraries for the player
// ( allows extensions to add to the dependency list )
mw.embedPlayerUpdateLibraryRequest( playerElement,
playerDependencyRequest );
-
+
// Load any skins we need then swap in the interface
- mw.load( playerDependencyRequest, function() {
- var waitForMeta = true;
-
+ mw.load( playerDependencyRequest, function() {
+ var waitForMeta = true;
// Be sure to "stop" the target ( sometimes firefox
keeps playing the video even
// though its been removed from the DOM )
if( playerElement.pause ){
@@ -498,7 +497,7 @@
playerElement.removeEventListener(
"loadedmetadata", runPlayerSwap, true );
playerElement.addEventListener(
"loadedmetadata", runPlayerSwap, true );
- // Time-out of 5 seconds ( maybe still playable
but no timely metadata )
+ // Time-out of 5 seconds ( maybe still playable
but no timely metadata )
setTimeout( runPlayerSwap, 5000 );
return ;
} else {
@@ -1033,7 +1032,6 @@
if ( $j( videoElement ).attr( "src" ) ) {
_this.tryAddSource( videoElement );
}
-
// Process elements source children
$j( videoElement ).find( 'source,track' ).each( function( ) {
_this.tryAddSource( this );
@@ -1128,7 +1126,7 @@
* Selects the default source via cookie preference, default marked, or
by id order
*/
autoSelectSource: function() {
- mw.log( 'EmbedPlayer::mediaElement::autoSelectSource:' +
this.id);
+ mw.log( 'EmbedPlayer::mediaElement::autoSelectSource:' );
// Select the default source
var playableSources = this.getPlayableSources();
var flash_flag = ogg_flag = false;
@@ -1614,7 +1612,7 @@
// Scope the end of check for player sources so it can be
called in a callback
var finishCheckPlayerSources = function(){
// Run embedPlayer sources hook
- mw.runTriggersCallback( _this,
'checkPlayerSourcesEvent', function(){
+ mw.runTriggersCallback( _this,
'checkPlayerSourcesEvent', function(){
_this.checkForTimedText();
})
}
Modified: branches/MwEmbedStandAlone/modules/Playlist/loader.js
===================================================================
--- branches/MwEmbedStandAlone/modules/Playlist/loader.js 2010-08-06
21:10:18 UTC (rev 70596)
+++ branches/MwEmbedStandAlone/modules/Playlist/loader.js 2010-08-06
21:17:18 UTC (rev 70597)
@@ -6,6 +6,7 @@
( function( mw ) {
mw.addResourcePaths( {
+ "iScroll" : "iScroll.js",
"mw.Playlist" : "mw.Playlist.js",
"mw.PlaylistHandlerMediaRss" : "mw.PlaylistHandlerMediaRss.js"
});
@@ -28,8 +29,15 @@
'Playlist.defaultType' : 'application/rss+xml'
} );
- // Module loader ( right now its just a stub for mw.MediaRss )
- mw.addModuleLoader( 'Playlist', [ "mw.Playlist",
"mw.PlaylistHandlerMediaRss" ] );
+ // Module loader
+ mw.addModuleLoader( 'Playlist', function(){
+ var resourceList = ["mw.Playlist", "mw.PlaylistHandlerMediaRss"
]
+ // xxx should detect touch support rather than mobile safari
check
+ if( mw.isMobileSafari() ){
+ resourceList.push( "iScroll" );
+ }
+ return resourceList;
+ });
} )( window.mw );
Modified: branches/MwEmbedStandAlone/modules/Playlist/mw.Playlist.js
===================================================================
--- branches/MwEmbedStandAlone/modules/Playlist/mw.Playlist.js 2010-08-06
21:10:18 UTC (rev 70596)
+++ branches/MwEmbedStandAlone/modules/Playlist/mw.Playlist.js 2010-08-06
21:17:18 UTC (rev 70597)
@@ -79,7 +79,7 @@
this.loadPlaylistHandler( function( playlistHandler ){
mw.log("mw.Playlist::loaded playlist handler");
- // check if load failed or empty playlist
+ // Check if load failed or empty playlist
if( _this.sourceHandler.getClipList().length == 0 ){
$j( _this.target ).empty().text(
gM('mwe-playlist-empty') )
return ;
@@ -94,14 +94,21 @@
.css({
'float' : 'left'
})
- ,
- $j( '<div />')
- .addClass( 'media-rss-video-list' )
+ ,
+ $j( '<div />')
+ .addClass(
'media-rss-video-list-wrapper' )
.css({
- 'float' : 'right',
- 'overflow-y' : 'auto' ,
- 'overflow-x' : 'hidden'
- })
+ 'position' : 'relative',
+ 'z-index' : '1',
+ 'width': '400px',
+ 'height': '300px',
+ 'overflow' : 'auto'
+ })
+ .append(
+ $j( '<div />')
+ .addClass(
'media-rss-video-list' )
+ .attr('id', _this.id +
'_videolist')
+ )
.hide()
);
@@ -113,22 +120,27 @@
// Update the list height ( vertical layout )
if( _this.layout == 'vertical' ){
- var targetListHeight = ( $j(
_this.target ).height() - $j( _this.target + ' .media-rss-video-player'
).height() );
- mw.log( ' targetHeight: ' + $j(
_this.target ).height() + ' - ' + $j( _this.target + '
.media-rss-video-player' ).height() + ' = ' + targetListHeight );
- $j( _this.target + '
.media-rss-video-list' ).css( {
+ var targetListHeight = ( $j(
_this.target ).height() - $j( _this.target + ' .media-rss-video-player'
).height() );
+ $j( _this.target + '
.media-rss-video-list-wrapper' ).css( {
'height' : targetListHeight,
'width' : '100%'
- } ).fadeIn();
+ } )
} else {
var targetListWidth = ( $j(
_this.target ).width() - $j( _this.target + ' .media-rss-video-player'
).width() );
- mw.log( 'targetListWidth:' + $j(
_this.target ).width() + ' - pw: ' + $j( _this.target + '
.media-rss-video-player' ).width() + ' = ' + targetListWidth );
- $j( _this.target + '
.media-rss-video-list').css( {
+ $j( _this.target + '
.media-rss-video-list-wrapper').css( {
'width' : targetListWidth,
'height' : '100%'
- } )
- .fadeIn();
- }
- } );
+ } )
+ }
+ // show the video list and apply the swipe
binding
+ $j( _this.target
).find('.media-rss-video-list-wrapper').fadeIn();
+ if( mw.isMobileSafari() ){
+ document.addEventListener('touchmove',
function(e){ e.preventDefault(); });
+ var myScroll = iScroll( _this.id +
'_videolist' );
+ setTimeout(function () {
myScroll.refresh(); }, 0);
+ }
+
+ });
});
Modified: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerAddMedia.js
===================================================================
--- branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerAddMedia.js
2010-08-06 21:10:18 UTC (rev 70596)
+++ branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerAddMedia.js
2010-08-06 21:17:18 UTC (rev 70597)
@@ -77,7 +77,7 @@
if( ! this.remoteSearchDriver ){
// set the tool target to loading
mw.load( 'AddMedia.addMediaWizard', function(){
- this.remoteSearchDriver = new
mw.RemoteSearchDriver({
+ _this.remoteSearchDriver = new
mw.RemoteSearchDriver({
'target_container' :
_this.sequencer.getEditToolTarget(),
'target_search_input' :
_this.sequencer.getMenuTarget().find('input.searchMedia'),
'displaySearchInput': false,
@@ -95,11 +95,22 @@
});
} else {
this.remoteSearchDriver.createUI()
+ }
+ },
+ /**
+ * Get the resource object from a provided asset
+ */
+ getResourceFromAsset: function( asset ){
+ var _this = this;
+ if( ! $j( asset ).attr('id') ){
+ mw.log( "Error getResourceFromAsset:: missing asset id"
+ $j( asset ).attr('id') );
+ return false;
}
-
- },
+ return _this.remoteSearchDriver.getResourceFromId( $j( asset
).attr('id') );
+ },
+
/**
- * add search results drab binding so they can be dragged into the
sequencer
+ * Add search results drab binding so they can be dragged into the
sequencer
*/
addSearchResultsDrag: function(){
var _this = this;
@@ -107,7 +118,11 @@
this.sequencer.getEditToolTarget()
.find(".rsd_res_item")
.draggable({
- connectToSortable: '#' +
_this.sequencer.getTimeline().getTracksContainer().find('.clipTrackSet').attr('id'),
+ connectToSortable: $j(
_this.sequencer.getTimeline().getTracksContainer().find('.clipTrackSet') ),
+ start: function( event, ui ){
+ // give the target timeline some extra
space:
+
_this.sequencer.getTimeline().expandTrackSetSize();
+ },
helper: function() {
// Append a li to the sortable list
return $j( this )
@@ -118,22 +133,61 @@
})
.get( 0 );
},
- revert: 'invalid'
+ revert: 'invalid'
});
},
-
+ insertAssetDialog: function( assetElement, sequenceTrack, order ){
+ this.insertResourceDialog(
+ this.getResourceFromAsset( assetElement ),
+ sequenceTrack,
+ order
+ );
+ },
/**
* Create an insert resource dialog, expose basic in-out points or /
duration
- *
+ * xxx todo if resource needs to be imported run import dialog from
remoteResourceDrive
* buttons include insert at end or insert after current
*/
- insertResourceDialog: function( resource ){
+ insertResourceDialog: function( resource, sequenceTrack, order ){
var buttons = {};
- // insert after last selected clip ( or at end )
+ var cat = resource;
+ debugger;
+ // Get an xml smil ref pointer: ( per the supplied content type
)
+ var smilRef = this.getSmilRefFromResource( resource );
+
+ // Build out the resource dialog content:
+ var $content =
+ $j('<div />').append(
+ $j('<div />')
+ .addClass( 'sequencerEditTools' )
+ .css({
+ 'width' : '50%',
+ 'height' : '100%',
+ 'overflow': 'auto',
+ 'position' : 'absolute',
+ 'top' : '0px',
+ 'left': '0px'
+ }),
+
+ $j('<div />')
+ .css({
+ 'position' : 'absolute'
+ 'top' : '0px',
+ 'right': '0px',
+ 'width' : '50%',
+ 'height' : '100%'
+ })
+ .append(
+ // the div
+ )
+ )
+ // Build out the edit tools
+ $content.find( '.sequencerEditTools' )
+
+ // Insert after last selected clip ( or at end )
buttons[ gM('mwe-sequencer-insert') ] = function() {
- mw.log("insert resource into sequence");
- var cat = resource;
- debugger;
+ // call a function that inserts into smil and timeline
( getTimeline() )
+ alert(' insert resource')
}
// cancel
buttons[ gM('mwe-cancel') ] = function(){
@@ -144,13 +198,15 @@
'title' : gM('mwe-sequencer-insert-resource'),
'dragable' : true,
'height' : 480,
- 'width' : 640,
+ 'width' : 800,
'resizable' : true,
- 'content' : function(){
- // add the resource on-top and trim
- },
+ 'content' : resourceEdit.getUi()
'buttons' : buttons
});
+ },
+
+ getSmilRefFromResource: function( resource ){
+
}
}
Modified: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerMenu.js
===================================================================
--- branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerMenu.js
2010-08-06 21:10:18 UTC (rev 70596)
+++ branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerMenu.js
2010-08-06 21:17:18 UTC (rev 70597)
@@ -103,11 +103,10 @@
var $menuTarget = this.sequencer.getMenuTarget();
// empty and disable select for menu items
$menuTarget.empty().disableSelection();
-
for( var menuKey in this.menuConfig ){
// Create a function to preserve menuKey binding scope
- function drawTopMenu( menuKey ){
+ function drawTopMenu( menuKey ){
// Add the menu target
$menuTarget
.append(
Modified: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTimeline.js
===================================================================
--- branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTimeline.js
2010-08-06 21:10:18 UTC (rev 70596)
+++ branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTimeline.js
2010-08-06 21:17:18 UTC (rev 70597)
@@ -179,27 +179,32 @@
}
})
},
+
+ getTrackSetId:function( trackIndex ){
+ return this.sequencer.getId() + '_clipTrackSet_' + trackIndex;
+ },
/**
* get and add a clip track set to the dom:
*/
getClipTrackSet: function( trackIndex ){
var _this = this;
- var clipTrackSetId = this.sequencer.getId() + '_clipTrackSet_'
+ trackIndex;
return $j('<ul />')
- .attr('id', clipTrackSetId)
+ .attr('id', this.getTrackSetId( trackIndex ))
+ .data('trackIndex', trackIndex)
.addClass('clipTrackSet ui-corner-all')
// Add "sortable
.sortable({
placeholder: "clipSortTarget timelineClip
ui-corner-all",
opacity: 0.6,
+ tolerance: 'pointer',
cursor: 'move',
helper: function( event, helper ){
// xxxx might need some fixes
for multi-track
var $selected =
_this.getTimelineContainer().find( '.selectedClip' )
if ( $selected.length === 0 ||
$selected.length == 1) {
return $j( helper );
- }
+ }
return $j('<ul />')
.css({
'width' :
(_this.timelineThumbSize.width + 16) * $selected.length
@@ -208,11 +213,32 @@
},
scroll: true,
update: function( event, ui ) {
- // Update the html dom
- //_this.handleReorder( ui.item
);
+ // Check if the movedClip was a
timeline clip ( else generate timeline clip )
+ if( ! $j( ui.item ).hasClass(
'timelineClip' ) ){
+ // likely an asset
dragged from add-media-wizard
+ // ( future would be
cool to support desktop file drag and drop )
+ _this.handleDropAsset(
ui.item );
+ } else {
+ // Update the html dom
+ _this.handleReorder(
ui.item );
+ }
}
})
},
+ // expand the track size by clip length + 1
+ expandTrackSetSize: function ( trackIndex ){
+ var trackClipCount = this.getTimelineContainer().find(
'.clipTrackSet' ).children().length;
+ //mw.log("SequencerTimeline::expandTrackSetSize: " +
this.timelineThumbSize.width + ' tcc: ' + trackClipCount + ' ::' + ( (
this.timelineThumbSize.width + 16) * (trackClipCount + 2) ) );
+ this.getTracksContainer().find('.clipTrackSet').css({
+ 'width' : ( (this.timelineThumbSize.width + 16) *
(trackClipCount + 2 ) ) + 'px'
+ });
+ },
+ restoreTrackSetSize: function ( trackIndex ){
+ var trackClipCount = this.getTimelineContainer().find(
'.clipTrackSet' ).children().length;
+ this.getTracksContainer().find('.clipTrackSet').css({
+ 'width' : ( ( this.timelineThumbSize.width + 16) *
trackClipCount) + 'px'
+ });
+ },
getTimelineClip: function( $clipTrackSet, $node ){
var _this = this;
return $j('<li />')
@@ -232,9 +258,10 @@
editClip: function( selectedClip ){
var smil = this.sequencer.getSmil();
// get the smil element for the edit tool:
- var smilClip = smil.$dom.find('#' + $j( selectedClip
).data('smilId') );
- this.sequencer.getEditTools().drawClipEditTool( smilClip );
- },
+ var smilClip = smil.$dom.find('#' + $j( selectedClip
).data('smilId') );
+ var toolTarget = this.sequencer.getEditToolTarget();
+ this.sequencer.getEditTools().drawClipEditTools( toolTarget,
previewTarget, smilClip );
+ },
/**
* Remove selected clips and update the smil player
@@ -257,11 +284,21 @@
this.sequencer.getActionsEdit().registerEdit();
},
+ /**
+ * handles assets dropped into the timeline
+ */
+ handleDropAsset: function( asset ){
+ // Get the newAsset resource object
+ var clipIndex = $j( asset ).index();
+ var trackIndex = $j( asset ).parent().data('trackIndex);
+ this.sequencer.getAddMedia().insertAssetDialog( asset,
trackIndex, clipIndex );
+ },
+
handleReorder: function ( movedClip ){
var _this = this;
var smil = this.sequencer.getSmil();
- var movedIndex = null;
-
+ var movedIndex = null;
+
var clipIndex = $j( movedClip ).index();
var $movedSmileNode = smil.$dom.find( '#' + $j( movedClip
).data('smilId') );
var $seqParent = $movedSmileNode.parent();
Modified: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTools.js
===================================================================
--- branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTools.js
2010-08-06 21:10:18 UTC (rev 70596)
+++ branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTools.js
2010-08-06 21:17:18 UTC (rev 70597)
@@ -66,7 +66,7 @@
'preview' : {
'icon' : 'play',
'title' : gM('mwe-sequencer-preview'),
- 'action': function( _this, smilClip, toolId){
+ 'action': function( _this, smilClip, toolId ){
_this.sequencer.getPlayer().previewClip(
smilClip );
}
},
@@ -218,9 +218,10 @@
getEditToolId: function( toolId, attributeName){
return 'editTool_' + toolId + '_' + attributeName;
},
- drawClipEditTool: function( smilClip ){
- $target = this.sequencer.getEditToolTarget();
-
+
+
+ drawClipEditTools: function( $target, smilClip){
+
var toolId = '';
// get the toolId based on what "ref type" smilClip is:
switch( this.sequencer.getSmil().getRefType( smilClip ) ){
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs