Unable to play DRM Video with React Native Video DRM Fork in Android

1.3k Views Asked by At

I am trying to play any DRM stream using the React Native DRM Fork. Unfortunately when I using the following code snippet in Android, I get the following error: -

code snippet: -

<Video
  source={{uri: 'https://storage.googleapis.com/wvmedia/cenc/h264/tears/tears.mpd'}}
  drm={{
     type: 'widevine',
     licenseServer:
          'https://proxy.uat.widevine.com/proxy?video_id=efd045b1eb61888a&provider=widevine_test',
  }}
  style={styles.video}
/>

Error in Android Logcat : -

E/MediaPlayerNative: error (1, -2147483648)
E/MediaPlayer: Error (1,-2147483648)

I have also tried the following code with the same result : -

<Video
  source={{ uri: 'https://storage.googleapis.com/wvmedia/cenc/h264/tears/tears.mpd',
   drm: {
     type: 'widevine',
     licenseServer: 'https://proxy.uat.widevine.com/proxy?video_id=efd045b1eb61888a&provider=widevine_test', 
  }}
  style={styles.video}
/>

Any non DRM'ed video plays fine :)

2

There are 2 best solutions below

0
On

Debugging DRM and video can be tricky as the error codes are not always very useful as you have seen. It is often useful to try the video in other players also, if the access to that video allows this - e.g. if there is no user login required to view the video for example.

For the above manifest and LA URL combination above, when tested like this, it, there are errors generated in other players also. Some easy ones to test on include:

You can view error reports in the developer console also, and these often give more information.

For your case it appears from testing with the above that the DRM license response is indicating some restrictions - these could be with the device's security level for example. If you have other content you can test with also you can verify this by confirming it works both on the above and with your code.

0
On

It was due to exoplayer not being properly linked, in my case I had to link exoplayer manually and then add the following json in react-native.config.js

module.exports = {
  dependencies: {
    'react-native-video': {
      platforms: {
        android: null,
      },
    },
  },
};