Page MenuHomePhabricator

TimedMediaHandler injects too many JavaScript configuration variables
Open, LowPublic

Description

JavaScript configuration variables that are added via ResourceLoaderGetConfigVars are inserted into the start-up module, which is on the critical path to loading page content. MwEmbedSupport uses this interface to inject the contents of two configuration files, MediaWikiSupport.config.php & MwEmbedSupport.config.php, which contain largely static configuration data that is MwEmbedSupport-specific, the loading of which could be limited to pages containing timed media, and deferred until DOMContentLoaded or later.

If the configuration variables truly are static, they can be hard-coded in a JavaScript file and included in the scripts array of the the MwEmbedSupport ResourceLoader module. If it is important for these values to be configurable via PHP, a custom ResourceLoader module class should be written. For an example of this technique, refer to includes/ResourceLoaderULSJsonMessageModule.php in the UniversalLanguageSelector extension.

List and values in Wikimedia production as of 2018-08-17:

AjaxRequestTimeout: 30
EmbedPLayer.IFramePlayer.DomainWhiteList: "*"
EmbedPlayer.AttributionButton: {title: "Kaltura html5 video library", href: "http://www.kaltura.com", class: "kaltura-icon", style: {…}, iconurl: false}
EmbedPlayer.BlackPixel: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkqAcAAIUAgUW0RjgAAAAASUVORK5CYII="
EmbedPlayer.CodecPreference: ["vp9", "webm", "h264", "ogg", "mp3", "ogvjs"]
EmbedPlayer.ControlsHeight: 31
EmbedPlayer.DefaultSize: "400x300"
EmbedPlayer.DefaultSkin: "mvpcf"
EmbedPlayer.DisableVideoTagSupport: false
EmbedPlayer.EnableFlavorSelector: false
EmbedPlayer.EnableFullscreen: true
EmbedPlayer.EnableIframeApi: true
EmbedPlayer.EnableIpadHTMLControls: true
EmbedPlayer.EnableIpadNativeFullscreen: false
EmbedPlayer.EnableRightClick: true
EmbedPlayer.EnableTimeDisplay: true
EmbedPlayer.EnableURLTimeEncoding: "flash"
EmbedPlayer.EnableVolumeControl: true
EmbedPlayer.EnabledOptionsMenuItems: ["playerSelect", "download", "share", "aboutPlayerLibrary"]
EmbedPlayer.FirefoxLink: "http://www.mozilla.com/en-US/firefox/upgrade.html?from=mwEmbed"
EmbedPlayer.ForceLargeReplayButton: false
EmbedPlayer.FullScreenZIndex: 999998
EmbedPlayer.FullscreenTip: true
EmbedPlayer.KalturaAttribution: true
EmbedPlayer.LibraryPage: "http://www.kaltura.org/project/HTML5_Video_Media_JavaScript_Library"
EmbedPlayer.MonitorRate: 250
EmbedPlayer.NativeControls: false
EmbedPlayer.NativeControlsMobileSafari: true
EmbedPlayer.NewWindowFullscreen: false
EmbedPlayer.NotPlayableDownloadLink: true
EmbedPlayer.OverlayControls: true
EmbedPlayer.PageDomainIframe: true
EmbedPlayer.ReplaceSources: null
EmbedPlayer.RewriteSelector: "video,audio,playlist"
EmbedPlayer.ShareEmbedMode: "iframe"
EmbedPlayer.ShowNativeWarning: true
EmbedPlayer.ShowPlayerAlerts: true
EmbedPlayer.SkinList: ["mvpcf", "kskin"]
EmbedPlayer.TimeDisplayWidth: 85
EmbedPlayer.UseFlashOnAndroid: false
EmbedPlayer.WaitForMeta: true
EmbedPlayer.WebKitPlaysInline: false
EmbedPlayer.iPhoneShowHTMLPlayScreen: true
MediaWiki.DefaultProvider: "local"
MediaWiki.ApiProviders: { commons: { url: "//commons.wikimedia.beta.wmflabs.org/w/api.php" } }
MediaWiki.ApiPostActions: [ "login", "purge", "rollback", "delete", "undelete", "protect", "block", "unblock", "move", "edit", "upload", "emailuser", "import", "userrights" ]
TimedText.BelowVideoBlackBoxHeight: 40
TimedText.BottomPadding: 10
TimedText.NeedsTranscriptCategory: "Videos needing subtitles"
TimedText.ShowRequestTranscript: false

