jenkins-bot has submitted this change and it was merged.

Change subject: Don't preload entire video files in video.js mode
......................................................................


Don't preload entire video files in video.js mode

Uses preload="metadata" instead of preload="auto" for native
video/audio playback, or preload="none" for ogv.js playback.

Prevents aggressive preloading of video and audio files that
might not get used. Especially with ogv.js backend this can
fire off a lot of extra requests and threads.

Note that with preload="metadata" there will be fetches for
the file on desktop (but not on mobile, which ignores the
preload hint) but only the very beginning of the file will
be read in.

Change-Id: Ib71fd0397df92e245b9deda41acf57b137e0000b
---
M resources/ext.tmh.player.js
1 file changed, 12 insertions(+), 2 deletions(-)

Approvals:
  TheDJ: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/resources/ext.tmh.player.js b/resources/ext.tmh.player.js
index c90a262..765f8ca 100755
--- a/resources/ext.tmh.player.js
+++ b/resources/ext.tmh.player.js
@@ -53,9 +53,19 @@
                                // We remove the fullscreen button
                                playerConfig = $.extend( true, {}, 
playerConfig, audioConfig );
                        }
+                       // Future interactions go faster if we've preloaded a 
little
+                       var preload = 'metadata';
+                       if ( videoplayer.canPlayType( 'video/webm; 
codecs=vp8,vorbis' ) === '' ) {
+                               // ogv.js currently is expensive to start up:
+                               // https://github.com/brion/ogv.js/issues/438
+                               preload = 'none';
+                       }
+                       if ( index >= 10 ) {
+                               // On pages with many videos, like Category 
pages, don't preload em all
+                               preload = 'none';
+                       }
                        $( videoplayer ).attr( {
-                               /* Don't preload on pages with many videos, 
like Category pages */
-                               preload: ( index < 10 ) ? 'auto' : 'metadata'
+                               preload: preload
                        } ).find( 'source' ).each( function () {
                                // FIXME would be better if we can configure 
the plugin to make use of our preferred attributes
                                $source = $( this );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib71fd0397df92e245b9deda41acf57b137e0000b
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/TimedMediaHandler
Gerrit-Branch: master
Gerrit-Owner: Brion VIBBER <[email protected]>
Gerrit-Reviewer: Brion VIBBER <[email protected]>
Gerrit-Reviewer: Paladox <[email protected]>
Gerrit-Reviewer: TheDJ <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to