We've been looking in detail at the relationship of play/pause to playback rate, and have a suggestion to simplify the design and make it easier both to implement and understand (we hope).

- - - - - - - - - - -

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.

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.

Proposal:

Eliminate defaultPlaybackRate and instead define "the rate at which the media is authored" to be represented by the numerical value of 1.0.

The playbackRate is the rate at which the media plays when not paused. The initial value of playbackRate is set to 1.0 (or perhaps initialized from the media, if it has the ability to indicate an initial suggested rate). Setting playbackRate to 0 throws a NOT_SUPPORTED_ERR exception. Setting playbackRate while the media is playing changes the current playback rate. Setting the playbackRate when the movie is paused does not start playback.

The play() method to cause the media to play at the rate stored in playbackRate.

The pause() method pauses media playback but does not affect playbackRate. It sets the paused attribute to true. pause() when paused does nothing.

We think this provides sufficient control and makes the task of scripting a custom controller a good deal simpler.


--
David Singer
Apple/QuickTime

Reply via email to