#26779 closed defect (bug) (fixed)
Multiple mediaelement instances of the same self-hosted video file on a page breaks in all players after first
Reported by: | ericlewis | Owned by: | wonderboymusic |
---|---|---|---|
Milestone: | 3.9 | Priority: | normal |
Severity: | normal | Version: | 3.6 |
Component: | Media | Keywords: | needs-patch |
Focuses: | Cc: |
Description
I have two instances of a .mov file on the same page for responsive design purposes. The first one works fine, but the second one doesn't preload, and loads endlessly when clicking play.
Change History (8)
#4
@
11 years ago
This is probably garbage not being collected properly - I am chatting with John Dyer about it
#5
@
11 years ago
Notes as I'm looking at this:
- only happens for video
- 1st video will play after clicking play on both of them a few times
#6
@
11 years ago
Ok, turns out my query string method has some merit. Here's why this happens:
preload="metadata"
tells the browser that fetching its metadata (dimensions, first frame, track list, duration, and so on) is desirable, It does this by requesting part of the file and then canceling the request. When playing, it appears it is makingRange
requests because the responses come back as206
.- Because the first file is buffered and the canceled, and because the 2nd file is the exact same URL as the first, the browser ignores it.
- We can make them appear to be different files by appending a cache-buster to the sources.
yolo.mp4?_=1
- with the value of_
being the instance number of the shortcode. Usingadd_query_arg()
assures that we don't bust the URL._
is the same var name jQuery uses to send cache-busting requests. - The good thing: the browser will return
304
s for subsequent requests for the videos, so we aren't really cache-busting every time, and they will retain their unique identity if the same source appears more than once on the page.
Note: See
TracTickets for help on using
tickets.
If you press play on the first, play on the second, play on the first, then play on the second: they will both play. Will look at this.