Index: branches/MwEmbedStandAlone/modules/EmbedPlayer/skins/mw.PlayerControlBuilder.js |
— | — | @@ -649,7 +649,10 @@ |
650 | 650 | if( this.embedPlayer.getPlayerHeight() == 0 ){ |
651 | 651 | return false; |
652 | 652 | } |
653 | | - // Past alll tests OverlayControls is true: |
| 653 | + if( this.embedPlayer.controls === false ){ |
| 654 | + return false; |
| 655 | + } |
| 656 | + // Past all tests OverlayControls is true: |
654 | 657 | return true; |
655 | 658 | }, |
656 | 659 | |
Index: branches/MwEmbedStandAlone/modules/Sequencer/mw.FirefoggRender.js |
— | — | @@ -6,7 +6,7 @@ |
7 | 7 | * Set the jQuery bindings: |
8 | 8 | */ |
9 | 9 | ( function( $ ) { |
10 | | - $.fn.firefoggRender = function( options, callback ) { |
| 10 | + $.fn.firefoggRender = function( options ) { |
11 | 11 | if(!options) |
12 | 12 | options = {}; |
13 | 13 | options.playerTarget = this.selector; |
— | — | @@ -39,7 +39,13 @@ |
40 | 40 | |
41 | 41 | // Start time for rendering |
42 | 42 | startTime: 0, |
43 | | - |
| 43 | + |
| 44 | + // Callback for when the render with a pointer to the firefogg object |
| 45 | + doneRenderCallback: null, |
| 46 | + |
| 47 | + // Bollean attribute if we should save to local file |
| 48 | + saveToLocalFile : true, |
| 49 | + |
44 | 50 | // Constructor |
45 | 51 | init:function( options ) { |
46 | 52 | var _this = this; |
— | — | @@ -73,13 +79,19 @@ |
74 | 80 | this.statusTarget = options ['statusTarget']; |
75 | 81 | } |
76 | 82 | |
| 83 | + if( options [ 'doneRenderCallback' ] ){ |
| 84 | + this.doneRenderCallback = options [ 'doneRenderCallback' ]; |
| 85 | + } |
| 86 | + |
| 87 | + if( options['saveToLocalFile'] ){ |
| 88 | + this.saveToLocalFile = options['saveToLocalFile'] ; |
| 89 | + } |
77 | 90 | // If no height width provided use target DOM width/height |
78 | 91 | if( !this.renderOptions.width && !this.renderOptions.height ) { |
79 | 92 | this.renderOptions.width = $j(this.playerTarget).width(); |
80 | 93 | this.renderOptions.height = $j(this.playerTarget).height(); |
81 | 94 | } |
82 | 95 | |
83 | | - |
84 | 96 | }, |
85 | 97 | getPlayer: function(){ |
86 | 98 | return $j( this.playerTarget ).get( 0 ); |
— | — | @@ -87,9 +99,11 @@ |
88 | 100 | // Start rendering |
89 | 101 | doRender: function() { |
90 | 102 | var _this = this; |
91 | | - // Make sure we get a target destination |
92 | | - if( !_this.fogg.saveVideoAs() ){ |
93 | | - return false; |
| 103 | + // Check if we save the file to disk: |
| 104 | + if( this.saveToLocalFile ){ |
| 105 | + if( !_this.fogg.saveVideoAs() ){ |
| 106 | + return false; |
| 107 | + } |
94 | 108 | } |
95 | 109 | // Set the render time to "startTime" of the render request |
96 | 110 | this.renderTime = this.startTime; |
— | — | @@ -148,7 +162,7 @@ |
149 | 163 | _this.doFinalRender(); |
150 | 164 | } else { |
151 | 165 | // Don't block on render requests |
152 | | - setTimeout(function(){ |
| 166 | + setTimeout( function(){ |
153 | 167 | _this.doNextFrame(); |
154 | 168 | },1 ) |
155 | 169 | } |
— | — | @@ -165,23 +179,32 @@ |
166 | 180 | /** |
167 | 181 | * Issue the call to firefogg to render out the ogg video |
168 | 182 | */ |
169 | | - doFinalRender: function() { |
| 183 | + doFinalRender: function() { |
170 | 184 | mw.log("FirefoggRender:: doFinalRenderr" ); |
171 | 185 | this.fogg.render(); |
172 | | - this.updateStatus(); |
| 186 | + this.checkRenderStatus(); |
173 | 187 | }, |
174 | 188 | |
175 | 189 | /** |
176 | 190 | * Update the render status |
177 | 191 | */ |
178 | | - updateStatus: function() { |
179 | | - var _this = this; |
| 192 | + checkRenderStatus: function() { |
| 193 | + var _this = this; |
| 194 | + // Check if we are still rendering |
180 | 195 | var rstatus = _this.fogg.renderstatus(); |
181 | | - $j( _this.statusTarget ).text( rstatus ); |
| 196 | + $j( _this.statusTarget ).text( rstatus ); |
182 | 197 | if ( rstatus != 'done' && rstatus != 'rendering failed' ) { |
183 | 198 | setTimeout( function() { |
184 | | - _this.updateStatus(); |
| 199 | + _this.checkRenderStatus(); |
185 | 200 | }, 100 ); |
| 201 | + return ; |
186 | 202 | } |
| 203 | + if( rstatus == 'rendering failed' ){ |
| 204 | + mw.log("Error: rendering failed"); |
| 205 | + return ; |
| 206 | + } |
| 207 | + if( this.doneRenderCallback ){ |
| 208 | + this.doneRenderCallback( this ) |
| 209 | + } |
187 | 210 | } |
188 | 211 | } |
\ No newline at end of file |
Index: branches/MwEmbedStandAlone/modules/Sequencer/mw.Sequencer.js |
— | — | @@ -162,13 +162,13 @@ |
163 | 163 | */ |
164 | 164 | getSmilSource: function( callback ){ |
165 | 165 | var _this = this; |
166 | | - if( !this.smilSource ){ |
167 | | - if( this.getOption( 'newSequence' ) ){ |
168 | | - this.smilSource = this.getDataUrl( this.getNewSmilXML() ); |
| 166 | + if( !_this.smilSource ){ |
| 167 | + if( _this.getOption( 'newSequence' ) ){ |
| 168 | + _this.smilSource = _this.getDataUrl( _this.getNewSmilXML() ); |
169 | 169 | } else { |
170 | 170 | mw.log("Load smil source from server") |
171 | 171 | // Try to load from the server |
172 | | - this.getServer().getSmilXml(function( smilXml ){ |
| 172 | + _this.getServer().getSmilXml(function( smilXml ){ |
173 | 173 | _this.smilSource = _this.getDataUrl( smilXml ); |
174 | 174 | callback( _this.smilSource ) |
175 | 175 | }) |
— | — | @@ -177,9 +177,12 @@ |
178 | 178 | } |
179 | 179 | } |
180 | 180 | // return the smilSource |
181 | | - callback( this.smilSource ) |
| 181 | + callback( _this.smilSource ) |
182 | 182 | }, |
183 | 183 | getDataUrl: function( xmlString ){ |
| 184 | + if( ! xmlString ){ |
| 185 | + xmlString = this.getSmil().getXMLString(); |
| 186 | + } |
184 | 187 | return 'data:text/xml;charset=utf-8,' + escape( xmlString ); |
185 | 188 | }, |
186 | 189 | getNewSmilXML: function( ){ |
Index: branches/MwEmbedStandAlone/modules/Sequencer/Sequencer.i18n.php |
— | — | @@ -77,6 +77,8 @@ |
78 | 78 | 'mwe-sequencer-published-out-of-date' =>'This published sequence is not the most recent version. You can <b>[$1 review and publish]</b> the most recent version.', |
79 | 79 | |
80 | 80 | 'mwe-sequencer-loading-publish-render' => 'Loading publisher...', |
| 81 | + 'mwe-sequencer-running-publish' => 'Publishing sequence, please wait...', |
| 82 | + 'mwe-sequencer-publishing-status' => 'Publish status:', |
81 | 83 | |
82 | 84 | 'mwe-sequencer-transition_in' => 'Transition in', |
83 | 85 | 'mwe-sequencer-transition_out' => 'Transition out', |
Index: branches/MwEmbedStandAlone/modules/Sequencer/actions/mw.SequencerActionsSequence.js |
— | — | @@ -85,15 +85,17 @@ |
86 | 86 | }, |
87 | 87 | /** |
88 | 88 | * Display the publish dialog |
89 | | - * ( confim the user has firefogg and rights to save a new version of the file ) |
| 89 | + * ( confirm the user has firefogg and rights to save a new version of the file ) |
90 | 90 | */ |
91 | 91 | publish: function(){ |
| 92 | + var _this = this; |
92 | 93 | // add a loading dialog |
93 | 94 | var $dialog = mw.addDialog({ |
94 | 95 | 'resizable':'true', |
95 | 96 | 'title' : gM('mwe-sequencer-loading-publish-render'), |
96 | 97 | 'content' : gM('mwe-sequencer-loading-publish-render'), |
97 | | - 'width' : 450 |
| 98 | + 'width' : 450, |
| 99 | + 'height' : 400 |
98 | 100 | }); |
99 | 101 | $dialog.append( $j('<div />').loadingSpinner() ); |
100 | 102 | // Grab the firefogg render |
— | — | @@ -103,25 +105,71 @@ |
104 | 106 | 'only_fogg':true |
105 | 107 | }); |
106 | 108 | if ( !myFogg.getFirefogg() ) { |
107 | | - $dialog.empty().append( $j('<div />').attr('id', 'show_install_firefogg') ); |
| 109 | + $dialog.empty().append( |
| 110 | + $j('<div />').attr('id', 'show_install_firefogg') |
| 111 | + ); |
108 | 112 | myFogg.showInstallFirefog( '#show_install_firefogg' ); |
109 | 113 | return ; |
110 | 114 | } |
111 | | - |
| 115 | + |
112 | 116 | // Build a data-url of the current sequence: |
113 | | - $j( '<div />' ).attr('id', 'publishVideoTarget'); |
| 117 | + $dialog.dialog( "option", "title", gM('mwe-sequencer-running-publish') ); |
114 | 118 | |
115 | | - // Start up the render |
116 | | - var foggRender = $j('#videoCrossfade').firefoggRender({ |
117 | | - 'statusTarget': '#targetFoggStatus' |
118 | | - }); |
119 | | - /* |
120 | | - foggRender.doRender(); |
121 | | - |
122 | | - $j('#renderToFile').text('Stop Render').click(function(){ |
123 | | - foggRender.stopRender(); |
124 | | - }); |
125 | | - */ |
| 119 | + $dialog.empty().append( |
| 120 | + $j( '<video />' ) |
| 121 | + .attr({ |
| 122 | + 'id': 'publishVideoTarget', |
| 123 | + 'src' : _this.sequencer.getDataUrl(), |
| 124 | + 'type' : 'application/smil' |
| 125 | + }) |
| 126 | + .css({ |
| 127 | + 'width' : '400px', |
| 128 | + 'height' : '300px' |
| 129 | + }) |
| 130 | + , |
| 131 | + $j('<div />' ) |
| 132 | + .css( 'clear', 'both' ), |
| 133 | + $j('<span />' ).text( gM( 'mwe-sequencer-publishing-status') ), |
| 134 | + $j('<span />' ).attr( 'id', 'firefoggStatusTarget' ), |
| 135 | + $j('<span />') |
| 136 | + .css('float', 'right') |
| 137 | + .text("%") |
| 138 | + ); |
| 139 | + |
| 140 | + // Embed the player and continue application flow |
| 141 | + $j('#publishVideoTarget').embedPlayer({ |
| 142 | + 'controls' : false |
| 143 | + }, function(){ |
| 144 | + // this should be depreciated ( hidden interface bug in mwEmbed ) |
| 145 | + $j('#publishVideoTarget').parent().show(); |
| 146 | + // Start up the render |
| 147 | + var foggRender = $j('#publishVideoTarget').firefoggRender({ |
| 148 | + 'statusTarget' : '#firefoggStatusTarget', |
| 149 | + 'saveToLocalFile' : false, |
| 150 | + 'doneRenderCallback': function( fogg ){ |
| 151 | + _this.uploadRenderedVideo( $dialog, fogg ); |
| 152 | + } |
| 153 | + }); |
| 154 | + var buttons = {}; |
| 155 | + buttons[ gM('mwe-cancel') ] = function(){ |
| 156 | + foggRender.stopRender(); |
| 157 | + $j( this ).dialog( 'close' ); |
| 158 | + } |
| 159 | + // Add cancel button |
| 160 | + $dialog.dialog( "option", "buttons", buttons ); |
| 161 | + foggRender.doRender(); |
| 162 | + }); |
126 | 163 | }); |
| 164 | + }, |
| 165 | + // Upload the video from a supplied fogg target |
| 166 | + // note xx this might be better handlded in a firefogg library |
| 167 | + // @param {jQuery Object } $dialog |
| 168 | + // @param {firefogg Object} |
| 169 | + uploadRenderedVideo: function( $dialog, fogg ){ |
| 170 | + var uploadStatus = function(){ |
| 171 | + } |
| 172 | + this.sequencer.getServer().getVideoUploadSettings( function( url, request ){ |
| 173 | + fogg.post( url, 'file', request ) |
| 174 | + }) |
127 | 175 | } |
128 | 176 | } |
\ No newline at end of file |
Index: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerServer.js |
— | — | @@ -33,6 +33,8 @@ |
34 | 34 | this.apiUrl = serverConfig.url; |
35 | 35 | if( serverConfig.titleKey ) |
36 | 36 | this.titleKey = serverConfig.titleKey; |
| 37 | + } else { |
| 38 | + mw.log("Error: Sequencer server needs a serverConfig to be initialized") |
37 | 39 | } |
38 | 40 | }, |
39 | 41 | |
— | — | @@ -91,6 +93,19 @@ |
92 | 94 | } |
93 | 95 | }) |
94 | 96 | }) |
| 97 | + }, |
| 98 | + |
| 99 | + /** |
| 100 | + * @return {String} |
| 101 | + */ |
| 102 | + getVideoTitleKey: function(){ |
| 103 | + return 'File:' + this.titleKey.replace( ':', '-'); |
| 104 | + }, |
| 105 | + |
| 106 | + // get upload settings runs the callback with the post url and request data |
| 107 | + getVideoUploadSettings: function( callback ){ |
| 108 | + var _this = this; |
| 109 | + mw.getToken( this.apiUrl, this.getVideoTitleKey, function( saveToken ){ |
95 | 110 | } |
96 | 111 | } |
97 | 112 | |
Index: branches/MwEmbedStandAlone/libraries/jquery/plugins/jquery.menu/jquery.menu.js |
— | — | @@ -328,7 +328,7 @@ |
329 | 329 | } |
330 | 330 | }, |
331 | 331 | function() { |
332 | | - if( !menuitem.hasClass('divider') && !menuitem.hasClass('disabled') ){ |
| 332 | + if( menuitem && !menuitem.hasClass('divider') && !menuitem.hasClass('disabled') ){ |
333 | 333 | $(this).removeClass(options.linkHover).blur().parent().removeClass('active-menuitem'); |
334 | 334 | } |
335 | 335 | } |