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 <[email protected]>
Gerrit-Reviewer: Brian Wolff <[email protected]>
Gerrit-Reviewer: J <[email protected]>
Gerrit-Reviewer: Mdale <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits