[MediaWiki-commits] [Gerrit] disablecontrols should only be set once not per source - change (mediawiki...TimedMediaHandler)
jenkins-bot has submitted this change and it was merged. Change subject: disablecontrols should only be set once not per source .. disablecontrols should only be set once not per source Change-Id: I23406ba236ee869081b1bda4ce37706b44b9ba93 --- M MwEmbedModules/EmbedPlayer/resources/mw.EmbedPlayer.js M MwEmbedModules/EmbedPlayer/resources/skins/mw.PlayerControlBuilder.js M TimedMediaTransformOutput.php 3 files changed, 16 insertions(+), 5 deletions(-) Approvals: Brian Wolff: Looks good to me, approved jenkins-bot: Verified diff --git a/MwEmbedModules/EmbedPlayer/resources/mw.EmbedPlayer.js b/MwEmbedModules/EmbedPlayer/resources/mw.EmbedPlayer.js index c8e4883..b93eca5 100644 --- a/MwEmbedModules/EmbedPlayer/resources/mw.EmbedPlayer.js +++ b/MwEmbedModules/EmbedPlayer/resources/mw.EmbedPlayer.js @@ -80,6 +80,9 @@ // can be displayed in the player without loading the media file 'data-durationhint': null, + // to disable menu or timedText for a given embed + 'data-disablecontrols': null, + // Also support direct durationHint attribute ( backwards compatibly ) // @deprecated please use data-durationhint instead. 'durationHint' : null, @@ -342,6 +345,11 @@ this.duration = parseFloat( this.duration ); mw.log( 'EmbedPlayer::init:' + this.id + " duration is: " + this.duration ); + // Add disablecontrols property form data-disablecontrols: + if( _this['data-disablecontrols'] ){ + _this.disablecontrols = _this['data-disablecontrols']; + } + // Set the playerElementId id this.pid = 'pid_' + this.id; diff --git a/MwEmbedModules/EmbedPlayer/resources/skins/mw.PlayerControlBuilder.js b/MwEmbedModules/EmbedPlayer/resources/skins/mw.PlayerControlBuilder.js index 7a05153..0fabaeb 100644 --- a/MwEmbedModules/EmbedPlayer/resources/skins/mw.PlayerControlBuilder.js +++ b/MwEmbedModules/EmbedPlayer/resources/skins/mw.PlayerControlBuilder.js @@ -193,8 +193,11 @@ // Give embeds option to explicitly disable components via flag var source = embedPlayer.mediaElement.getPlayableSources()[0]; - if ( source && source.disablecontrols ) { - source.disablecontrols.split(',').forEach(function( key ) { + if ( !embedPlayer.disablecontrols && source ) { + embedPlayer.disablecontrols = source.disablecontrols; + } + if ( embedPlayer.disablecontrols ) { + embedPlayer.disablecontrols.split(',').forEach(function( key ) { mw.log( 'PlayerControlBuilder:: disabled component via flag:' + key ); _this.supportedComponents[ key ] = false; }); diff --git a/TimedMediaTransformOutput.php b/TimedMediaTransformOutput.php index 143f88b..729a69b 100644 --- a/TimedMediaTransformOutput.php +++ b/TimedMediaTransformOutput.php @@ -214,9 +214,6 @@ // We prefix some source attributes with data- to pass along to the javascript player $prefixedSourceAttr = Array( 'width', 'height', 'title', 'shorttitle', 'bandwidth', 'framerate', 'disablecontrols' ); foreach( $mediaSources as &$source ){ - if ( $this->disablecontrols && !isset( $source['disablecontrols'] ) ) { - $source['disablecontrols'] = $this->disablecontrols; - } foreach( $source as $attr => $val ){ if( in_array( $attr, $prefixedSourceAttr ) ){ $source[ 'data-' . $attr ] = $val; @@ -355,6 +352,9 @@ $mediaAttr[ 'data-startoffset' ] = $offset; } } + if ( $this->disablecontrols ) { + $mediaAttr[ 'data-disablecontrols' ] = $this->disablecontrols; + } return $mediaAttr; } -- To view, visit https://gerrit.wikimedia.org/r/64932 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I23406ba236ee869081b1bda4ce37706b44b9ba93 Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/TimedMediaHandler Gerrit-Branch: master Gerrit-Owner: J Gerrit-Reviewer: Brian Wolff Gerrit-Reviewer: J Gerrit-Reviewer: Mdale Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] disablecontrols should only be set once not per source - change (mediawiki...TimedMediaHandler)
J has uploaded a new change for review. https://gerrit.wikimedia.org/r/64932 Change subject: disablecontrols should only be set once not per source .. disablecontrols should only be set once not per source Change-Id: I23406ba236ee869081b1bda4ce37706b44b9ba93 --- M MwEmbedModules/EmbedPlayer/resources/mw.EmbedPlayer.js M MwEmbedModules/EmbedPlayer/resources/skins/mw.PlayerControlBuilder.js M TimedMediaTransformOutput.php 3 files changed, 16 insertions(+), 5 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TimedMediaHandler refs/changes/32/64932/1 diff --git a/MwEmbedModules/EmbedPlayer/resources/mw.EmbedPlayer.js b/MwEmbedModules/EmbedPlayer/resources/mw.EmbedPlayer.js index 25500d1..0aa13cc 100644 --- a/MwEmbedModules/EmbedPlayer/resources/mw.EmbedPlayer.js +++ b/MwEmbedModules/EmbedPlayer/resources/mw.EmbedPlayer.js @@ -81,6 +81,9 @@ // can be displayed in the player without loading the media file 'data-durationhint': null, + // to disable menu or timedText for a given embed + 'data-disablecontrols': null, + // Also support direct durationHint attribute ( backwards compatibly ) // @deprecated please use data-durationhint instead. 'durationHint' : null, @@ -343,6 +346,11 @@ this.duration = parseFloat( this.duration ); mw.log( 'EmbedPlayer::init:' + this.id + " duration is: " + this.duration ); + // Add disablecontrols property form data-disablecontrols: + if( _this['data-disablecontrols'] ){ + _this.disablecontrols = _this['data-disablecontrols']; + } + // Set the playerElementId id this.pid = 'pid_' + this.id; diff --git a/MwEmbedModules/EmbedPlayer/resources/skins/mw.PlayerControlBuilder.js b/MwEmbedModules/EmbedPlayer/resources/skins/mw.PlayerControlBuilder.js index 30f0204..b01a802 100644 --- a/MwEmbedModules/EmbedPlayer/resources/skins/mw.PlayerControlBuilder.js +++ b/MwEmbedModules/EmbedPlayer/resources/skins/mw.PlayerControlBuilder.js @@ -193,8 +193,11 @@ // Give embeds option to explicitly disable components via flag var source = embedPlayer.mediaElement.getPlayableSources()[0]; - if ( source && source.disablecontrols ) { - source.disablecontrols.split(',').forEach(function( key ) { + if ( !embedPlayer.disablecontrols && source ) { + embedPlayer.disablecontrols = source.disablecontrols; + } + if ( embedPlayer.disablecontrols ) { + embedPlayer.disablecontrols.split(',').forEach(function( key ) { mw.log( 'PlayerControlBuilder:: disabled component via flag:' + key ); _this.supportedComponents[ key ] = false; }); diff --git a/TimedMediaTransformOutput.php b/TimedMediaTransformOutput.php index 17a21e8..d4f3836 100644 --- a/TimedMediaTransformOutput.php +++ b/TimedMediaTransformOutput.php @@ -211,9 +211,6 @@ // We prefix some source attributes with data- to pass along to the javascript player $prefixedSourceAttr = Array( 'width', 'height', 'title', 'shorttitle', 'bandwidth', 'framerate', 'disablecontrols' ); foreach( $mediaSources as &$source ){ - if ( $this->disablecontrols && !isset( $source['disablecontrols'] ) ) { - $source['disablecontrols'] = $this->disablecontrols; - } foreach( $source as $attr => $val ){ if( in_array( $attr, $prefixedSourceAttr ) ){ $source[ 'data-' . $attr ] = $val; @@ -348,6 +345,9 @@ $mediaAttr[ 'data-startoffset' ] = $offset; } } + if ( $this->disablecontrols ) { + $mediaAttr[ 'data-disablecontrols' ] = $this->disablecontrols; + } return $mediaAttr; } -- To view, visit https://gerrit.wikimedia.org/r/64932 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I23406ba236ee869081b1bda4ce37706b44b9ba93 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/TimedMediaHandler Gerrit-Branch: master Gerrit-Owner: J ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits