[whatwg] Firing canplaythrough when caches/buffers are full
robert at ocallahan.org
Sun May 27 17:51:22 PDT 2012
We encountered an app that uses "canplaythrough" on a video element to
trigger execution of the app "so we don't start playing the video until we
can do so without stuttering".
This approach works fine on desktop browsers. On mobile browsers, we want a
smaller limit on the amount of data buffered by the media subsystem. That
means we pause the download before "canplaythrough" would fire, so it never
fires, so the app doesn't work.
We could fix this particular app, but this seems like a natural thing for
authors to do and get wrong.
I propose fixing this by having the UA enter the HAVE_ENOUGH_DATA
readyState when the UA decides to suspend a download indefinitely and the
preload state is "Automatic" (or overriden by "autoplay" being set).
We have checked in a patch to Gecko to do this. (Note that for a long time,
Gecko has triggered playback of autoplay elements when suspending due to
media buffers being full. The new change makes us enter HAVE_ENOUGH_DATA as
“You have heard that it was said, ‘Love your neighbor and hate your enemy.’
But I tell you, love your enemies and pray for those who persecute you,
that you may be children of your Father in heaven. ... If you love those
who love you, what reward will you get? Are not even the tax collectors
doing that? And if you greet only your own people, what are you doing more
than others?" [Matthew 5:43-47]
More information about the whatwg