Re: Proposal related to bug 22270 "Adding tracks to MediaStream should only be possible for constructed streams"

On Thu, Oct 24, 2013 at 1:19 PM, Stefan HÃ¥kansson LK <
stefan.lk.hakansson@ericsson.com> wrote:

> Alternative A
> =============
> interface BaseMediaStream : EventTarget {
>              readonly    attribute DOMString    id;
>              sequence<MediaStreamTrack> getAudioTracks ();
>              sequence<MediaStreamTrack> getVideoTracks ();
>              MediaStreamTrack?          getTrackById (DOMString trackId);
>              readonly    attribute boolean      active;
>                          attribute EventHandler oninactive;
> };
>
>
> interface PlatformMediaStream : BaseMediaStream {
>                          attribute EventHandler onaddtrack;
>                          attribute EventHandler onremovetrack;
> };
>
>
>
> [Constructor,
>                  Constructor (BaseMediaStream stream),
>                  Constructor (MediaStreamTrackSequence tracks)]
> interface ConstructedMediaStream : BaseMediaStream  {
>              void                       addTrack (MediaStreamTrack track);
>              void                       removeTrack (MediaStreamTrack
> track);
> };
>
>
> Alternative B
> =============
> [NoInterfaceObject]
> interface AbstractMediaStream {
>             readonly    attribute DOMString    id;
>             sequence<MediaStreamTrack> getAudioTracks ();
>             sequence<MediaStreamTrack> getVideoTracks ();
>             MediaStreamTrack?          getTrackById (DOMString trackId);
>             readonly    attribute boolean      active;
>                         attribute EventHandler oninactive;
> };
>
>
> interface PlatformMediaStream : EventTarget {
>                         attribute EventHandler onaddtrack;
>                         attribute EventHandler onremovetrack;
> };
> PlatformMediaStream implements AbstractMediaStream;
>
>
> [Constructor,
>                 Constructor (ConstructedMediaStream stream),
>                 Constructor (PlatformMediaStream stream),
>                 Constructor (MediaStreamTrackSequence tracks)]
> interface ConstructedMediaStream  : EventTarget {
>             void                       addTrack (MediaStreamTrack track);
>             void                       removeTrack (MediaStreamTrack
> track);
> };
> ConstructedMediaStream implements AbstractMediaStream;
>
>
Alternative A seems a bit more straightforward. However, I would call
ConstructedMediaStream just "MediaStream" since JS authors usually only
have to use interface names when they're calling constructors.

Rob
-- 
Jtehsauts  tshaei dS,o n" Wohfy  Mdaon  yhoaus  eanuttehrotraiitny  eovni
le atrhtohu gthot sf oirng iyvoeu rs ihnesa.r"t sS?o  Whhei csha iids  teoa
stiheer :p atroa lsyazye,d  'mYaonu,r  "sGients  uapr,e  tfaokreg iyvoeunr,
'm aotr  atnod  sgaoy ,h o'mGee.t"  uTph eann dt hwea lmka'n?  gBoutt  uIp
waanndt  wyeonut  thoo mken.o w  *
*

Received on Friday, 25 October 2013 07:40:58 UTC