Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wiseplay support with videojs #154

Open
djpavlovic opened this issue Aug 23, 2022 · 3 comments
Open

Wiseplay support with videojs #154

djpavlovic opened this issue Aug 23, 2022 · 3 comments

Comments

@djpavlovic
Copy link

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;
}
@djpavlovic
Copy link
Author

For maintainers:
Please take a look at #155 where PR has fixing this issue.

@djpavlovic
Copy link
Author

@gkatsev can you please take a look at this issue, thanks

@djpavlovic
Copy link
Author

anyone can look into this please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant