Skip to content

Wiseplay support with videojs #154

@djpavlovic

Description

@djpavlovic

Hi, can you please add support (or any kind of skipping) for wiseplay in playlist?

example:

var wisePlayUri = 'urn:uuid:3d5e6d35-9b9a-41e8-b843-dd3c6e72c42c';
var widevineUuid = 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed'; // group segments into numbered timelines delineated by discontinuities`

if (entry.attributes.KEYFORMAT === wisePlayUri) {
  this.trigger('warn', {
    message: 'wiseplay support should be implemented!'
  });
  return;
}

if (entry.attributes.KEYFORMAT === widevineUuid) {
  var VALID_METHODS = ['SAMPLE-AES', 'SAMPLE-AES-CTR', 'SAMPLE-AES-CENC'];

  if (VALID_METHODS.indexOf(entry.attributes.METHOD) === -1) {
    this.trigger('warn', {
      message: 'invalid key method provided for Widevine'
    });
    return;
  }

  if (entry.attributes.METHOD === 'SAMPLE-AES-CENC') {
    this.trigger('warn', {
      message: 'SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead'
    });
  }

  if (entry.attributes.URI.substring(0, 23) !== 'data:text/plain;base64,') {
    this.trigger('warn', {
      message: 'invalid key URI provided for Widevine'
    });
    return;
  }

  if (!(entry.attributes.KEYID && entry.attributes.KEYID.substring(0, 2) === '0x')) {
    this.trigger('warn', {
      message: 'invalid key ID provided for Widevine'
    });
    return;
  }
  // if Widevine key attributes are valid, store them as `contentProtection`
  // on the manifest to emulate Widevine tag structure in a DASH mpd


  this.manifest.contentProtection = this.manifest.contentProtection || {};
  this.manifest.contentProtection['com.widevine.alpha'] = {
    attributes: {
      schemeIdUri: entry.attributes.KEYFORMAT,
      // remove '0x' from the key id string
      keyId: entry.attributes.KEYID.substring(2)
    },
    // decode the base64-encoded PSSH box
    pssh: decodeB64ToUint8Array(entry.attributes.URI.split(',')[1])
  };
  console.debug('::: ', this.manifest.contentProtection['com.widevine.alpha'])
  return;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions