[whatwg] MediaController feedback
jer.noble at apple.com
Wed Nov 2 14:50:03 PDT 2011
I'm currently working on implementing MediaController in WebKit <https://bugs.webkit.org/show_bug.cgi?id=71341>, and have a couple pieces of feedback from an implementor's POV:
* MediaController Playback State and Ready State
The spec defines both a "most recently reported readiness state" and a "most recently reported playback state" which, when changed, trigger a variety of event. Because these previous values of these states must be compared each time they are recomputed, we must store these values in our MediaController implementation, which is no huge burdon.
However, when I was writing testcases for my implementation, I noticed that there was no way to query the current value of either the playback state or the ready state, as neither was present in the IDL for MediaController. This makes writing test cases much more difficult, as they now much rely on waiting for edge-triggered events.
In addition, there is a use case for having playbackState and readyState in the MediaController IDL.
When adding a MediaController to an HTMLMediaElement, the spec does not require the media controller to "report the controller state". (It does require that the MediaController "bring the media element up to speed" with the new controller.) In this case, the media controller should also be requried to "report the controller state", as adding a blocking media element to a controller should probably cause the playbackState to revert to WAITING. But if the current playbackState is already WAITING, no "waiting" event will be emitted, and the client waiting on such an event will wait forever.
So I would like to propose two changes to the spec:
+ MediaController should expose the following attributes in IDL:
readonly attribute unsigned short readyState;
readonly attribute unsigned short playbackState;
Exposing these attributes would have approximately zero implementation cost (at least in my implementation) as these values are stored and easily queryable anyway.
+ Modify the media.controller() section to require that the setting the controller "report the controller state".
The MediaController play() function does not actually cause its slaved media elements to play. If all the slaved media elements are paused, the MediaController is a blocked media controller, and none will play until at least one element has play() called on it directly. And even in that case, only the playing elements will begin playing.
In addition, the "user interface" section of the spec says the following:
> When a media element has a current media controller, and all the slaved media elements of that MediaController are paused, the user agent should unpause all the slaved media elements when the user invokes a user agent interface control for beginning playback.
So now, an individual media control must be able to access all other HTMLMediaElements associated with a given MediaController, because there is no facility in MediaController to actually unpause all the slaved media elements. In a previous paragraph in that same section:
> When a media element has a current media controller, the user agent's user interface for pausing and unpausing playback, for seeking, for changing the rate of playback, for fast-forwarding or rewinding, and for muting or changing the volume of audio of the entire group must be implemented in terms of the MediaController API exposed on that current media controller.
Except, in the case of unpausing, this extra requirement of unpausing the slaved media elements is somewhat in conflict with this paragraph.
I would like to propose three changes to the spec:
+ Modify the section "bring the media element up to speed with the new controller" to require that a media element added to a playing media controller must begin playing, and one added to a paused media controller must pause.
+ Modiy the section "controller . play()" to require that the user agent unpause all the slaved media elements.
+ Modify the section "controller . pause()" to require that the user egent pause all the slaved media elements.
+ Remove the section from "user interface" which requires the user agent unpause all the slaved media elements, quoted above.
More information about the whatwg