Index: branches/MwEmbedStandAlone/modules/Playlist/loader.js |
— | — | @@ -6,6 +6,7 @@ |
7 | 7 | ( function( mw ) { |
8 | 8 | |
9 | 9 | mw.addResourcePaths( { |
| 10 | + "iScroll" : "iScroll.js", |
10 | 11 | "mw.Playlist" : "mw.Playlist.js", |
11 | 12 | "mw.PlaylistHandlerMediaRss" : "mw.PlaylistHandlerMediaRss.js" |
12 | 13 | }); |
— | — | @@ -28,8 +29,15 @@ |
29 | 30 | 'Playlist.defaultType' : 'application/rss+xml' |
30 | 31 | } ); |
31 | 32 | |
32 | | - // Module loader ( right now its just a stub for mw.MediaRss ) |
33 | | - mw.addModuleLoader( 'Playlist', [ "mw.Playlist", "mw.PlaylistHandlerMediaRss" ] ); |
| 33 | + // Module loader |
| 34 | + mw.addModuleLoader( 'Playlist', function(){ |
| 35 | + var resourceList = ["mw.Playlist", "mw.PlaylistHandlerMediaRss" ] |
| 36 | + // xxx should detect touch support rather than mobile safari check |
| 37 | + if( mw.isMobileSafari() ){ |
| 38 | + resourceList.push( "iScroll" ); |
| 39 | + } |
| 40 | + return resourceList; |
| 41 | + }); |
34 | 42 | |
35 | 43 | |
36 | 44 | } )( window.mw ); |
Index: branches/MwEmbedStandAlone/modules/Playlist/mw.Playlist.js |
— | — | @@ -79,7 +79,7 @@ |
80 | 80 | |
81 | 81 | this.loadPlaylistHandler( function( playlistHandler ){ |
82 | 82 | mw.log("mw.Playlist::loaded playlist handler"); |
83 | | - // check if load failed or empty playlist |
| 83 | + // Check if load failed or empty playlist |
84 | 84 | if( _this.sourceHandler.getClipList().length == 0 ){ |
85 | 85 | $j( _this.target ).empty().text( gM('mwe-playlist-empty') ) |
86 | 86 | return ; |
— | — | @@ -94,14 +94,21 @@ |
95 | 95 | .css({ |
96 | 96 | 'float' : 'left' |
97 | 97 | }) |
98 | | - , |
99 | | - $j( '<div />') |
100 | | - .addClass( 'media-rss-video-list' ) |
| 98 | + , |
| 99 | + $j( '<div />') |
| 100 | + .addClass( 'media-rss-video-list-wrapper' ) |
101 | 101 | .css({ |
102 | | - 'float' : 'right', |
103 | | - 'overflow-y' : 'auto' , |
104 | | - 'overflow-x' : 'hidden' |
105 | | - }) |
| 102 | + 'position' : 'relative', |
| 103 | + 'z-index' : '1', |
| 104 | + 'width': '400px', |
| 105 | + 'height': '300px', |
| 106 | + 'overflow' : 'auto' |
| 107 | + }) |
| 108 | + .append( |
| 109 | + $j( '<div />') |
| 110 | + .addClass( 'media-rss-video-list' ) |
| 111 | + .attr('id', _this.id + '_videolist') |
| 112 | + ) |
106 | 113 | .hide() |
107 | 114 | ); |
108 | 115 | |
— | — | @@ -113,22 +120,27 @@ |
114 | 121 | |
115 | 122 | // Update the list height ( vertical layout ) |
116 | 123 | if( _this.layout == 'vertical' ){ |
117 | | - var targetListHeight = ( $j( _this.target ).height() - $j( _this.target + ' .media-rss-video-player' ).height() ); |
118 | | - mw.log( ' targetHeight: ' + $j( _this.target ).height() + ' - ' + $j( _this.target + ' .media-rss-video-player' ).height() + ' = ' + targetListHeight ); |
119 | | - $j( _this.target + ' .media-rss-video-list' ).css( { |
| 124 | + var targetListHeight = ( $j( _this.target ).height() - $j( _this.target + ' .media-rss-video-player' ).height() ); |
| 125 | + $j( _this.target + ' .media-rss-video-list-wrapper' ).css( { |
120 | 126 | 'height' : targetListHeight, |
121 | 127 | 'width' : '100%' |
122 | | - } ).fadeIn(); |
| 128 | + } ) |
123 | 129 | } else { |
124 | 130 | var targetListWidth = ( $j( _this.target ).width() - $j( _this.target + ' .media-rss-video-player' ).width() ); |
125 | | - mw.log( 'targetListWidth:' + $j( _this.target ).width() + ' - pw: ' + $j( _this.target + ' .media-rss-video-player' ).width() + ' = ' + targetListWidth ); |
126 | | - $j( _this.target + ' .media-rss-video-list').css( { |
| 131 | + $j( _this.target + ' .media-rss-video-list-wrapper').css( { |
127 | 132 | 'width' : targetListWidth, |
128 | 133 | 'height' : '100%' |
129 | | - } ) |
130 | | - .fadeIn(); |
131 | | - } |
132 | | - } ); |
| 134 | + } ) |
| 135 | + } |
| 136 | + // show the video list and apply the swipe binding |
| 137 | + $j( _this.target ).find('.media-rss-video-list-wrapper').fadeIn(); |
| 138 | + if( mw.isMobileSafari() ){ |
| 139 | + document.addEventListener('touchmove', function(e){ e.preventDefault(); }); |
| 140 | + var myScroll = iScroll( _this.id + '_videolist' ); |
| 141 | + setTimeout(function () { myScroll.refresh(); }, 0); |
| 142 | + } |
| 143 | + |
| 144 | + }); |
133 | 145 | |
134 | 146 | |
135 | 147 | }); |
Index: branches/MwEmbedStandAlone/modules/EmbedPlayer/loader.js |
— | — | @@ -111,7 +111,7 @@ |
112 | 112 | * mwEmbed player is setup before any other mw.ready calls |
113 | 113 | */ |
114 | 114 | mw.addSetupHook( function( callback ) { |
115 | | - mw.log( 'Document::' + mw.documentHasPlayerTags() ); |
| 115 | + mw.log( 'EmbedPlayer:: Document::' + mw.documentHasPlayerTags() ); |
116 | 116 | if( mw.documentHasPlayerTags() ) { |
117 | 117 | var rewriteElementCount = 0; |
118 | 118 | |
Index: branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayer.js |
— | — | @@ -436,11 +436,10 @@ |
437 | 437 | // Update the list of dependent libraries for the player |
438 | 438 | // ( allows extensions to add to the dependency list ) |
439 | 439 | mw.embedPlayerUpdateLibraryRequest( playerElement, playerDependencyRequest ); |
440 | | - |
| 440 | + |
441 | 441 | // Load any skins we need then swap in the interface |
442 | | - mw.load( playerDependencyRequest, function() { |
443 | | - var waitForMeta = true; |
444 | | - |
| 442 | + mw.load( playerDependencyRequest, function() { |
| 443 | + var waitForMeta = true; |
445 | 444 | // Be sure to "stop" the target ( sometimes firefox keeps playing the video even |
446 | 445 | // though its been removed from the DOM ) |
447 | 446 | if( playerElement.pause ){ |
— | — | @@ -498,7 +497,7 @@ |
499 | 498 | playerElement.removeEventListener( "loadedmetadata", runPlayerSwap, true ); |
500 | 499 | playerElement.addEventListener( "loadedmetadata", runPlayerSwap, true ); |
501 | 500 | |
502 | | - // Time-out of 5 seconds ( maybe still playable but no timely metadata ) |
| 501 | + // Time-out of 5 seconds ( maybe still playable but no timely metadata ) |
503 | 502 | setTimeout( runPlayerSwap, 5000 ); |
504 | 503 | return ; |
505 | 504 | } else { |
— | — | @@ -1033,7 +1032,6 @@ |
1034 | 1033 | if ( $j( videoElement ).attr( "src" ) ) { |
1035 | 1034 | _this.tryAddSource( videoElement ); |
1036 | 1035 | } |
1037 | | - |
1038 | 1036 | // Process elements source children |
1039 | 1037 | $j( videoElement ).find( 'source,track' ).each( function( ) { |
1040 | 1038 | _this.tryAddSource( this ); |
— | — | @@ -1128,7 +1126,7 @@ |
1129 | 1127 | * Selects the default source via cookie preference, default marked, or by id order |
1130 | 1128 | */ |
1131 | 1129 | autoSelectSource: function() { |
1132 | | - mw.log( 'EmbedPlayer::mediaElement::autoSelectSource:' + this.id); |
| 1130 | + mw.log( 'EmbedPlayer::mediaElement::autoSelectSource:' ); |
1133 | 1131 | // Select the default source |
1134 | 1132 | var playableSources = this.getPlayableSources(); |
1135 | 1133 | var flash_flag = ogg_flag = false; |
— | — | @@ -1614,7 +1612,7 @@ |
1615 | 1613 | // Scope the end of check for player sources so it can be called in a callback |
1616 | 1614 | var finishCheckPlayerSources = function(){ |
1617 | 1615 | // Run embedPlayer sources hook |
1618 | | - mw.runTriggersCallback( _this, 'checkPlayerSourcesEvent', function(){ |
| 1616 | + mw.runTriggersCallback( _this, 'checkPlayerSourcesEvent', function(){ |
1619 | 1617 | _this.checkForTimedText(); |
1620 | 1618 | }) |
1621 | 1619 | } |
Index: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerAddMedia.js |
— | — | @@ -77,7 +77,7 @@ |
78 | 78 | if( ! this.remoteSearchDriver ){ |
79 | 79 | // set the tool target to loading |
80 | 80 | mw.load( 'AddMedia.addMediaWizard', function(){ |
81 | | - this.remoteSearchDriver = new mw.RemoteSearchDriver({ |
| 81 | + _this.remoteSearchDriver = new mw.RemoteSearchDriver({ |
82 | 82 | 'target_container' : _this.sequencer.getEditToolTarget(), |
83 | 83 | 'target_search_input' : _this.sequencer.getMenuTarget().find('input.searchMedia'), |
84 | 84 | 'displaySearchInput': false, |
— | — | @@ -95,11 +95,22 @@ |
96 | 96 | }); |
97 | 97 | } else { |
98 | 98 | this.remoteSearchDriver.createUI() |
| 99 | + } |
| 100 | + }, |
| 101 | + /** |
| 102 | + * Get the resource object from a provided asset |
| 103 | + */ |
| 104 | + getResourceFromAsset: function( asset ){ |
| 105 | + var _this = this; |
| 106 | + if( ! $j( asset ).attr('id') ){ |
| 107 | + mw.log( "Error getResourceFromAsset:: missing asset id" + $j( asset ).attr('id') ); |
| 108 | + return false; |
99 | 109 | } |
100 | | - |
101 | | - }, |
| 110 | + return _this.remoteSearchDriver.getResourceFromId( $j( asset ).attr('id') ); |
| 111 | + }, |
| 112 | + |
102 | 113 | /** |
103 | | - * add search results drab binding so they can be dragged into the sequencer |
| 114 | + * Add search results drab binding so they can be dragged into the sequencer |
104 | 115 | */ |
105 | 116 | addSearchResultsDrag: function(){ |
106 | 117 | var _this = this; |
— | — | @@ -107,7 +118,11 @@ |
108 | 119 | this.sequencer.getEditToolTarget() |
109 | 120 | .find(".rsd_res_item") |
110 | 121 | .draggable({ |
111 | | - connectToSortable: '#' + _this.sequencer.getTimeline().getTracksContainer().find('.clipTrackSet').attr('id'), |
| 122 | + connectToSortable: $j( _this.sequencer.getTimeline().getTracksContainer().find('.clipTrackSet') ), |
| 123 | + start: function( event, ui ){ |
| 124 | + // give the target timeline some extra space: |
| 125 | + _this.sequencer.getTimeline().expandTrackSetSize(); |
| 126 | + }, |
112 | 127 | helper: function() { |
113 | 128 | // Append a li to the sortable list |
114 | 129 | return $j( this ) |
— | — | @@ -118,22 +133,61 @@ |
119 | 134 | }) |
120 | 135 | .get( 0 ); |
121 | 136 | }, |
122 | | - revert: 'invalid' |
| 137 | + revert: 'invalid' |
123 | 138 | }); |
124 | 139 | }, |
125 | | - |
| 140 | + insertAssetDialog: function( assetElement, sequenceTrack, order ){ |
| 141 | + this.insertResourceDialog( |
| 142 | + this.getResourceFromAsset( assetElement ), |
| 143 | + sequenceTrack, |
| 144 | + order |
| 145 | + ); |
| 146 | + }, |
126 | 147 | /** |
127 | 148 | * Create an insert resource dialog, expose basic in-out points or / duration |
128 | | - * |
| 149 | + * xxx todo if resource needs to be imported run import dialog from remoteResourceDrive |
129 | 150 | * buttons include insert at end or insert after current |
130 | 151 | */ |
131 | | - insertResourceDialog: function( resource ){ |
| 152 | + insertResourceDialog: function( resource, sequenceTrack, order ){ |
132 | 153 | var buttons = {}; |
133 | | - // insert after last selected clip ( or at end ) |
| 154 | + var cat = resource; |
| 155 | + debugger; |
| 156 | + // Get an xml smil ref pointer: ( per the supplied content type ) |
| 157 | + var smilRef = this.getSmilRefFromResource( resource ); |
| 158 | + |
| 159 | + // Build out the resource dialog content: |
| 160 | + var $content = |
| 161 | + $j('<div />').append( |
| 162 | + $j('<div />') |
| 163 | + .addClass( 'sequencerEditTools' ) |
| 164 | + .css({ |
| 165 | + 'width' : '50%', |
| 166 | + 'height' : '100%', |
| 167 | + 'overflow': 'auto', |
| 168 | + 'position' : 'absolute', |
| 169 | + 'top' : '0px', |
| 170 | + 'left': '0px' |
| 171 | + }), |
| 172 | + |
| 173 | + $j('<div />') |
| 174 | + .css({ |
| 175 | + 'position' : 'absolute' |
| 176 | + 'top' : '0px', |
| 177 | + 'right': '0px', |
| 178 | + 'width' : '50%', |
| 179 | + 'height' : '100%' |
| 180 | + }) |
| 181 | + .append( |
| 182 | + // the div |
| 183 | + ) |
| 184 | + ) |
| 185 | + // Build out the edit tools |
| 186 | + $content.find( '.sequencerEditTools' ) |
| 187 | + |
| 188 | + // Insert after last selected clip ( or at end ) |
134 | 189 | buttons[ gM('mwe-sequencer-insert') ] = function() { |
135 | | - mw.log("insert resource into sequence"); |
136 | | - var cat = resource; |
137 | | - debugger; |
| 190 | + // call a function that inserts into smil and timeline ( getTimeline() ) |
| 191 | + alert(' insert resource') |
138 | 192 | } |
139 | 193 | // cancel |
140 | 194 | buttons[ gM('mwe-cancel') ] = function(){ |
— | — | @@ -144,13 +198,15 @@ |
145 | 199 | 'title' : gM('mwe-sequencer-insert-resource'), |
146 | 200 | 'dragable' : true, |
147 | 201 | 'height' : 480, |
148 | | - 'width' : 640, |
| 202 | + 'width' : 800, |
149 | 203 | 'resizable' : true, |
150 | | - 'content' : function(){ |
151 | | - // add the resource on-top and trim |
152 | | - }, |
| 204 | + 'content' : resourceEdit.getUi() |
153 | 205 | 'buttons' : buttons |
154 | 206 | }); |
| 207 | + }, |
| 208 | + |
| 209 | + getSmilRefFromResource: function( resource ){ |
| 210 | + |
155 | 211 | } |
156 | 212 | } |
157 | 213 | |
Index: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTools.js |
— | — | @@ -66,7 +66,7 @@ |
67 | 67 | 'preview' : { |
68 | 68 | 'icon' : 'play', |
69 | 69 | 'title' : gM('mwe-sequencer-preview'), |
70 | | - 'action': function( _this, smilClip, toolId){ |
| 70 | + 'action': function( _this, smilClip, toolId ){ |
71 | 71 | _this.sequencer.getPlayer().previewClip( smilClip ); |
72 | 72 | } |
73 | 73 | }, |
— | — | @@ -218,9 +218,10 @@ |
219 | 219 | getEditToolId: function( toolId, attributeName){ |
220 | 220 | return 'editTool_' + toolId + '_' + attributeName; |
221 | 221 | }, |
222 | | - drawClipEditTool: function( smilClip ){ |
223 | | - $target = this.sequencer.getEditToolTarget(); |
224 | | - |
| 222 | + |
| 223 | + |
| 224 | + drawClipEditTools: function( $target, smilClip){ |
| 225 | + |
225 | 226 | var toolId = ''; |
226 | 227 | // get the toolId based on what "ref type" smilClip is: |
227 | 228 | switch( this.sequencer.getSmil().getRefType( smilClip ) ){ |
Index: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerMenu.js |
— | — | @@ -103,11 +103,10 @@ |
104 | 104 | var $menuTarget = this.sequencer.getMenuTarget(); |
105 | 105 | // empty and disable select for menu items |
106 | 106 | $menuTarget.empty().disableSelection(); |
107 | | - |
108 | 107 | |
109 | 108 | for( var menuKey in this.menuConfig ){ |
110 | 109 | // Create a function to preserve menuKey binding scope |
111 | | - function drawTopMenu( menuKey ){ |
| 110 | + function drawTopMenu( menuKey ){ |
112 | 111 | // Add the menu target |
113 | 112 | $menuTarget |
114 | 113 | .append( |
Index: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTimeline.js |
— | — | @@ -179,27 +179,32 @@ |
180 | 180 | } |
181 | 181 | }) |
182 | 182 | }, |
| 183 | + |
| 184 | + getTrackSetId:function( trackIndex ){ |
| 185 | + return this.sequencer.getId() + '_clipTrackSet_' + trackIndex; |
| 186 | + }, |
183 | 187 | /** |
184 | 188 | * get and add a clip track set to the dom: |
185 | 189 | */ |
186 | 190 | getClipTrackSet: function( trackIndex ){ |
187 | 191 | var _this = this; |
188 | | - var clipTrackSetId = this.sequencer.getId() + '_clipTrackSet_' + trackIndex; |
189 | 192 | |
190 | 193 | return $j('<ul />') |
191 | | - .attr('id', clipTrackSetId) |
| 194 | + .attr('id', this.getTrackSetId( trackIndex )) |
| 195 | + .data('trackIndex', trackIndex) |
192 | 196 | .addClass('clipTrackSet ui-corner-all') |
193 | 197 | // Add "sortable |
194 | 198 | .sortable({ |
195 | 199 | placeholder: "clipSortTarget timelineClip ui-corner-all", |
196 | 200 | opacity: 0.6, |
| 201 | + tolerance: 'pointer', |
197 | 202 | cursor: 'move', |
198 | 203 | helper: function( event, helper ){ |
199 | 204 | // xxxx might need some fixes for multi-track |
200 | 205 | var $selected = _this.getTimelineContainer().find( '.selectedClip' ) |
201 | 206 | if ( $selected.length === 0 || $selected.length == 1) { |
202 | 207 | return $j( helper ); |
203 | | - } |
| 208 | + } |
204 | 209 | return $j('<ul />') |
205 | 210 | .css({ |
206 | 211 | 'width' : (_this.timelineThumbSize.width + 16) * $selected.length |
— | — | @@ -208,11 +213,32 @@ |
209 | 214 | }, |
210 | 215 | scroll: true, |
211 | 216 | update: function( event, ui ) { |
212 | | - // Update the html dom |
213 | | - //_this.handleReorder( ui.item ); |
| 217 | + // Check if the movedClip was a timeline clip ( else generate timeline clip ) |
| 218 | + if( ! $j( ui.item ).hasClass( 'timelineClip' ) ){ |
| 219 | + // likely an asset dragged from add-media-wizard |
| 220 | + // ( future would be cool to support desktop file drag and drop ) |
| 221 | + _this.handleDropAsset( ui.item ); |
| 222 | + } else { |
| 223 | + // Update the html dom |
| 224 | + _this.handleReorder( ui.item ); |
| 225 | + } |
214 | 226 | } |
215 | 227 | }) |
216 | 228 | }, |
| 229 | + // expand the track size by clip length + 1 |
| 230 | + expandTrackSetSize: function ( trackIndex ){ |
| 231 | + var trackClipCount = this.getTimelineContainer().find( '.clipTrackSet' ).children().length; |
| 232 | + //mw.log("SequencerTimeline::expandTrackSetSize: " + this.timelineThumbSize.width + ' tcc: ' + trackClipCount + ' ::' + ( ( this.timelineThumbSize.width + 16) * (trackClipCount + 2) ) ); |
| 233 | + this.getTracksContainer().find('.clipTrackSet').css({ |
| 234 | + 'width' : ( (this.timelineThumbSize.width + 16) * (trackClipCount + 2 ) ) + 'px' |
| 235 | + }); |
| 236 | + }, |
| 237 | + restoreTrackSetSize: function ( trackIndex ){ |
| 238 | + var trackClipCount = this.getTimelineContainer().find( '.clipTrackSet' ).children().length; |
| 239 | + this.getTracksContainer().find('.clipTrackSet').css({ |
| 240 | + 'width' : ( ( this.timelineThumbSize.width + 16) * trackClipCount) + 'px' |
| 241 | + }); |
| 242 | + }, |
217 | 243 | getTimelineClip: function( $clipTrackSet, $node ){ |
218 | 244 | var _this = this; |
219 | 245 | return $j('<li />') |
— | — | @@ -232,9 +258,10 @@ |
233 | 259 | editClip: function( selectedClip ){ |
234 | 260 | var smil = this.sequencer.getSmil(); |
235 | 261 | // get the smil element for the edit tool: |
236 | | - var smilClip = smil.$dom.find('#' + $j( selectedClip ).data('smilId') ); |
237 | | - this.sequencer.getEditTools().drawClipEditTool( smilClip ); |
238 | | - }, |
| 262 | + var smilClip = smil.$dom.find('#' + $j( selectedClip ).data('smilId') ); |
| 263 | + var toolTarget = this.sequencer.getEditToolTarget(); |
| 264 | + this.sequencer.getEditTools().drawClipEditTools( toolTarget, previewTarget, smilClip ); |
| 265 | + }, |
239 | 266 | |
240 | 267 | /** |
241 | 268 | * Remove selected clips and update the smil player |
— | — | @@ -257,11 +284,21 @@ |
258 | 285 | this.sequencer.getActionsEdit().registerEdit(); |
259 | 286 | }, |
260 | 287 | |
| 288 | + /** |
| 289 | + * handles assets dropped into the timeline |
| 290 | + */ |
| 291 | + handleDropAsset: function( asset ){ |
| 292 | + // Get the newAsset resource object |
| 293 | + var clipIndex = $j( asset ).index(); |
| 294 | + var trackIndex = $j( asset ).parent().data('trackIndex); |
| 295 | + this.sequencer.getAddMedia().insertAssetDialog( asset, trackIndex, clipIndex ); |
| 296 | + }, |
| 297 | + |
261 | 298 | handleReorder: function ( movedClip ){ |
262 | 299 | var _this = this; |
263 | 300 | var smil = this.sequencer.getSmil(); |
264 | | - var movedIndex = null; |
265 | | - |
| 301 | + var movedIndex = null; |
| 302 | + |
266 | 303 | var clipIndex = $j( movedClip ).index(); |
267 | 304 | var $movedSmileNode = smil.$dom.find( '#' + $j( movedClip ).data('smilId') ); |
268 | 305 | var $seqParent = $movedSmileNode.parent(); |