Re: Survey ready on Media Multitrack API proposal

On Fri, Mar 5, 2010 at 2:30 PM, Philip Jägenstedt <philipj@opera.com> wrote:
> On Fri, 05 Mar 2010 05:24:00 +0800, Silvia Pfeiffer
> <silviapfeiffer1@gmail.com> wrote:
>
>> There's only one open issue FAIKT:
>> What shall we do about the grouping. Do we want to add a @group
>> attribute (readonly DOMString) to the MediaTrack which can then take
>> on the same value for all the tracks that belong to the same group
>> (e.g. "1")? Or shall we just not worry about this for the moment since
>> it is not very common in MPEG files and doesn't exist (yet) in Ogg
>> files? We can always add a solution to this later.
>
> If we decide to slap it on later then the only option will be to put it in
> an property on MediaTrack, which means that each group will actually have to
> have a name. I think that groups, like tracks should be indexed by number
> and have an optional name. Otherwise, what is the group property for the
> tracks in this example?
>
> <trackgroup> <!-- no name -->
>  <track>
>  <track>
> </trackgroup>
>
> The safest solution is something like this:
>
> interface HTMLMediaElement : HTMLElement {
>  ...
>  readonly attribute MediaTrackGroups trackgroups;
>  ...
> };
>
> interface MediaTrackGroups {
>  readonly attribute unsigned long length;
>  caller getter MediaTrackGroup item(in unsigned long index);
> };
>
> interface MediaTrackGroup {
>  readonly attribute DOMString name;
>  readonly attribute unsigned long length;
>  caller getter MediaTrack item(in unsigned long index);
> };
>
> interface MediaTrack {
>  readonly attribute DOMString name;
>  readonly attribute DOMString role;
>  readonly attribute DOMString type;
>  readonly attribute DOMString src;
>  readonly attribute DOMString language;
>           attribute boolean enabled;
> };
>
> In other words, MediaTracks becomes MediaTrackGroup and MediaTrackGroups is
> what is exposed on HTMLMediaElement. I don't think this is brilliant from a
> script author's point of view, but don't have any better ideas at this
> point.


I don't think we need to make it this complicated.

If I understand it correctly, in MPEG, track groups are built by
giving each track of the same group the same identifier. This could
just be replicated in the JavaScript API:

interface MediaTrack {
...
  readonly attribute DOMString groupname;
...
}

Then the functions of getting all tracks that belong to the same group
can be built as convenience functions on top of this one attribute.

Seeing as the majority of use cases will not include grouping (e.g. I
wasn't able to find a single MPEG file that has track groups), this
simpler JavaScript API looks preferable to me and will be easier to
deal with for a script author IMHO.

Cheers,
Silvia.

Received on Saturday, 6 March 2010 22:43:07 UTC