Skip to main content

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

The browser vendors would just make EME outside W3C, if W3C did not recommend EME. If EME did not exist, vendors could just create new JavaScript based versions. It is so easy to invite ones viewers to switching to view the content on a proprietary app, and without using the web at all.

How Does EME work?

  1. A web application attempts to play audio or video that has one or more encrypted streams.
  2. The browser recognizes that the media is encrypted and fires an encrypted event with metadata (initData) obtained from the media about the encryption.
  3. The encrypted event is handled the application:
  4. 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.
  5. 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.
  6. 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).
  7. By passing the media data obtained in the encrypted handler to the CDM, the app generates a license request.
  8. The CDM fires a message event: a request to acquire a key from a license server.
  9. After the MediaKeySession object receives the message event, then the application sends a message to the license server (via XHR).
  10. 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.
  11. 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.
  12. Media playback resumes.