User:Shellylin/InputPort: Difference between revisions

Line 16: Line 16:
   enum InputPortType { "av", "displayport", "hdmi" };
   enum InputPortType { "av", "displayport", "hdmi" };


   interface InputPort {
   interface InputPort : EventTarget {
    readonly attribute DOMString name;
     readonly attribute DOMString id;
     readonly attribute DOMString id;
     readonly attribute InputPortType type;
     readonly attribute InputPortType type;
     readonly attribute MediaStream? stream;
     readonly attribute MediaStream stream;
             attribute EventHandler onconnect;
             attribute EventHandler onconnect;
             attribute EventHandler ondisconnect;
             attribute EventHandler ondisconnect;
   };
   };
<u>'''Attributes'''</u><br />
'''name''' of type DOMString, readonly<br />
The name of this input port, e.g. "AV1", "HDMI1", "HDMI2".


'''id''' of type DOMString, readonly<br />
'''id''' of type DOMString, readonly<br />
When an InputPort object is created, the user agent MUST generate an identifier string, and MUST initialize the object's id attribute to that string. A good practice is to use an UUID, which is 36 characters long in its canonical form.
The unique id for the represented input port.<br />
Input port identifier MUST be unique to the application, and persistent between application sessions.


The id attribute MUST return the value to which it was initialized when the object was created.
''This idea is referenced from the attribute [http://w3c.github.io/mediacapture-main/getusermedia.html#dictionary-mediadeviceinfo-members deviceId] of MediaDevice.''
 
p.s. The idea behind InputPort's id is identical to the id of MediaStream, we want to differentiate InputPort instances created by different UA, so the above statement is copied from the definition of MediaStream's id.


'''type''' of type InputPortType, readonly<br />
'''type''' of type InputPortType, readonly<br />
The type of this input port, value must be defined in the enum of InputPortType, e.g. "av", "displayport".
The type of this input port, value must be defined in the enum of InputPortType, e.g. "av", "displayport".


'''stream''' of type MediaStream, readonly, nullable<br />
'''stream''' of type MediaStream, readonly<br />
The stream represents the media content provided by this input port.
The media content of this input port, represented as a MediaStream object.<br />
The reference of this object remains unchanged during the life time of its belonging InputPort; Dispatch of connect or disconnect event responses to the state of hardware connection, isolating to the fact of whether the media content is playable or not; Behaviour of stream with non-playable content should be the same as behavior of muted media tracks, described in section "[http://w3c.github.io/mediacapture-main/getusermedia.html#life-cycle-and-media-flow Life-cycle and Media Flow]".
 
'''onconnect''' of type EventHandler,<br />
'''ondisconnect''' of type EventHandler,<br />
Whenever the hardware detects a connection/disconnection of this input port, UA must queue a task to fire a simple event name connect/disconnect.


=== Specific Port Interfaces ===
=== Specific Port Interfaces ===
Confirmed users
220

edits