Index: trunk/extensions/TimedMediaHandler/TimedMediaTransformOutput.php |
— | — | @@ -52,10 +52,19 @@ |
53 | 53 | if ( $this->isVideo ) { |
54 | 54 | return intval( $this->height ); |
55 | 55 | } else { |
56 | | - // Give sound files a height of 0 |
57 | | - return 0; |
| 56 | + // Give sound files a height of 20px |
| 57 | + return 20; |
58 | 58 | } |
59 | 59 | } |
| 60 | + function getPlayerWidth(){ |
| 61 | + // Check if "video" tag output: |
| 62 | + if ( $this->isVideo ) { |
| 63 | + return intval( $this->width ); |
| 64 | + } else { |
| 65 | + // Give sound files a height of 20px |
| 66 | + return 220; |
| 67 | + } |
| 68 | + } |
60 | 69 | |
61 | 70 | function getTagName(){ |
62 | 71 | return ( $this->isVideo ) ? 'video' : 'audio'; |
— | — | @@ -92,7 +101,7 @@ |
93 | 102 | return Xml::tags( 'div' , array( |
94 | 103 | 'id' => "ogg_thumbplayer_" . TimedMediaTransformOutput::$serial++, |
95 | 104 | 'class' => 'PopUpMediaTransform', |
96 | | - 'style' => "width:" . intval( $this->width ) . "px;height:" . |
| 105 | + 'style' => "width:" . intval( $this->getPlayerWidth() ) . "px;height:" . |
97 | 106 | intval( $this->getPlayerHeight() ) . "px", |
98 | 107 | 'data-videopayload' => $this->getXmlMediaTagOutput( $this->getPopupPlayerSize() ), |
99 | 108 | ), |
— | — | @@ -190,7 +199,7 @@ |
191 | 200 | $length = floatval( $this->length ); |
192 | 201 | $offset = floatval( $this->offset ); |
193 | 202 | |
194 | | - $width = $sizeOverride ? $sizeOverride[0] : intval( $this->width ); |
| 203 | + $width = $sizeOverride ? $sizeOverride[0] : $this->getPlayerWidth(); |
195 | 204 | $height = $sizeOverride ? $sizeOverride[1]: $this->getPlayerHeight(); |
196 | 205 | |
197 | 206 | // The poster url: |
Index: trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/resources/mw.EmbedPlayer.js |
— | — | @@ -208,7 +208,7 @@ |
209 | 209 | $( mw ).trigger ( 'EmbedPlayerNewPlayer', $( '#' + playerInterface.id ).get(0) ); |
210 | 210 | |
211 | 211 | // Add a player ready binding: |
212 | | - $( '#' + playerInterface.id ).bind( 'playerReady', areSelectedPlayersReady); |
| 212 | + $( '#' + playerInterface.id ).bind( 'playerReady', areSelectedPlayersReady ); |
213 | 213 | |
214 | 214 | // Issue the checkPlayerSources call to the new player |
215 | 215 | // interface: make sure to use the element that is in the DOM: |
— | — | @@ -527,6 +527,9 @@ |
528 | 528 | |
529 | 529 | var playerAttributes = mw.getConfig( 'EmbedPlayer.Attributes' ); |
530 | 530 | |
| 531 | + // Copy over the tag type |
| 532 | + this.virtualTagName = element.tagName.toLowerCase(); |
| 533 | + |
531 | 534 | // Setup the player Interface from supported attributes: |
532 | 535 | for ( var attr in playerAttributes ) { |
533 | 536 | // We can't use $(element).attr( attr ) because we have to check for boolean attributes: |
— | — | @@ -690,13 +693,13 @@ |
691 | 694 | // Special case for audio |
692 | 695 | // Firefox sets audio height to "0px" while webkit uses 32px .. force |
693 | 696 | // zero: |
694 | | - if( element.tagName.toLowerCase() == 'audio' && this.height == '32' ) { |
695 | | - this.height = 0; |
| 697 | + if( this.isAudio() && this.height == '32' ) { |
| 698 | + this.height = 20; |
696 | 699 | } |
697 | 700 | |
698 | 701 | // Use default aspect ration to get height or width ( if rewriting a |
699 | 702 | // non-audio player ) |
700 | | - if( element.tagName.toLowerCase() != 'audio' && this.videoAspect ) { |
| 703 | + if( this.isAudio() && this.videoAspect ) { |
701 | 704 | var aspect = this.videoAspect.split( ':' ); |
702 | 705 | if( this.height && !this.width ) { |
703 | 706 | this.width = parseInt( this.height * ( aspect[0] / aspect[1] ) ); |
— | — | @@ -724,8 +727,8 @@ |
725 | 728 | } |
726 | 729 | |
727 | 730 | // Special height default for audio tag ( if not set ) |
728 | | - if( element.tagName.toLowerCase() == 'audio' ) { |
729 | | - this.height = 0; |
| 731 | + if( this.isAudio() ) { |
| 732 | + this.height = 20; |
730 | 733 | }else{ |
731 | 734 | this.height = defaultSize[1]; |
732 | 735 | } |
— | — | @@ -966,12 +969,14 @@ |
967 | 970 | * Check if the selected source is an audio element: |
968 | 971 | */ |
969 | 972 | isAudio: function(){ |
970 | | - return ( this.mediaElement.selectedSource.mimeType.indexOf('audio/') !== -1 ); |
| 973 | + return ( this.virtualTagName == 'audio' |
| 974 | + || |
| 975 | + ( this.mediaElement && this.mediaElement.selectedSource.mimeType.indexOf('audio/') !== -1 ) |
| 976 | + ); |
971 | 977 | }, |
972 | 978 | |
973 | 979 | /** |
974 | | - * Get the plugin embed html ( should be implemented by embed player |
975 | | - * interface ) |
| 980 | + * Get the plugin embed html ( should be implemented by embed player interface ) |
976 | 981 | */ |
977 | 982 | doEmbedHTML: function() { |
978 | 983 | return 'Error: function doEmbedHTML should be implemented by embed player interface '; |
Index: trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/resources/skins/mw.PlayerControlBuilder.js |
— | — | @@ -129,7 +129,8 @@ |
130 | 130 | 'height' : parseInt( embedPlayer.height ) - parseInt( this.height ) |
131 | 131 | } ); |
132 | 132 | }*/ |
133 | | - // Make room for audio controls in the interface: |
| 133 | + |
| 134 | + // Make room for audio controls in the interface ( if we have a zero height |
134 | 135 | if( embedPlayer.isAudio() && embedPlayer.$interface.height() == 0 ){ |
135 | 136 | embedPlayer.$interface.css( { |
136 | 137 | 'height' : this.height |
— | — | @@ -180,6 +181,10 @@ |
181 | 182 | this.supportedComponets[ 'options'] = false; |
182 | 183 | } |
183 | 184 | |
| 185 | + // Check if we have multiple playable sources ( if only one source don't display source switch ) |
| 186 | + if( embedPlayer.mediaElement.getPlayableSources().length == 1 ){ |
| 187 | + this.supportedComponets[ 'sourceSwitch'] = false; |
| 188 | + } |
184 | 189 | |
185 | 190 | var addComponent = function( component_id ){ |
186 | 191 | if ( _this.supportedComponets[ component_id ] ) { |
— | — | @@ -850,13 +855,12 @@ |
851 | 856 | if( mw.isIpad() ){ |
852 | 857 | return false; |
853 | 858 | } |
854 | | - |
855 | 859 | |
856 | | - // Don't hide controls when content "height" is 0px ( audio tags ) |
857 | | - if( this.embedPlayer.getPlayerHeight() === 0 && |
858 | | - $(this.embedPlayer).css('height').indexOf('%') === -1 ){ |
| 860 | + // Don't hide controls when its an audio player |
| 861 | + if( this.embedPlayer.isAudio() ){ |
859 | 862 | return false; |
860 | 863 | } |
| 864 | + |
861 | 865 | if( this.embedPlayer.controls === false ){ |
862 | 866 | return false; |
863 | 867 | } |