Index: trunk/extensions/MetavidWiki/skins/mv_embed/libAddMedia/mvFirefogg.js |
— | — | @@ -6,7 +6,8 @@ |
7 | 7 | var default_firefogg_options = { |
8 | 8 | 'upload_done_action':'redirect', |
9 | 9 | 'fogg_enabled':false, |
10 | | - 'api_url':null |
| 10 | + 'api_url':null, |
| 11 | + 'passthrough': false |
11 | 12 | } |
12 | 13 | var mvFirefogg = function(initObj){ |
13 | 14 | return this.init( initObj ); |
— | — | @@ -19,8 +20,12 @@ |
20 | 21 | 'maxSize': 400, |
21 | 22 | 'videoBitrate': 400, |
22 | 23 | 'noUpscaling':true |
23 | | - }, |
24 | | - |
| 24 | + }, |
| 25 | + ogg_extensions: ['ogg', 'ogv', 'oga'], |
| 26 | + video_extensions: ['avi', 'mov', 'mp4', 'mp2', 'mpeg', 'mpeg2', 'mpeg4', 'dv', 'wmv'], |
| 27 | + passthrough_extensions: ['png', 'gif', 'jpg', 'jpeg'], //@@todo allow server to set this |
| 28 | + passthrough: false, |
| 29 | + |
25 | 30 | init: function( iObj ){ |
26 | 31 | if(!iObj) |
27 | 32 | iObj = {}; |
— | — | @@ -123,18 +128,19 @@ |
124 | 129 | if( sf.lastIndexOf('.') != -1){ |
125 | 130 | ext = sf.substring( sf.lastIndexOf('.')+1 ).toLowerCase(); |
126 | 131 | } |
127 | | - //set upload warning |
128 | | - if( ext == 'ogg' || ext == 'ogv' ){ |
| 132 | + //set upload warning |
| 133 | + if( $j.inArray(ext, _this.ogg_extensions) > -1 ){ |
129 | 134 | $j('#wgfogg_waring_ogg_upload').show(); |
130 | 135 | return false; |
131 | | - }else if( ext == 'avi' || ext == 'mov' || ext == 'mp4' || ext=='mp2' || |
132 | | - ext == 'mpeg' || ext == 'mpeg2' || ext == 'mpeg4' || |
133 | | - ext == 'dv' || ext=='wmv' ){ |
| 136 | + }else if( $j.inArray(ext, _this.video_extensions) > -1 ){ |
134 | 137 | //hide ogg warning |
135 | 138 | $j('#wgfogg_waring_ogg_upload').hide(); |
136 | 139 | var extreg = new RegExp(ext + '$', 'i'); |
137 | 140 | sf = sf.replace(extreg, 'ogg'); |
138 | 141 | $j('#wpDestFile').val( sf ); |
| 142 | + }else if( $j.inArray(ext, _this.passthrough_extensions) > -1 ){ |
| 143 | + $j('#wpDestFile').val( sf ); |
| 144 | + _this.passthrough = true; |
139 | 145 | }else{ |
140 | 146 | //not video extension error: |
141 | 147 | $j('#wgfogg_waring_bad_extension').show(); |
— | — | @@ -184,11 +190,10 @@ |
185 | 191 | if( sf.lastIndexOf('.') != -1){ |
186 | 192 | ext = sf.substring( sf.lastIndexOf('.') ).toLowerCase(); |
187 | 193 | } |
188 | | - if ( ext != '.ogg' && ext != '.ogv' ) { |
| 194 | + if(!_this.passthrough && $j.inArray(ext.substr(1), _this.ogg_extensions) == -1 ){ |
189 | 195 | var extreg = new RegExp(ext + '$', 'i'); |
190 | 196 | _this.formData['wpDestFile'] = sf.replace(extreg, '.ogg'); |
191 | 197 | } |
192 | | - |
193 | 198 | //add chunk response hook to build the resultURL when uploading chunks |
194 | 199 | |
195 | 200 | //build the api url: |
— | — | @@ -208,8 +213,11 @@ |
209 | 214 | |
210 | 215 | js_log('do fogg upload call: '+ _this.api_url + ' :: ' + JSON.stringify( aReq ) ); |
211 | 216 | |
212 | | - |
213 | | - _this.fogg.upload( JSON.stringify( _this.encoder_settings ), _this.api_url , JSON.stringify( aReq ) ); |
| 217 | + var enc_settings = _this.encoder_settings; |
| 218 | + if( _this.passthrough ){ |
| 219 | + enc_settings = {'passthrough': true}; |
| 220 | + } |
| 221 | + _this.fogg.upload( JSON.stringify( enc_settings ), _this.api_url , JSON.stringify( aReq ) ); |
214 | 222 | |
215 | 223 | //update upload status: |
216 | 224 | _this.doUploadStatus(); |