The HTMLMediaElement interface adds to HTMLElement the properties and methods needed to support basic media-related capabilities that are common to audio and video. The HTMLVideoElement and HTMLAudioElement elements both inherit this interface. See https://developer.mozilla.org/en/docs/Web/API/HTMLMediaElement for more info.
We can load, decode and play media simply by providing a src URL:
<video src='foo.webm'></video> |
The Media Source API is an extension to HTMLMediaElement enabling more fine-grained control over the source of media, by allowing JavaScript to build streams for playback from 'chunks' of video. This in turn enables techniques such as adaptive streaming and time shifting. Refer to https://www.w3.org/TR/media-source/ for the full specification.
The idea is to be able to adapt our video streams based on present circumstances, for example fluctuating bandwidth, etc. DASH allows us to dynamically adapt our video streams over time. This can be done in several ways, DASH is one of them. The 2 main other APIs are HTTP Live Streaming (HLS) developed by Apple and Microsoft Smooth Streaming (MSSS) developed by Microsoft. Both HLS and MSSS are proprietary, however, DASH is an open standard due to which it is the most popular (used in Youtube TV for example).
This is where Digital Rights Management (DRM) starts to come in. Simply put, Encrypted Media Extensions (EME) provides an API that enables web applications to interact with content protection systems, to allow playback of encrypted audio and video. It is an extension to the HTMLMediaElement specification, hence the name. There are 2 types of EME support available: prefixed and un-prefixed. EME spec versions 0.1b and earlier are informally called prefixed EME while later implementations are called un-prefixed. This is because function calls in the older versions of the EME spec were prefixed with the browser vendor name (ex: msSetMediaKeys, webkitAddKey, etc) while the newer versions have a universal API which is browser-independent and thus un-prefixed.
Applications that use EME normally have the following components:
Here is a table with a list of the supported key systems for different Vewd Core and EME versions (taken from here):
TVSDK | EME 0.1b | Unprefixed EME (Draft 04 February 2016) |
---|---|---|
4.8.0 | "webkit-org.w3.clearkey" "com.youtube.playready" "com.microsoft.playready" "com.widevine.alpha" | |
4.9.0 | "org.w3.clearkey" "com.youtube.playready" "com.microsoft.playready" "com.widevine.alpha" |
Refer to this excellent article for a more thorough understanding of EME.
Now that you understand how EME works with a Keys system and a License server, it is time to select which licensing technology you want to use:
Vewd based browsers may support both PlayReady and Widevine, depending on capabilities of the platform integration. So your application needs to be tested on each device to make sure DRM playback works on that device. Unfortunately, our 4.x based Emulator does not provide PlayReady or Widevine support at the moment and we recommend testing your application on an Android based device (for example the NVidia Shield and Google Nexus TV) to test these out. Clear Key, however, is always supported internally by the Vewd Core and you can test it on any platform. This information is summarized in the table below:
Clear Key | PlayReady | Widevine | |
---|---|---|---|
Vewd TV Emulator 4.x | ![]() | ![]() | ![]() |
Nvidia Shield/Nexus Player | ![]() | ![]() | ![]() |
Other devices | ![]() | ![]() |
|
Instead of manually initiating streaming and DRM playback methods (like getting keys, licenses, fetching video chunks, etc) in JavaScript, the Vewd Core provides the option of handling this automatically on your behalf for PlayReady videos. The idea is to pass in a manifest file which holds all the information about your audio/video content, and have Vewd automatically handle fetch, decode and playback. Devices that do have support for this feature, have support for the following manifest files:
For example, in order to automatically playback a video via Microsoft Smooth Streaming, the following code should suffice:
<html> <body> <video width="512" height="288" controls autoplay> <source src="http://example.com/video/Manifest"> </video> </body> </html> |
In addition to these streaming technologies, the Vewd Media Player Module also supports using PlayReady Web Initiator. This is described in the next section.
Devices that support the Vewd Media Player Module also support PlayReady Web Initiator, where a license acquisition manifest file is passed as the source of a <source> element. This manifest file in return contains a link to a Microsoft Smooth Streaming (MSSS) manifest file along with the license acquisition information. Below is a simple test case with 2 files: index.html and LicenseAcquisition.xml which can be used to test PlayReady Web Initiator support on your device:
<html> <body> <video autoplay controls id="player" style="width: 100%"> <source src="./LicenseAcquisition.xml" type="application/vnd.ms-playready.initiator+xml"/> </video> </body> <script> var video = document.getElementById('player'); video.onerror = function (err) { console.log(err); }; video.onloadstart = function () { console.log('onloadstart'); }; video.onprogress = function () { console.log('progress') } </script> </html> |
<?xml version="1.0" encoding="utf-8"?> <PlayReadyInitiator xmlns="http://schemas.microsoft.com/DRM/2007/03/protocols/"> <LicenseAcquisition> <Content>http://playready.directtaps.net/smoothstreaming/SSWSS720H264PR/SuperSpeedway_720.ism/Manifest</Content> <Header> <WRMHEADER xmlns="http://schemas.microsoft.com/DRM/2007/03/PlayReadyHeader" version="4.0.0.0"> <DATA> <PROTECTINFO> <KEYLEN>16</KEYLEN> <ALGID>AESCTR</ALGID> </PROTECTINFO> <KID>AmfjCTOPbEOl3WD/5mcecA==</KID> <CHECKSUM>BGw1aYZ1YXM=</CHECKSUM> <CUSTOMATTRIBUTES> <IIS_DRM_VERSION>7.1.1064.0</IIS_DRM_VERSION> </CUSTOMATTRIBUTES> <LA_URL>http://playready.directtaps.net/pr/svc/rightsmanager.asmx</LA_URL> <DS_ID>AH+03juKbUGbHl1V/QIwRA==</DS_ID> </DATA> </WRMHEADER> </Header> </LicenseAcquisition> </PlayReadyInitiator> |
Here is a list of the common problems you might face when adding DRM support into your application:
Problem | Possible Causes | |
---|---|---|
1 | License request is not generated by CDM |
|
2 | License request is rejected by server |
|
3 | License is rejected by CDM |
|
4 | License is acquired correctly but video doesn't play (no decode error) |
|