JavaScript How do I play back CENC-encrypted MP4 video using the HTML5 <video> tag?

I'm trying to play a video that I've CENC-encrypted using MP4box with these options:

MP4Box -crypt drm_file_gpac_clear.xml BigBuckBunny.mp4 -out BigBuckBunny_cenc.mp4

Where the XML file specifies clearKey encryption. It's taken from GPAC's website https://gpac.wp.mines-telecom.fr/mp4box/encryption/common-encryption/

<?xml version="1.0" encoding="UTF-8"?>
<GPACDRM type="CENC AES-CTR">
<DRMInfo type="pssh" version="1" cypherOffset="9" cypherKey="0x6770616363656E6364726D746F6F6C31" cypherIV="0x00000000000000000000000000000001">
<BS ID128="0x6770616363656E6364726D746F6F6C31"/>
<BS value="2" bits="32"/>
<BS ID128="0x279926496a7f5d25da69f2b3b2799a7f"/>
<BS ID128="0x676cb88f302d10227992649885984045"/>
<BS bits="8" string="CID=Toto"/>
<BS ID128="0xccc0f2b3b279926496a7f5d25da692f6"/>
<BS ID128="0xccc0f2b3b279926496a7f5d25da692d6"/>
</DRMInfo>
<CrypTrack trackID="1" IsEncrypted="1" IV_size="16" first_IV="0x0a610676cb88f302d10ac8bc66e039ed" saiSavedBox="senc">
<key KID="0x279926496a7f5d25da69f2b3b2799a7f" value="0xccc0f2b3b279926496a7f5d25da692f6"/>
</CrypTrack>
</GPACDRM>

To play this back, I have an HTML file which includes:

<video  autoplay id="video1" controls src="BigBuckBunny_cenc.mp4" type="video/mp4"></video>

And JS:

var KEY = new Uint8Array([
  0xcc, 0xc0, 0xf2, 0xb3, 0xb2, 0x79, 0x92, 0x64,   // this is key for MP4 file
  0x96, 0xa7, 0xf5, 0xd2, 0x5d, 0xa6, 0x92, 0xf6    // encrypted with drm_file_gpac_clear.xml
]);

var config = [
  {
    initDataType: "cenc",
    videoType: "video/mp4",
  }
];

var video = document.getElementById('video1');
video.addEventListener('encrypted', handleEncrypted, false);

Plus other code which isn't relevant here, because my problem is that the 'encrypted' event isn't fired.

This plays fine if I put an unencrypted file in place of the encrypted one, and it also plays fine if I substitute a WEBM file from http://simpl.info/eme/clearkey/ and change the key and config accordingly ("view page source" on that URL for the details). So it will play back an encrypted file (in this case the 'encrypted' event is fired, of course), but not one I've encrypted with MP4box.

I've tried it in IE 11.0.9600.18036, Firefox 41.0, Chrome 45.0.2454.93 m and Chrome 47.0.2516.0 canary (64-bit).

I had a look at the MP4 file with MP4 Explorer, and it has the boxes I've been told to expect, such as encv, sinf and schm.

I've only been trying to learn about CENC during the last few weeks so this is all comparatively new, and I may have made some obvious mistake. If anyone can help, I'd be grateful for any advice.

Answer:1

I am using axios for AJAX in Vue. In the article written by You, he mentioned that we can set Vue.prototype.$http = axios and I can use this.$http in Vue instance. It works fine. However, if I want ...

I am using axios for AJAX in Vue. In the article written by You, he mentioned that we can set Vue.prototype.$http = axios and I can use this.$http in Vue instance. It works fine. However, if I want ...

  1. create instance axios
  2. create axios instance react
  3. create axios instance vue

I am trying to add 10 number(digit) in each element using map function on button click.I tried like this <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <...

I am trying to add 10 number(digit) in each element using map function on button click.I tried like this <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <...

from the lodash documentation: Throttle Creates a throttled function that only invokes func at most once per every wait milliseconds Debounce Creates a debounced function that delays ...

from the lodash documentation: Throttle Creates a throttled function that only invokes func at most once per every wait milliseconds Debounce Creates a debounced function that delays ...

  1. difference between throttle and debounce
  2. difference between throttle body cleaner and carb cleaner
  3. difference between throttle and choke
  4. difference between throttle body and fuel injection
  5. difference between throttle body and carburetor
  6. difference between throttle body and carburetor cleaner
  7. difference between throttle and accelerator
  8. difference between throttle and nozzle
  9. difference between throttle governing and nozzle governing
  10. difference between throttle body and egr valve
  11. difference between throttle and idle cable
  12. difference between throttling and expansion valve
  13. difference between throttle body cleaner and brake cleaner
  14. difference between throttle and mixture
  15. difference between throttle and pedal assist
  16. difference between throttle valve and butterfly valve
  17. difference between throttle and thrust
  18. difference between throttle and strangle
  19. difference between throttle and propeller
  20. difference between throttle body and fuel injector

I have to automate a web-application, which contains a drag and drop area for uploading files from the local file system. My test environment is developed using Python. For the automation tests I have ...

I have to automate a web-application, which contains a drag and drop area for uploading files from the local file system. My test environment is developed using Python. For the automation tests I have ...

  1. python with selenium tutorial
  2. python with selenium examples
  3. python with selenium interview questions
  4. python with selenium jobs
  5. python with selenium syllabus
  6. python with selenium course
  7. python with selenium testing
  8. python with selenium project