Index: trunk/extensions/AddMediaWizard/AddMedia/loader.js |
— | — | @@ -65,7 +65,7 @@ |
66 | 66 | ] |
67 | 67 | ] ); |
68 | 68 | |
69 | | - //Set a variable for the base upload interface for easy inclution |
| 69 | + //Set a variable for the base upload interface for easy inclusion |
70 | 70 | var baseUploadlibs = [ |
71 | 71 | [ |
72 | 72 | 'mw.UploadHandler', |
Index: trunk/extensions/AddMediaWizard/AddMedia/mw.Firefogg.js |
— | — | @@ -24,7 +24,8 @@ |
25 | 25 | "fogg-badtoken" : "Token is not valid", |
26 | 26 | "fogg-preview" : "Preview video", |
27 | 27 | "fogg-hidepreview" : "Hide preview", |
28 | | - "fogg-warning-firebug" : "<b>Firebug</b> can cause conflicts with <i>Firefogg</i>. Please disable <b>Firebug</b> for this page." |
| 28 | + "fogg-warning-firebug" : "<b>Firebug</b> can cause conflicts with <i>Firefogg</i>. Please disable <b>Firebug</b> for this page.", |
| 29 | + "fogg-missing-webm-support" : "Please use a [$1 webm compatible] browsers to preview results of webm videos" |
29 | 30 | }); |
30 | 31 | |
31 | 32 | var firefogg_install_links = { |
— | — | @@ -100,7 +101,7 @@ |
101 | 102 | * NOTE: we should have the firefogg binding work the same way as |
102 | 103 | * the upload form binding. |
103 | 104 | */ |
104 | | -( function( $ ) { |
| 105 | +( function( $ ) { |
105 | 106 | $.fn.firefogg = function( options ) { |
106 | 107 | if ( !options ){ |
107 | 108 | options = { }; |
— | — | @@ -123,14 +124,14 @@ |
124 | 125 | } )( jQuery ); |
125 | 126 | |
126 | 127 | |
127 | | -mw.Firefogg = function( options ) { |
| 128 | +mw.Firefogg = function( options ) { |
128 | 129 | return this.init( options ); |
129 | 130 | }; |
130 | 131 | mw.Firefogg.prototype = { // extends mw.BaseUploadHandler |
131 | | - // Minnium version of firefogg allowed |
132 | | - min_firefogg_version: '1.1.0', |
| 132 | + // Minimum version of firefogg allowed |
| 133 | + min_firefogg_version: '1.2.06', |
133 | 134 | |
134 | | - // The default encoder seetings |
| 135 | + // The default encoder settings |
135 | 136 | // NOTE: should be mw.getConfig based |
136 | 137 | default_encoder_settings: { |
137 | 138 | 'maxSize' : '400', |
— | — | @@ -139,13 +140,13 @@ |
140 | 141 | 'noUpscaling' : true |
141 | 142 | }, |
142 | 143 | |
143 | | - // Lazy initialised, use getFirefogg() |
| 144 | + // Lazy initialized, use getFirefogg() |
144 | 145 | have_firefogg: null, |
145 | 146 | |
146 | | - // Lazy initialised, use getEncoderSettings() |
| 147 | + // Lazy initialized, use getEncoderSettings() |
147 | 148 | current_encoder_settings: null, |
148 | 149 | |
149 | | - // Lazy initialised, use getSourceFileInfo() |
| 150 | + // Lazy initialized, use getSourceFileInfo() |
150 | 151 | sourceFileInfo: null, |
151 | 152 | |
152 | 153 | // Valid ogg extensions |
— | — | @@ -350,9 +351,9 @@ |
351 | 352 | gM( 'fogg-for_improved_uploads' ) + ' ' : gM( 'fogg-not-installed') + ' '; |
352 | 353 | |
353 | 354 | // Show the "use latest Firefox" message if necessary |
354 | | - mw.log( 'bv: ' + mw.versionIsAtLeast( '1.9.1', $j.browser.version ) ); |
| 355 | + mw.log( 'mw.Firefogg:: browser: ' + mw.versionIsAtLeast( '1.9.1', $j.browser.version ) ); |
355 | 356 | if ( !( $j.browser.mozilla && mw.versionIsAtLeast( '1.9.1', $j.browser.version ) ) ) { |
356 | | - mw.log( 'show use latest::' + _this.target_use_latest_firefox ); |
| 357 | + mw.log( 'mw.Firefogg::show use latest::' + _this.target_use_latest_firefox ); |
357 | 358 | |
358 | 359 | // Add the use_latest if not present: |
359 | 360 | if ( !this.target_use_latest_firefox ) { |
— | — | @@ -384,7 +385,8 @@ |
385 | 386 | $j( _this.target_use_latest_firefox ).show(); |
386 | 387 | return ; |
387 | 388 | } |
388 | | - mw.log( 'should show install link'); |
| 389 | + mw.log( 'mw.Firefogg::should show install link'); |
| 390 | + |
389 | 391 | // Otherwise show the "install Firefogg" message |
390 | 392 | var firefoggUrl = _this.getFirefoggInstallUrl(); |
391 | 393 | if( firefoggUrl ) { |
— | — | @@ -822,42 +824,60 @@ |
823 | 825 | * This is called when a local encode operation has completed. It updates the UI. |
824 | 826 | */ |
825 | 827 | onLocalEncodeDone: function() { |
826 | | - var _this = this; |
| 828 | + var _this = this; |
| 829 | + var videoEmbedCode = '<video controls="true" style="margin:auto" id="fogg_final_vid" '+ |
| 830 | + 'src="' +_this.fogg.previewUrl + '"></video>'; |
| 831 | + |
| 832 | + if( this.current_encoder_settings['videoCodec'] == 'vp8' ) { |
| 833 | + var dummyvid = document.createElement( "video" ); |
| 834 | + if( !dummyvid.canPlayType('video/webm; codecs="vp8, vorbis"') ) { |
| 835 | + videoEmbedCode = gM('fogg-missing-webm-support', |
| 836 | + $j('<a />') |
| 837 | + .attr({ |
| 838 | + 'href' : 'http://www.webmproject.org/users/', |
| 839 | + 'target' : '_new' |
| 840 | + }) |
| 841 | + ) |
| 842 | + } |
| 843 | + } |
827 | 844 | _this.ui.setPrompt( gM( 'fogg-encoding-done' ), |
828 | | - gM( 'fogg-encoding-done' ) + '<br>' + |
829 | | - // Show the video at full resolution upto 720px wide |
830 | | - '<video controls="true" style="margin:auto" id="fogg_final_vid" '+ |
831 | | - 'src="' +_this.fogg.previewUrl + '"></video>' |
| 845 | + $j( '<div />' ).append( |
| 846 | + gM( 'fogg-encoding-done' ), |
| 847 | + $j('<br>' ), |
| 848 | + videoEmbedCode |
| 849 | + ) |
832 | 850 | ); |
833 | 851 | //Load the video and set a callback: |
834 | 852 | var v = $j( '#fogg_final_vid' ).get( 0 ); |
835 | | - function resizeVid() { |
836 | | - var v = $j( '#fogg_final_vid' ).get(0); |
837 | | - if ( v.videoWidth > 720 ) { |
838 | | - var vW = 720; |
839 | | - var vH = 720 * v.videoHeight / v.videoWidth; |
840 | | - } else { |
841 | | - var vW = v.videoWidth; |
842 | | - var vH = v.videoHeight; |
| 853 | + if( v ) { |
| 854 | + function resizeVid() { |
| 855 | + var v = $j( '#fogg_final_vid' ).get(0); |
| 856 | + if ( v.videoWidth > 720 ) { |
| 857 | + var vW = 720; |
| 858 | + var vH = 720 * v.videoHeight / v.videoWidth; |
| 859 | + } else { |
| 860 | + var vW = v.videoWidth; |
| 861 | + var vH = v.videoHeight; |
| 862 | + } |
| 863 | + //reize the video: |
| 864 | + $j( v ).css({ |
| 865 | + 'width': vW, |
| 866 | + 'height': vH |
| 867 | + }); |
| 868 | + //if large video resize the dialog box: |
| 869 | + if( vW + 5 > 400 ) { |
| 870 | + //also resize the dialog box |
| 871 | + $j( '#upProgressDialog' ).dialog( 'option', 'width', vW + 20 ); |
| 872 | + $j( '#upProgressDialog' ).dialog( 'option', 'height', vH + 120 ); |
| 873 | + |
| 874 | + //also position the dialog container |
| 875 | + $j( '#upProgressDialog') .dialog( 'option', 'position', 'center' ); |
| 876 | + } |
843 | 877 | } |
844 | | - //reize the video: |
845 | | - $j( v ).css({ |
846 | | - 'width': vW, |
847 | | - 'height': vH |
848 | | - }); |
849 | | - //if large video resize the dialog box: |
850 | | - if( vW + 5 > 400 ) { |
851 | | - //also resize the dialog box |
852 | | - $j( '#upProgressDialog' ).dialog( 'option', 'width', vW + 20 ); |
853 | | - $j( '#upProgressDialog' ).dialog( 'option', 'height', vH + 120 ); |
854 | | - |
855 | | - //also position the dialog container |
856 | | - $j( '#upProgressDialog') .dialog( 'option', 'position', 'center' ); |
857 | | - } |
| 878 | + v.removeEventListener( "loadedmetadata", resizeVid, true ); |
| 879 | + v.addEventListener( "loadedmetadata", resizeVid, true ); |
| 880 | + v.load(); |
858 | 881 | } |
859 | | - v.removeEventListener( "loadedmetadata", resizeVid, true ); |
860 | | - v.addEventListener( "loadedmetadata", resizeVid, true ); |
861 | | - v.load(); |
862 | 882 | }, |
863 | 883 | |
864 | 884 | /** |
— | — | @@ -865,6 +885,7 @@ |
866 | 886 | * into which a video has already been selected. |
867 | 887 | */ |
868 | 888 | getEncoderSettings: function() { |
| 889 | + // set the current_encoder_settings form the default_encoder_settings if not yet set |
869 | 890 | if ( this.current_encoder_settings == null ) { |
870 | 891 | |
871 | 892 | // Clone the default settings |
— | — | @@ -896,8 +917,15 @@ |
897 | 918 | ' passthrough:' + settings['passthrough'] ); |
898 | 919 | |
899 | 920 | this.current_encoder_settings = settings; |
900 | | - } |
901 | | - //Update the format based on codec selection |
| 921 | + } |
| 922 | + |
| 923 | + // Remove maxSize if width or height is set: |
| 924 | + if( ( this.current_encoder_settings['width'] || this.current_encoder_settings['height'] ) |
| 925 | + && this.current_encoder_settings['maxSize'] ){ |
| 926 | + delete this.current_encoder_settings['maxSize']; |
| 927 | + } |
| 928 | + |
| 929 | + // Update the format based on codec selection |
902 | 930 | if( this.current_encoder_settings['videoCodec'] == 'vp8' ){ |
903 | 931 | this.fogg.setFormat('webm'); |
904 | 932 | } else { |
Index: trunk/extensions/AddMediaWizard/AddMedia/mw.FirefoggGUI.js |
— | — | @@ -68,7 +68,8 @@ |
69 | 69 | "fogg-license-title" : "License", |
70 | 70 | "fogg-license-help" : "The license of the clip (preferably a Creative Commons URL).", |
71 | 71 | "fogg-contact-title" : "Contact", |
72 | | - "fogg-contact-help" : "Contact link" |
| 72 | + "fogg-contact-help" : "Contact link", |
| 73 | + "fogg-gui-title" : "Make web video" |
73 | 74 | }); |
74 | 75 | |
75 | 76 | /** |
— | — | @@ -769,8 +770,11 @@ |
770 | 771 | presetDesc = this.local_settings.presets[presetKey].desc; |
771 | 772 | } else { |
772 | 773 | presetDesc = gM( 'fogg-preset-' + presetKey ); |
773 | | - } |
774 | | - |
| 774 | + } |
| 775 | + if( presetKey != 'custom' ){ |
| 776 | + // Copy the preset into custom settings |
| 777 | + this.local_settings.presets['custom']['conf'] = $j.extend( {}, this.local_settings.presets[presetKey]['conf'] ); |
| 778 | + } |
775 | 779 | // Update the preset title |
776 | 780 | $j( this.selector + ' .gd_preset' ) |
777 | 781 | .html( gM( 'fogg-cg-preset', presetDesc ) ); |
— | — | @@ -814,7 +818,7 @@ |
815 | 819 | * return it. |
816 | 820 | */ |
817 | 821 | updateLocalValue: function( confKey, value ) { |
818 | | - if ( typeof this.default_encoder_config[confKey] == 'undefined' ) { |
| 822 | + if ( typeof this.default_encoder_config[ confKey ] == 'undefined' ) { |
819 | 823 | mw.log( "Error: could not update conf key: " + confKey ) |
820 | 824 | return value; |
821 | 825 | } |
Index: trunk/extensions/AddMediaWizard/AddMedia/AddMedia.i18n.php |
— | — | @@ -97,11 +97,8 @@ |
98 | 98 | 'fogg-license-help' => 'The license of the clip (preferably a Creative Commons URL).', |
99 | 99 | 'fogg-contact-title' => 'Contact', |
100 | 100 | 'fogg-contact-help' => 'Contact link', |
101 | | - 'mwe-stream_title' => '$1 $2 to $3', |
102 | | - 'rsd-media-filter-title' => 'Media', |
103 | | - 'rsd-media-filter-videos' => 'Videos', |
104 | | - 'rsd-media-filter-images' => 'Images', |
105 | | - 'rsd-provider-filter-title' => 'Providers', |
| 101 | + 'fogg-missing-webm-support' => 'Please use a [$1 webm compatible] browsers to preview results of webm videos', |
| 102 | + 'fogg-gui-title' => 'Make web video', |
106 | 103 | 'mwe-imported_from' => '$1 imported from [$2 $3]. See the original [$4 resource page] for more information.', |
107 | 104 | 'mwe-import-description' => '$1, imported from $2', |
108 | 105 | 'mwe-select_file' => 'Select file', |