Mdale has submitted this change and it was merged.

Change subject: Add option to disable control elements per player
......................................................................


Add option to disable control elements per player

add option to disable some controls on a per player basis,
used to disable timedText and options if loading from Score.

Change-Id: I486c5882168f6e4d88a5f0c2afc5753fc1351bc8
---
M MwEmbedModules/EmbedPlayer/resources/mw.MediaSource.js
M MwEmbedModules/EmbedPlayer/resources/skins/mw.PlayerControlBuilder.js
M MwEmbedModules/TimedText/resources/mw.TimedText.js
3 files changed, 17 insertions(+), 2 deletions(-)

Approvals:
  Mdale: Verified; Looks good to me, approved
  jenkins-bot: Checked



diff --git a/MwEmbedModules/EmbedPlayer/resources/mw.MediaSource.js 
b/MwEmbedModules/EmbedPlayer/resources/mw.MediaSource.js
index dd0b50d..9449a5d 100644
--- a/MwEmbedModules/EmbedPlayer/resources/mw.MediaSource.js
+++ b/MwEmbedModules/EmbedPlayer/resources/mw.MediaSource.js
@@ -60,6 +60,9 @@
        // used for setting the api provider for mediawiki
        'data-mwprovider',
 
+       // to disable menu or timedText for a given embed
+       'data-disablecontrols',
+
        // used for language direction of subtitles
        'data-dir',
 
diff --git 
a/MwEmbedModules/EmbedPlayer/resources/skins/mw.PlayerControlBuilder.js 
b/MwEmbedModules/EmbedPlayer/resources/skins/mw.PlayerControlBuilder.js
index c2ec2c9..47d60c2 100644
--- a/MwEmbedModules/EmbedPlayer/resources/skins/mw.PlayerControlBuilder.js
+++ b/MwEmbedModules/EmbedPlayer/resources/skins/mw.PlayerControlBuilder.js
@@ -185,8 +185,19 @@
                }
 
                // Check if we have multiple playable sources ( if only one 
source don't display source switch )
+
                if( embedPlayer.mediaElement.getPlayableSources().length == 1 ){
-                       this.supportedComponents[ 'sourceSwitch'] = false;
+                       this.supportedComponents[ 'sourceSwitch' ] = false;
+
+               }
+
+               // 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 
) {
+                               mw.log( 'PlayerControlBuilder:: disabled 
component via flag:' + key );
+                               _this.supportedComponents[ key ] = false;
+                       });
                }
 
                $( embedPlayer ).trigger( 'addControlBarComponent', this );
diff --git a/MwEmbedModules/TimedText/resources/mw.TimedText.js 
b/MwEmbedModules/TimedText/resources/mw.TimedText.js
index bd135c2..aed646c 100644
--- a/MwEmbedModules/TimedText/resources/mw.TimedText.js
+++ b/MwEmbedModules/TimedText/resources/mw.TimedText.js
@@ -261,7 +261,8 @@
                        var _this = this;
                        // By default we include a button in the control bar.
                        $( _this.embedPlayer ).bind( 'addControlBarComponent' + 
this.bindPostFix, function(event, controlBar ){
-                               if( _this.includeCaptionButton() ){
+                               if( controlBar.supportedComponents['timedText'] 
!== false &&
+                                       _this.includeCaptionButton() ) {
                                        
controlBar.supportedComponents['timedText'] = true;
                                        controlBar.components['timedText'] = 
_this.getTimedTextButton();
                                }

-- 
To view, visit https://gerrit.wikimedia.org/r/51979
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I486c5882168f6e4d88a5f0c2afc5753fc1351bc8
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/TimedMediaHandler
Gerrit-Branch: master
Gerrit-Owner: J <[email protected]>
Gerrit-Reviewer: Mdale <[email protected]>
Gerrit-Reviewer: Tim Starling <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to