UNPKG

videojs-contrib-eme

Version:

Supports Encrypted Media Extensions for playback of encrypted content in Video.js

15 lines (11 loc) 296 B
const stringToArrayBuffer = (string) => { const buffer = new ArrayBuffer(string.length * 2); const typedArray = new Uint16Array(buffer); for (let i = 0; i < string.length; i++) { typedArray[i] = string.charCodeAt(i); } return buffer; }; export default { stringToArrayBuffer };