Skip to content

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