http://www.mediawiki.org/wiki/Special:Code/MediaWiki/88192
Revision: 88192
Author: dale
Date: 2011-05-15 14:58:18 +0000 (Sun, 15 May 2011)
Log Message:
-----------
Fixed the audio rendering support to have a set size and work better with
default size of player by
Removed the source selection controlBar component when there is only one source
available
Modified Paths:
--------------
trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/resources/mw.EmbedPlayer.js
trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/resources/skins/mw.PlayerControlBuilder.js
trunk/extensions/TimedMediaHandler/TimedMediaTransformOutput.php
Modified:
trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/resources/mw.EmbedPlayer.js
===================================================================
---
trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/resources/mw.EmbedPlayer.js
2011-05-15 14:57:10 UTC (rev 88191)
+++
trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/resources/mw.EmbedPlayer.js
2011-05-15 14:58:18 UTC (rev 88192)
@@ -208,7 +208,7 @@
$( mw ).trigger ( 'EmbedPlayerNewPlayer', $( '#' +
playerInterface.id ).get(0) );
// Add a player ready binding:
- $( '#' + playerInterface.id ).bind( 'playerReady',
areSelectedPlayersReady);
+ $( '#' + playerInterface.id ).bind( 'playerReady',
areSelectedPlayersReady );
// Issue the checkPlayerSources call to the new player
// interface: make sure to use the element that is in
the DOM:
@@ -527,6 +527,9 @@
var playerAttributes = mw.getConfig( 'EmbedPlayer.Attributes' );
+ // Copy over the tag type
+ this.virtualTagName = element.tagName.toLowerCase();
+
// Setup the player Interface from supported attributes:
for ( var attr in playerAttributes ) {
// We can't use $(element).attr( attr ) because we have
to check for boolean attributes:
@@ -690,13 +693,13 @@
// Special case for audio
// Firefox sets audio height to "0px" while webkit uses 32px ..
force
// zero:
- if( element.tagName.toLowerCase() == 'audio' && this.height ==
'32' ) {
- this.height = 0;
+ if( this.isAudio() && this.height == '32' ) {
+ this.height = 20;
}
// Use default aspect ration to get height or width ( if
rewriting a
// non-audio player )
- if( element.tagName.toLowerCase() != 'audio' &&
this.videoAspect ) {
+ if( this.isAudio() && this.videoAspect ) {
var aspect = this.videoAspect.split( ':' );
if( this.height && !this.width ) {
this.width = parseInt( this.height * (
aspect[0] / aspect[1] ) );
@@ -724,8 +727,8 @@
}
// Special height default for audio tag ( if not set )
- if( element.tagName.toLowerCase() == 'audio' ) {
- this.height = 0;
+ if( this.isAudio() ) {
+ this.height = 20;
}else{
this.height = defaultSize[1];
}
@@ -966,12 +969,14 @@
* Check if the selected source is an audio element:
*/
isAudio: function(){
- return (
this.mediaElement.selectedSource.mimeType.indexOf('audio/') !== -1 );
+ return ( this.virtualTagName == 'audio'
+ ||
+ ( this.mediaElement &&
this.mediaElement.selectedSource.mimeType.indexOf('audio/') !== -1 )
+ );
},
/**
- * Get the plugin embed html ( should be implemented by embed player
- * interface )
+ * Get the plugin embed html ( should be implemented by embed player
interface )
*/
doEmbedHTML: function() {
return 'Error: function doEmbedHTML should be implemented by
embed player interface ';
Modified:
trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/resources/skins/mw.PlayerControlBuilder.js
===================================================================
---
trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/resources/skins/mw.PlayerControlBuilder.js
2011-05-15 14:57:10 UTC (rev 88191)
+++
trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/resources/skins/mw.PlayerControlBuilder.js
2011-05-15 14:58:18 UTC (rev 88192)
@@ -129,7 +129,8 @@
'height' : parseInt( embedPlayer.height ) -
parseInt( this.height )
} );
}*/
- // Make room for audio controls in the interface:
+
+ // Make room for audio controls in the interface ( if we have a
zero height
if( embedPlayer.isAudio() && embedPlayer.$interface.height() ==
0 ){
embedPlayer.$interface.css( {
'height' : this.height
@@ -180,6 +181,10 @@
this.supportedComponets[ 'options'] = false;
}
+ // Check if we have multiple playable sources ( if only one
source don't display source switch )
+ if( embedPlayer.mediaElement.getPlayableSources().length == 1 ){
+ this.supportedComponets[ 'sourceSwitch'] = false;
+ }
var addComponent = function( component_id ){
if ( _this.supportedComponets[ component_id ] ) {
@@ -850,13 +855,12 @@
if( mw.isIpad() ){
return false;
}
-
- // Don't hide controls when content "height" is 0px ( audio
tags )
- if( this.embedPlayer.getPlayerHeight() === 0 &&
- $(this.embedPlayer).css('height').indexOf('%') === -1 ){
+ // Don't hide controls when its an audio player
+ if( this.embedPlayer.isAudio() ){
return false;
}
+
if( this.embedPlayer.controls === false ){
return false;
}
Modified: trunk/extensions/TimedMediaHandler/TimedMediaTransformOutput.php
===================================================================
--- trunk/extensions/TimedMediaHandler/TimedMediaTransformOutput.php
2011-05-15 14:57:10 UTC (rev 88191)
+++ trunk/extensions/TimedMediaHandler/TimedMediaTransformOutput.php
2011-05-15 14:58:18 UTC (rev 88192)
@@ -52,10 +52,19 @@
if ( $this->isVideo ) {
return intval( $this->height );
} else {
- // Give sound files a height of 0
- return 0;
+ // Give sound files a height of 20px
+ return 20;
}
}
+ function getPlayerWidth(){
+ // Check if "video" tag output:
+ if ( $this->isVideo ) {
+ return intval( $this->width );
+ } else {
+ // Give sound files a height of 20px
+ return 220;
+ }
+ }
function getTagName(){
return ( $this->isVideo ) ? 'video' : 'audio';
@@ -92,7 +101,7 @@
return Xml::tags( 'div' , array(
'id' => "ogg_thumbplayer_" .
TimedMediaTransformOutput::$serial++,
'class' => 'PopUpMediaTransform',
- 'style' => "width:" . intval( $this->width ) .
"px;height:" .
+ 'style' => "width:" . intval(
$this->getPlayerWidth() ) . "px;height:" .
intval(
$this->getPlayerHeight() ) . "px",
'data-videopayload' =>
$this->getXmlMediaTagOutput( $this->getPopupPlayerSize() ),
),
@@ -190,7 +199,7 @@
$length = floatval( $this->length );
$offset = floatval( $this->offset );
- $width = $sizeOverride ? $sizeOverride[0] : intval(
$this->width );
+ $width = $sizeOverride ? $sizeOverride[0] :
$this->getPlayerWidth();
$height = $sizeOverride ? $sizeOverride[1]:
$this->getPlayerHeight();
// The poster url:
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs