Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parallel background download of all available video sizes - massive bandwith usage #497

Open
raffaelj opened this issue Dec 28, 2020 · 2 comments

Comments

@raffaelj
Copy link

raffaelj commented Dec 28, 2020

I watched a talk from the rC3 right now and left my network tab (browser dev tools) open. After finishing the downloaded video with VLC, I realised, that my open browser window downloaded 1.44GB in the background.

Screenshot_20201228_212728_rc3_browser_background_video_loading

Video: https://media.ccc.de/v/rc3-891673-rage_against_the_machine_learning

Steps to reproduce:

  • open url on media.ccc.de
  • press play button
  • video stutters --> press pause button --> decide to download and to watch with VLC
  • start download (138MB)
  • leave the browser window open

I was able to reproduce the behaviour with a "smaller" data set (only 592MB).
Video: https://media.ccc.de/v/rC3-teaser-mincorrect

Screenshot_20201228_212728_rc3_browser_background_video_loading_2

System:

OS: OpenSUSE Tumbleweed
Browser: Firefox 83.0 (64-bit)

FF-Addons: BlockTube, Decentraleyes, Facebook Container, KeePassXC-Browser, NoScript, uBlock Origin

edit:
Now I started another video and I only pressed play. In the background first "webm", than "sd" and than "hd" downloaded completely.

@manno
Copy link
Member

manno commented Dec 29, 2020

Hey @raffaelj, I can reproduce that. However I'm not clear on the exact conditions.
Initially opening the page (without cache, full reload) and clicking the play button, the videoplayer selects video source and starts playing it from a mirror. Clicking on a download video link (plays mp4 in browser directly) and navigating back to the event page, shows all videosources have been downloaded.

I suspect turbolinks and the videoplayer js initialization?

@manno manno added the bug label Dec 29, 2020
@raffaelj
Copy link
Author

raffaelj commented Dec 29, 2020

However I'm not clear on the exact conditions.

I digged a little bit and it seems, that the conditions are that simple:

  • use Firefox browser
  • open a website with a html5 video tag with preload='metadata' (or maybe any preload state...?)

No user interaction is necessary, just wait (not sure, if media.ccc.de starts a play event somewhere in the background). Now all available sources inside the video tag are preloaded if the proper codecs are available.

I'm not very familiar with media hosting etc, but I remembered, that I had this issue before with the html5 audio tag - so knew, where to look for this issue.

I also found an open issue from 7 years ago on bugzilla: "Metadata" state for preload attribute of video element being ignored when buffering. In short: The feedbask was to limit the traffic server-side.

Possible solutions (not tested):

as a user to preserve bandwith

  • use a chromium based browser
  • or tinker with about:config in Firefox to disable some preloading of media files

server side

Maybe limit/drop the traffic if a different video source is already loading...

client/player side

Inject video sources dynamically instead of providing 4 different sources on page load. I'm not sure, how much this might impact the usability with enabled script blockers. And I'm not sure, how it impacts caching when switching between SD/HD/MP4/WEBM.

edit:
Now I read some js in the html source. Maybe it is the mirror search? This code looks a bit like it would start a request to all sources to see if it gets a response, which might start the actual download.

$('video source').each(function() {
  var $source = $(this);
  // Prop always presents the fully resolved URL
  promises.push(
    MirrorbrainFix.selectMirror($source.prop('src'), function(mirror) {
      $source.attr('src', mirror);
    })
  );
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants