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

Pass contentId to onGetLicense #8

Open
wants to merge 1 commit into
base: feature/ios-drm-support
Choose a base branch
from

Conversation

yurtaev
Copy link

@yurtaev yurtaev commented Oct 7, 2019

Some DRM providers require contentID for the license request.

Example for BuyDRM https://github.com/yurtaev/react-native-video/blob/example%2FDRM/storybook/stories/DRMExample/index.ios.js#L20

const getLicense = async ({ spcBase64, contentId }, props) => {
  const {
    drm: { headers },
  } = props

  const data = `spc=${spcBase64}&assetId=${contentId}`

  const response = await fetch('https://fp-keyos.licensekeyserver.com/getkey/', {
    method: 'POST',
    headers,
    body: data,
  })

  const key = await response.text()
  return key
}

@sanjeevghimire
Copy link

I am using DRM provider and I am getting this error. This was working fine before:
the code in react native is:

return (
      <>
        <VideoPlayer
          ignoreSilentSwitch={'ignore'}
          onBack={this.goBack}
          videoInfo={toJS(videoDetails)}
          dash_auth_xml={this.state.dashXml}
          videoUrl={dashUrl}
          source={{
            uri: url,
          }}
          drm={{
            type: 'fairplay',
            certificateUrl:
              'https://hhhhhh.der',
            headers: {
              customdata: xml,
            },
            getLicense: (spc, contentId, spcBase64) => {
              console.log(spcBase64);
              console.log(contentId);
              return fetch('https://fp-keyos.licensekeyserver.com/getkey/', {
                method: 'POST',
                headers: {
                  'Content-Type': 'application/octet-stream',
                  customdata: xml,
                },
                body: `spc=${spcBase64}&assetId=${contentId}`,
              }).then((r) => r.text());
            },
          }}
        />
      </>
    );
2020-07-19 01:12:48.841489-0500 Chalchitra[12218:5892588] *** Terminating app due to uncaught exception 
'NSInvalidArgumentException', reason: '*** -[AVAssetResourceLoadingRequest 
streamingContentKeyRequestDataForApp:contentIdentifier:options:error:] invalid parameter not satisfying: 
contentIdentifier != nil'
*** First throw call stack:

Any idea what this issue might be?

alexejh pushed a commit to simpleTechs/react-native-video that referenced this pull request Jul 29, 2022
Add support for detecting if format is supported and exclude unsupported resolutions from auto quality selection and video track info in RN.
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

Successfully merging this pull request may close these issues.

2 participants