To allow playback of encrypted audio and video, Encrypted Media Extensions provides an API that enables web applications to interact with content protection systems.
It works by connecting an existing underlying Digital Rights Management (DRM) system in the underlying platform.
It is hoped by recommending EME, we can form a simple, easy to use way of putting encrypted content online, so that there will be interoperability between browsers. This makes it easier for web developers and also for users. Moreover, since more people spend more time on the web, they like to be able to link to it. They like to be able to embed Netflix content in their own web pages and they also should be able to link to it. It is important for users to have discussions about the content, such as where their comments and the content can all be linked to.
Some people are wondering whether they could put the content on the web without DRM. He answer is absolutely yes, in fact, some video content is on the web without DRM.
Given DRM is a thing
How Does EME work?
- A web application attempts to play audio or video that has one or more encrypted streams.
- The browser recognizes that the media is encrypted and fires an encrypted event with metadata (initData) obtained from the media about the encryption.
- The encrypted event is handled the application:
- First select an available Key System by using requestMediaKeySystemAccess() to check what Key Systems are available, if no MediaKeys object has been associated with the media element. Then create a MediaKeys object for an available Key System via a MediaKeySystemAccess object. Note that encrypted event should happens after the initialization of the MediaKeys object. Getting a license server URL is done by the app independently of selecting an available key system. To decrypt the media for an audio or video element, a MediaKeys object represents all the keys available. It presents access to the CDM, especially if you want to create key sessions. The key sessions are used to obtain keys from a license server.
- After the MediaKeys object has been created, you can assign it to the media element: setMediaKeys() associates the MediaKeys object with an HTMLMediaElement, so that its keys can be used during playback, i.e. during decoding.
- By calling createSession() on the MediaKeys, the app creates a This creates a MediaKeySession, which represents the lifetime of a license and its key(s).
- By passing the media data obtained in the encrypted handler to the CDM, the app generates a license request.
- The CDM fires a message event: a request to acquire a key from a license server.
- After the MediaKeySession object receives the message event, then the application sends a message to the license server (via XHR).
- After a response is received by the application from the license server and passes the data to the CDM using the update()method of the MediaKeySession.
- Using the keys in the license, the CDM decrypts the media. From any session within the MediaKeys associated with the media element. The CDM will access the key and policy, indexed by Key ID.
- Media playback resumes.