W3C home > Mailing lists > Public > whatwg@whatwg.org > May 2012

[whatwg] Firing canplaythrough when caches/buffers are full

From: Robert O'Callahan <robert@ocallahan.org>
Date: Mon, 28 May 2012 12:51:22 +1200
Message-ID: <CAOp6jLaCGRxc1r2Vf208wDvLJMF_drwjMm+16HU_veMX4nqtsw@mail.gmail.com>
To: WHATWG <whatwg@whatwg.org>
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".
http://gaiamobile.org/apps/cubevid/
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
well.)

Rob
-- 
“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]
Received on Monday, 28 May 2012 00:51:56 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 30 January 2013 18:48:08 GMT