Details

Reference
bz58082
Related Gerrit Patches:
mediawiki/extensions/TimedMediaHandler : masterDrop or inline some pointless config options

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 2:24 AM
bzimport set Reference to bz58082.
ori created this task.Dec 6 2013, 7:37 AM

mdale wrote:

Makese sense. We should include this in player v2 inclusion / refactor efforts.

Restricted Application added subscribers: Matanya, Aklapper. · View Herald TranscriptAug 7 2015, 7:00 PM
Jdforrester-WMF moved this task from Untriaged to Backlog on the Multimedia board.Sep 4 2015, 6:37 PM
TheDJ moved this task from To sort to Player on the TimedMediaHandler board.Oct 25 2015, 2:11 PM
TheDJ added a subscriber: TheDJ.Nov 19 2015, 2:44 PM

Performance-Team, are you guys still interested in this ? Cause it should be a lot easier to do now probably.

@TheDJ It's a bit less critical now that the startup module is asynchronous. However it'd still be good to optimise as much as possible because while it no longer blocks rendering, it does still block any javascript execution (e.g. attaching event handlers, handling permalink hashes such as mediaviewer etc.)

@TheDJ Can you confirm that (most) these config vars will go away after videojs is adopted as default? If so, feel free to close this.
T100106: Replace Kaltura player with Video.js

Krinkle moved this task from Inbox to Radar on the Performance-Team board.
TheDJ added a comment.Mar 28 2017, 7:59 PM

@Krinkle it would, but since there is no timetable for when video.js will be available on wikimedia servers I dont feel comfortable closing this.

brion moved this task from Player to Player-Old on the TimedMediaHandler board.Apr 23 2018, 11:00 PM
Nirmos added a subscriber: Nirmos.May 19 2018, 11:49 AM

Wooooaaahhh. I wrote

Object.keys( mw.config.get() ).filter( v => v.startsWith( 'EmbedPLayer.' ) );

in the console to see how many keys there are, and was surprised when I only got one value in the array. Turns out that one of the keys is misspelled. See the capital L in PLayer?

In other words

Object.keys( mw.config.get() ).filter( v => v.startsWith( 'EmbedPLayer.' ) ).length;

gives 1 and

Object.keys( mw.config.get() ).filter( v => v.startsWith( 'EmbedPlayer.' ) ).length;

gives 45.

And, for completeness

{
	const regex = /EmbedPLayer\./i;
	Object.keys( mw.config.get() ).filter( v => regex.test( v ) ).length;
}

gives 46, which means EmbedPLayer.IFramePlayer.DomainWhiteList is the only key with any capitalization error in that part of the name (that is, before the first dot).

Change 454345 had a related patch set uploaded (by Jforrester; owner: Jforrester):
[mediawiki/extensions/TimedMediaHandler@master] Drop or inline some pointless config options

https://gerrit.wikimedia.org/r/454345

Change 454345 merged by jenkins-bot:
[mediawiki/extensions/TimedMediaHandler@master] Drop or inline some pointless config options

https://gerrit.wikimedia.org/r/454345

Krinkle renamed this task from MwEmbedSupport injects too many JavaScript configuration variables to TimedMediaHandler injects too many JavaScript configuration variables.Sep 26 2018, 2:08 AM
Krinkle lowered the priority of this task from Medium to Low.Mar 19 2019, 3:09 PM