- From: Xiaohan Wang via GitHub <sysbot+gh@w3.org>
- Date: Fri, 17 Jul 2020 23:33:00 +0000
- To: public-html-media@w3.org
xhwang-chromium has just created a new issue for https://github.com/w3c/encrypted-media: == Handling hardware context reset == ## Problem During a playback with hardware-backed media pipeline and CDM, if the device enters sleep or hibernate mode and then resumes, or in some cases when user switches monitors, the hardware context could be completely lost. In this case the playback cannot continue. On different systems with different media pipeline and CDM implementations, the observable behavior to the JavaScript player could be very different. It could be a `MediaError` on the media element with some platform-specific `MediaError.message`, a zombie `MediaKeySession` on which all subsequent EME calls rejected, a closed `MediaKeySession`, or some combination of them. This makes it hard for the JavaScript player to react in an interoperable way to provide a good user experience. ## Proposal - Change EME `MediaKeySession` `closed` attribute to return a `Promise<Reason>` instead of `Promise<void>`, where `Reason` is an enum, e.g. `HARDWARE_CONTEXT_RESET`. This change is backward compatible with the current `closed` attribute that returns `Promise<void>`. - The media element will fire a `waitingforkey` event and the playback may stall. - The JavaScript player should handle the session `closed` event(s) to resume playback. For example: - Recreate `MediaKeySession` and obtain the license. Once the keys are usable, playback will resume automatically, or - Restart the whole playback, including creating a new media element and an `MediaKeys` object. ## Notes The current EME spec already mentioned that the CDM can close a session at any point: > The CDM may close a session at any point, such as when the session is no longer needed or when system resources are lost. In that case, the Monitor for CDM Changes algorithm detects the change and runs this algorithm. However, this is only in a _NOTE_ which is often overlooked by CDM or JavaScript developers. We should explicitly document the logic around spontaneous session close and hardware context reset, e.g., via a dedicated section and/or with an example. Please view or discuss this issue at https://github.com/w3c/encrypted-media/issues/473 using your GitHub account
Received on Friday, 17 July 2020 23:33:03 UTC