W3C home > Mailing lists > Public > whatwg@whatwg.org > November 2007

[whatwg] media element playback rates

From: Ian Hickson <ian@hixie.ch>
Date: Fri, 2 Nov 2007 17:34:13 +0000 (UTC)
Message-ID: <Pine.LNX.4.62.0711021721061.27205@hixie.dreamhostps.com>
On Fri, 2 Nov 2007, Dave Singer wrote:
> 
> About playbackRate and defaultPlaybackRate in the current specification of
> media elements, the logic that's currently necessary to set a media element to
> play at rate n is somewhat convoluted:
> 
> 	If the media is paused
> 		1) Set the defaultPlaybackRate to n.
> 		2) Issue play().
> 	If the media is not paused
> 		- Set the playbackRate to n.
> 
> And there's a distinct lack of permanence to setting playbackRate on 
> playing media to alter its rate. Once media is paused, the play() method 
> will reset the rate of the media (and playbackRate itself) to 
> defaultPlaybackRate instead of to the previous value of playbackRate, 
> which we think is unexpected.

The current design is built around three use cases:

 1. Being able to implement fast-forward, rewind, or slow-motion easily.
 2. Being able to change the playback rate for watching videos quickly.
 3. Being able to do both in the same player.

In the current model:

Fast-forward and rewind just consists of calling play() to ensure the 
playback head is moving and then changing 'playbackRate', resetting to 
normal is just a call to play(); changing the default playback rate 
without affecting that consists of changing 'defaultPlaybackRate' and, if 
the UA isn't in a fast-forward, rewind, or slow-motion mode, and isn't 
paused, also calling 'play()'.

We could optimise this by making defaultPlaybackRate affect playbackRate 
if playbackRate == old_defaultPlaybackRate, though. Would that work?


> Similarly, the logic required to determine the rate at which media is 
> playing or is about to play is convoluted. When listening for ratechange 
> events, scripts must perform different checks depending on whether the 
> media is currently playing.

Why? playbackRate always represents the current playback rate.

We could make changing defaultPlaybackRate when the content is paused 
affect playbackRate, though. Would that work?


> Proposal: [...]

As far as I can tell this would significantly complicate implementing the 
two use cases mentioned above together.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Friday, 2 November 2007 10:34:13 GMT

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