It's noted in createSession() step 4.2 that the session ID may be assigned by the CDM. It is also assigned by the CDM in the proposed method for retrieval of sessions associated with deleted keys (see https://www.w3.org/Bugs/Public/show_bug.cgi?id=17199).
This means the assignment of the sessionID may happen asynchronously.
I propose we specify that the sessionId may be null when the MediaKeySession is first created and MUST be assigned before the first event is fired on the MediaKeySession.
Even ignoring bug 17199, there may be concern about synchronously generating the session ID in the CDM. It is nice to have a simple rule (sessionId is always valid), but I don't know how practical that is for implementations.
Barring that, maybe we can say it must be valid before the first event is fired at the object.
Agreed on in the 3/26 call. Mark to update the draft to state that session ID will be set before the first keymessage. In other words, it may be set asynchronously.
March 26th telecon minutes: http://www.w3.org/2013/03/26-html-media-minutes.html#item05
The discussion included discussion of state(s) and event(s). I think we should resolve the state/event discussion in bug 20688 before defining when sessionId is valid.
I think that the "initialized" state that we discussed as part of the session life cycle discussion in the F2F might be the one where sessionID is established.
The states and session life cycle are tracked in bug 21854. We will address this after or as part of that bug.
I have changes to address this.
I made sessionID assignment asynchronous in https://dvcs.w3.org/hg/html-media/rev/cc4f10560960
More tweaks in https://dvcs.w3.org/hg/html-media/rev/7c4bb47218ce