[Bug 16613] New: Consider a more object-oriented design in which sessions are represented as objects

https://www.w3.org/Bugs/Public/show_bug.cgi?id=16613

           Summary: Consider a more object-oriented design in which
                    sessions are represented as objects
           Product: HTML WG
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P3
         Component: Encrypted Media Extensions
        AssignedTo: adrianba@microsoft.com
        ReportedBy: watsonm@netflix.com
         QAContact: public-html-bugzilla@w3.org
                CC: mike@w3.org, public-html-wg-issue-tracking@w3.org,
                    public-html@w3.org


A variant of the API with the same functionality has been suggested in which
key exchange 'sessions' are explicitly represented as objects. The methods used
to supply a key/license or cancel the session become methods on this object,
not the HTMLMediaElement itself.

partial interface HTMLMediaElement {
    MediaKeySession generateKeyRequest(in DOMString keySystem, in Uint8Array?
initData);
};

interface MediaKeySession : EventTarget {
    readonly attribute DOMString keySystem;
    readonly attribute DOMString? sessionId;

    void addKey(in Uint8Array key);
    void cancel();
};
The following event would be fired at the MediaKeySession when a message is
ready to be sent.

[Constructor(DOMString type, optional MediaKeyMessageEventInit eventInitDict)]
interface MediaKeyMessageEvent : Event {
    readonly attribute Uint8Array message;
    readonly attribute DOMString? defaultUrl;
};

dictionary MediaKeyMessageEventInit : EventInit  {
    Uint8Array message;
    DOMString? defaultUrl;
};
Note that in the MediaKeySession interface, sessionId is guaranteed to be
initialized only after the first MediaKeyMessageEvent.

The following event would be fired at the MediaKeySession when the transaction
is complete. (It could be replaced by a simple event.)

[Constructor(DOMString type)]
interface MediaKeyCompleteEvent : Event {
};
Finally, the following event would be fired at MediaKeySession if
getKeyRequest() or addKey() results in an error.

[Constructor(DOMString type, optional MediaKeyErrorEventInit eventInitDict)]
interface MediaKeyErrorEvent : Event {
    readonly attribute MediaKeyError errorCode;
    readonly attribute unsigned short systemCode;
};

dictionary MediaKeyErrorEventInit : EventInit  {
    MediaKeyError errorCode;
    unsigned short systemCode;
};

-- 
Configure bugmail: https://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

Received on Wednesday, 4 April 2012 04:12:09 UTC