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

[BUG]: Android TV and Android Mobile CryptoException when play m3u8 hls with DRM #3942

Closed
DidRanyeStudyToday opened this issue Jun 25, 2024 · 8 comments · Fixed by #3867
Closed

Comments

@DidRanyeStudyToday
Copy link

DidRanyeStudyToday commented Jun 25, 2024

Version

6.3.0

What platforms are you having the problem on?

Android, Android TV

System Version

Galaxy Z Flip: Android 12, One UI 4.1; ChromeCast: Android TV OS version 12

On what device are you experiencing the issue?

Real device

Architecture

New architecture with interop layer

What happened?

We tryed to play a m3u8 HLS with DRM but failed, both in Android TV and Android Mobile. The source uri + licenseServer uri can be played on shaka, so these two value is okay. the log is as follows:

on Android TV(ChromeCast):

 LOG  {"error": {"errorCode": "21000", "errorException": "androidx.media3.exoplayer.ExoPlaybackException: Unexpected runtime error", "errorStackTrace": "androidx.media3.exoplayer.ExoPlaybackException: Unexpected runtime error
        at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:668)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loopOnce(Looper.java:201)
        at android.os.Looper.loop(Looper.java:288)
        at android.os.HandlerThread.run(HandlerThread.java:67)
Caused by: android.media.MediaCodec$CryptoException: Crypto key not available: 1 (Unknown error -1)
============================== Beginning of DRM Plugin Log ==============================
  06-25 02:12:29.754 I found instance=castkey [email protected]::IDrmFactory
  06-25 02:12:29.754 I found instance=clearkey [email protected]::IDrmFactory
  06-25 02:12:29.754 I found instance=default [email protected]::IDrmFactory
  06-25 02:12:29.754 I found instance=netflix [email protected]::IDrmFactory
  06-25 02:12:29.754 I found instance=playready [email protected]::IDrmFactory
  06-25 02:12:29.754 I found instance=widevine [email protected]::IDrmFactory
  06-25 02:20:38.292 I [cdm_engine.cpp(235):CloseSession] session_id = sid9
  06-25 02:20:42.617 I [file_utils.cpp(40):Exists] stat failed: ENOENT
  06-25 02:20:42.618 I [file_utils.cpp(40):Exists] stat failed: ENOENT
  06-25 02:20:42.619 I [file_utils.cpp(40):Exists] stat failed: ENOENT
  06-25 02:20:42.620 I [file_utils.cpp(40):Exists] stat failed: ENOENT
  06-25 02:20:42.621 I [file_utils.cpp(40):Exists] stat failed: ENOENT
  06-25 02:20:42.621 I [cdm_engine.cpp(190):OpenSession] New session: session_id = sid10
  06-25 02:20:42.621 I [cdm_engine.cpp(940):QueryOemCryptoSessionId] session_id = sid10
  06-25 02:20:42.623 I [cdm_engine.cpp(2055):SetPlaybackId] session_id = sid10, playback_id = BuAjKY1zAkyLR9di
  06-25 02:20:42.627 I [cdm_engine.cpp(277):GenerateKeyRequest] session_id = sid10, key_set_id = <empty>, license_type = Streaming
  06-25 02:20:42.627 I [file_utils.cpp(40):Exists] stat failed: ENOENT
  06-25 02:20:42.627 I [file_utils.cpp(40):Exists] stat failed: ENOENT
  06-25 02:20:42.676 I [cdm_engine.cpp(845):QuerySessionStatus] session_id = sid10
  06-25 02:20:43.820 I [cdm_engine.cpp(356):AddKey] session_id = sid10, key_set_id = <empty>
  06-25 02:20:43.846 E [policy_engine.cpp(51):CanDecryptContent] Provided content key is not in license: key_id = E18D47DADECC47CBA1E8708E9E1C798A
  06-25 02:20:43.863 E [policy_engine.cpp(51):CanDecryptContent] Provided content key is not in license: key_id = E18D47DADECC47CBA1E8708E9E1C798A
  06-25 02:20:43.872 E [policy_engine.cpp(51):CanDecryptContent] Provided content key is not in license: key_id = E18D47DADECC47CBA1E8708E9E1C798A
  06-25 02:20:43.885 E [policy_engine.cpp(51):CanDecryptContent] Provided content key is not in license: key_id = E18D47DADECC47CBA1E8708E9E1C798A
  06-25 02:20:43.933 I [cdm_engine.cpp(235):CloseSession] session_id = sid10
  06-25 02:29:14.514 I [file_utils.cpp(40):Exists] stat failed: ENOENT
  06-25 02:29:14.517 I [file_utils.cpp(40):Exists] stat failed: ENOENT
  06-25 02:29:14.518 I [file_utils.cpp(40):Exists] stat failed: ENOENT
  06-25 02:29:14.519 I [file_utils.cpp(40):Exists] stat failed: ENOENT
  06-25 02:29:14.519 I [file_utils.cpp(40):Exists] stat failed: ENOENT
  06-25 02:29:14.519 I [cdm_engine.cpp(190):OpenSession] New session: session_id = sid11
  06-25 02:29:14.519 I [cdm_engine.cpp(940):QueryOemCryptoSessionId] session_id = sid11
  06-25 02:29:14.523 I [cdm_engine.cpp(2055):SetPlaybackId] session_id = sid11, playback_id = y0S0dkeAB6LwL2Lo
  06-25 02:29:14.527 I [cdm_engine.cpp(277):GenerateKeyRequest] session_id = sid11, key_set_id = <empty>, license_type = Streaming
  06-25 02:29:14.528 I [file_utils.cpp(40):Exists] stat failed: ENOENT
  06-25 02:29:14.528 I [file_utils.cpp(40):Exists] stat failed: ENOENT
  06-25 02:29:14.617 I [cdm_engine.cpp(845):QuerySessionStatus] session_id = sid11
  06-25 02:29:15.165 I [cdm_engine.cpp(235):CloseSession] session_id = sid11
  06-25 04:22:22.034 I [file_utils.cpp(40):Exists] stat failed: ENOENT
  06-25 04:22:22.035 I [file_utils.cpp(40):Exists] stat failed: ENOENT
  06-25 04:22:22.036 I [file_utils.cpp(40):Exists] stat failed: ENOENT
  06-25 04:22:22.037 I [file_utils.cpp(40):Exists] stat failed: ENOENT
  06-25 04:22:22.037 I [file_utils.cpp(40):Exists] stat failed: ENOENT
  06-25 04:22:22.037 I [cdm_engine.cpp(190):OpenSession] New session: session_id = sid12
  06-25 04:22:22.037 I [cdm_engine.cpp(940):QueryOemCryptoSessionId] session_id = sid12
  06-25 04:22:22.039 I [cdm_engine.cpp(2055):SetPlaybackId] session_id = sid12, playback_id = aMLLDj8iS9bJ048M
  06-25 04:22:22.050 I [cdm_engine.cpp(277):GenerateKeyRequest] session_id = sid12, key_set_id = <empty>, license_type = Streaming
  06-25 04:22:22.050 I [file_utils.cpp(40):Exists] stat failed: ENOENT
  06-25 04:22:22.050 I [file_utils.cpp(40):Exists] stat failed: ENOENT
  06-25 04:22:22.098 I [cdm_engine.cpp(845):QuerySessionStatus] session_id = sid12
  06-25 04:22:23.244 I [cdm_engine.cpp(356):AddKey] session_id = sid12, key_set_id = <empty>
  06-25 04:22:23.720 E [policy_engine.cpp(51):CanDecryptContent] Provided content key is not in license: key_id = E18D47DADECC47CBA1E8708E9E1C798A
  06-25 04:22:23.728 E [policy_engine.cpp(51):CanDecryptContent] Provided content key is not in license: key_id = E18D47DADECC47CBA1E8708E9E1C798A
  06-25 04:22:23.741 E [policy_engine.cpp(51):CanDecryptContent] Provided content key is not in license: key_id = E18D47DADECC47CBA1E8708E9E1C798A
  06-25 04:22:23.748 E [policy_engine.cpp(51):CanDecryptContent] Provided content key is not in license: key_id = E18D47DADECC47CBA1E8708E9E1C798A
  06-25 04:22:23.795 I [cdm_engine.cpp(235):CloseSession] session_id = sid12
  06-25 05:30:54.748 I [file_utils.cpp(40):Exists] stat failed: ENOENT
  06-25 05:30:54.749 I [file_utils.cpp(40):Exists] stat failed: ENOENT
  06-25 05:30:54.750 I [file_utils.cpp(40):Exists] stat failed: ENOENT
  06-25 05:30:54.751 I [file_utils.cpp(40):Exists] stat failed: ENOENT
  06-25 05:30:54.752 I [file_utils.cpp(40):Exists] stat failed: ENOENT
  06-25 05:30:54.752 I [cdm_engine.cpp(190):OpenSession] New session: session_id = sid13
  06-25 05:30:54.752 I [cdm_engine.cpp(940):QueryOemCryptoSessionId] session_id = sid13
  06-25 05:30:54.757 I [cdm_engine.cpp(2055):SetPlaybackId] session_id = sid13, playback_id = c9Gzq47fDHOjS0cm
  06-25 05:30:54.767 I [cdm_engine.cpp(277):GenerateKeyRequest] session_id = sid13, key_set_id = <empty>, license_type = Streaming
  06-25 05:30:54.767 I [file_utils.cpp(40):Exists] stat failed: ENOENT
  06-25 05:30:54.767 I [file_utils.cpp(40):Exists] stat failed: ENOENT
  06-25 05:30:54.862 I [cdm_engine.cpp(845):QuerySessionStatus] session_id = sid13
  06-25 05:30:56.181 I [cdm_engine.cpp(356):AddKey] session_id = sid13, key_set_id = <empty>
  06-25 05:30:56.268 E [policy_engine.cpp(51):CanDecryptContent] Provided content key is not in license: key_id = E18D47DADECC47CBA1E8708E9E1C798A
  06-25 05:30:56.278 E [policy_engine.cpp(51):CanDecryptContent] Provided content key is not in license: key_id = E18D47DADECC47CBA1E8708E9E1C798A
  06-25 05:30:56.288 E [policy_engine.cpp(51):CanDecryptContent] Provided content key is not in license: key_id = E18D47DADECC47CBA1E8708E9E1C798A
  06-25 05:30:56.293 E [policy_engine.cpp(51):CanDecryptContent] Provided content key is not in license: key_id = E18D47DADECC47CBA1E8708E9E1C798A
  06-25 05:30:56.349 I [cdm_engine.cpp(235):CloseSession] session_id = sid13
  06-25 05:57:32.363 I [file_utils.cpp(40):Exists] stat failed: ENOENT
  06-25 05:57:32.364 I [file_utils.cpp(40):Exists] stat failed: ENOENT
  06-25 05:57:32.366 I [file_utils.cpp(40):Exists] stat failed: ENOENT
  06-25 05:57:32.367 I [file_utils.cpp(40):Exists] stat failed: ENOENT
  06-25 05:57:32.367 I [file_utils.cpp(40):Exists] stat failed: ENOENT
  06-25 05:57:32.367 I [cdm_engine.cpp(190):OpenSession] New session: session_id = sid14
  06-25 05:57:32.368 I [cdm_engine.cpp(940):QueryOemCryptoSessionId] session_id = sid14
  06-25 05:57:32.370 I [cdm_engine.cpp(2055):SetPlaybackId] session_id = sid14, playback_id = Z9Sl3LKJQ36H0WHt
  06-25 05:57:32.374 I [cdm_engine.cpp(277):GenerateKeyRequest] session_id = sid14, key_set_id = <empty>, license_type = Streaming
  06-25 05:57:32.374 I [file_utils.cpp(40):Exists] stat failed: ENOENT
  06-25 05:57:32.374 I [file_utils.cpp(40):Exists] stat failed: ENOENT
  06-25 05:57:32.475 I [cdm_engine.cpp(845):QuerySessionStatus] session_id = sid14
  06-25 05:57:33.841 I [cdm_engine.cpp(356):AddKey] session_id = sid14, key_set_id = <empty>
  06-25 05:57:34.227 E [policy_engine.cpp(51):CanDecryptContent] Provided content key is not in license: key_id = E18D47DADECC47CBA1E8708E9E1C798A
  06-25 05:57:34.235 E [policy_engine.cpp(51):CanDecryptContent] Provided content key is not in license: key_id = E18D47DADECC47CBA1E8708E9E1C798A
  06-25 05:57:34.243 E [policy_engine.cpp(51):CanDecryptContent] Provided content key is not in license: key_id = E18D47DADECC47CBA1E8708E9E1C798A
  06-25 05:57:34.256 E [policy_engine.cpp(51):CanDecryptContent] Provided content key is not in license: key_id = E18D47DADECC47CBA1E8708E9E1C798A
  06-25 05:57:34.305 I [cdm_engine.cpp(235):CloseSession] session_id = sid14
  06-25 05:58:35.076 I [file_utils.cpp(40):Exists] stat failed: ENOENT
  06-25 05:58:35.077 I [file_utils.cpp(40):Exists] stat failed: ENOENT
  06-25 05:58:35.078 I [file_utils.cpp(40):Exists] stat failed: ENOENT
  06-25 05:58:35.079 I [file_utils.cpp(40):Exists] stat failed: ENOENT
  06-25 05:58:35.080 I [file_utils.cpp(40):Exists] stat failed: ENOENT
  06-25 05:58:35.080 I [cdm_engine.cpp(190):OpenSession] New session: session_id = sid15
  06-25 05:58:35.080 I [cdm_engine.cpp(940):QueryOemCryptoSessionId] session_id = sid15
  06-25 05:58:35.083 I [cdm_engine.cpp(2055):SetPlaybackId] session_id = sid15, playback_id = tw85rcYJgzaIbaRJ
  06-25 05:58:35.086 I [cdm_engine.cpp(277):GenerateKeyRequest] session_id = sid15, key_set_id = <empty>, license_type = Streaming
  06-25 05:58:35.086 I [file_utils.cpp(40):Exists] stat failed: ENOENT
  06-25 05:58:35.086 I [file_utils.cpp(40):Exists] stat failed: ENOENT
  06-25 05:58:35.131 I [cdm_engine.cpp(845):QuerySessionStatus] session_id = sid15
  06-25 05:58:35.433 I [cdm_engine.cpp(356):AddKey] session_id = sid15, key_set_id = <empty>
  06-25 05:58:36.693 E [policy_engine.cpp(51):CanDecryptContent] Provided content key is not in license: key_id = E18D47DADECC47CBA1E8708E9E1C798A
============================== End of DRM Plugin Log ==============================
        at android.media.MediaCodec.native_queueSecureInputBuffer(Native Method)
        at android.media.MediaCodec.queueSecureInputBuffer(MediaCodec.java:2904)
        at androidx.media3.exoplayer.mediacodec.AsynchronousMediaCodecBufferEnqueuer.doQueueSecureInputBuffer(AsynchronousMediaCodecBufferEnqueuer.java:240)
        at androidx.media3.exoplayer.mediacodec.AsynchronousMediaCodecBufferEnqueuer.doHandleMessage(AsynchronousMediaCodecBufferEnqueuer.java:205)
        at androidx.media3.exoplayer.mediacodec.AsynchronousMediaCodecBufferEnqueuer.access$000(AsynchronousMediaCodecBufferEnqueuer.java:47)
        at androidx.media3.exoplayer.mediacodec.AsynchronousMediaCodecBufferEnqueuer$1.handleMessage(AsynchronousMediaCodecBufferEnqueuer.java:96)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        ... 3 more
", "errorString": "ExoPlaybackException: ERROR_CODE_UNSPECIFIED"}}

on Android:

 LOG  {"error": {"errorCode": "21000", "errorException": "androidx.media3.exoplayer.ExoPlaybackException: Unexpected runtime error", "errorStackTrace": "androidx.media3.exoplayer.ExoPlaybackException: Unexpected runtime error
        at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:668)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loopOnce(Looper.java:226)
        at android.os.Looper.loop(Looper.java:313)
        at android.os.HandlerThread.run(HandlerThread.java:67)
Caused by: android.media.MediaCodec$CryptoException: Crypto key not available: 1 (Unknown error -1)
============================== Beginning of DRM Plugin Log ==============================
  06-25 20:24:56.994 I found instance=clearkey [email protected]::IDrmFactory
  06-25 20:24:56.994 I found instance=widevine [email protected]::IDrmFactory
  06-25 20:25:01.891 W Cannot cast [email protected]::IDrmPlugin obj to [email protected]::IDrmPlugin plugin
  06-25 20:25:03.007 W Cannot cast [email protected]::ICryptoPlugin obj to [email protected]::ICryptoPlugin plugin
  06-25 20:25:03.013 W Cannot cast [email protected]::ICryptoPlugin obj to [email protected]::ICryptoPlugin plugin
  06-25 20:25:03.014 W Cannot cast [email protected]::ICryptoPlugin obj to [email protected]::ICryptoPlugin plugin
  06-25 20:25:03.015 W Cannot cast [email protected]::ICryptoPlugin obj to [email protected]::ICryptoPlugin plugin
  06-25 20:56:03.232 W Cannot cast [email protected]::IDrmPlugin obj to [email protected]::IDrmPlugin plugin
  06-25 20:56:05.135 W Cannot cast [email protected]::ICryptoPlugin obj to [email protected]::ICryptoPlugin plugin
============================== End of DRM Plugin Log ==============================
        at android.media.MediaCodec.native_queueSecureInputBuffer(Native Method)
        at android.media.MediaCodec.queueSecureInputBuffer(MediaCodec.java:2904)
        at androidx.media3.exoplayer.mediacodec.AsynchronousMediaCodecBufferEnqueuer.doQueueSecureInputBuffer(AsynchronousMediaCodecBufferEnqueuer.java:240)
        at androidx.media3.exoplayer.mediacodec.AsynchronousMediaCodecBufferEnqueuer.doHandleMessage(AsynchronousMediaCodecBufferEnqueuer.java:205)
        at androidx.media3.exoplayer.mediacodec.AsynchronousMediaCodecBufferEnqueuer.access$000(AsynchronousMediaCodecBufferEnqueuer.java:47)
        at androidx.media3.exoplayer.mediacodec.AsynchronousMediaCodecBufferEnqueuer$1.handleMessage(AsynchronousMediaCodecBufferEnqueuer.java:96)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        ... 3 more
", "errorString": "ExoPlaybackException: ERROR_CODE_UNSPECIFIED"}}

Reproduction

repository link

Reproduction

      <Video
        source={{
          uri: 'xxx',
        }}
        drm={{
          licenseServer: 'xxx',
          type: DRMType.WIDEVINE,
          headers: {
            Authorization:
              'xxx',
          },
        }}
        ref={videoRef}
        style={styles.backgroundVideo}
        paused={paused}
        onProgress={newProgress => {
          setProgress(newProgress);
        }}
        onReadyForDisplay={() => setVideoReady(true)}
        onError={e => console.log(e)}
      />
@DidRanyeStudyToday DidRanyeStudyToday changed the title [BUG]: Android TV and Android Mobile CryptoException when play m3u8 hls [BUG]: Android TV and Android Mobile CryptoException when play m3u8 hls with DRM Jun 26, 2024
@freeboub
Copy link
Collaborator

I don't see any issue with the usage.
To continue investigation you can go in 2 directions:

  • Test with media3 sample -> to see if you can reproduce the same issue
  • Try to use charles proxy to see if any api call are problematic.

I think 1 would be better.
by the way, I suspect an issue with widevine level, but I cannot prove it ...

@DidRanyeStudyToday
Copy link
Author

DidRanyeStudyToday commented Jun 27, 2024

We tryed 1, test with media3 sample, and it works fine. Here is the code for our implementation:

            val activityContext = this@MainActivity
            val player = ExoPlayer.Builder(activityContext).build()
            val playerView = PlayerView(activityContext)
            playerView.player = player
            setContentView(playerView)
            val videoUri =
                "xxx"
            val licenseUri = "xxx"
            val mediaItem =
                MediaItem.Builder()
                    .setUri(videoUri)
                    .setDrmConfiguration(
                        MediaItem.DrmConfiguration.Builder(C.WIDEVINE_UUID)
                            .setLicenseUri(licenseUri)
                            .setMultiSession(true)
                            .build()
                    )
                    .build()
            player.setMediaItem(mediaItem)
            player.prepare()
            player.play()

Does react-native-video do anything beyond these code to play m3u8 hls with DRM?

@freeboub
Copy link
Collaborator

If I remember well, setMultiSession(true) is not called on react native video.
Can you try to patch code to add this call ?

@DidRanyeStudyToday
Copy link
Author

Yes, that's the problem👍 When we delete .setMultiSession(true), the same error is occured as before.

2024-06-27 16:34:39.030 13958-13985 ExoPlayerImplInternal   com.example.webviewtest              E  Playback error
                                                                                                      androidx.media3.exoplayer.ExoPlaybackException: MediaCodecAudioRenderer error, index=1, format=Format(audio_0:eng, eng, null, audio/mp4a-latm, mp4a.40.2, -1, en, [-1, -1, -1.0, null], [2, 48000]), format_supported=YES
                                                                                                          at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:623)
                                                                                                          at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                                          at android.os.Looper.loopOnce(Looper.java:201)
                                                                                                          at android.os.Looper.loop(Looper.java:288)
                                                                                                          at android.os.HandlerThread.run(HandlerThread.java:67)
                                                                                                      Caused by: android.media.MediaCodec$CryptoException: Crypto key not available: 1 (Unknown error -1)
                                                                                                      ============================== Beginning of DRM Plugin Log ==============================
                                                                                                        06-27 01:19:58.031 I [file_utils.cpp(40):Exists] stat failed: ENOENT
                                                                                                        06-27 01:19:58.031 I [file_utils.cpp(40):Exists] stat failed: ENOENT
                                                                                                        06-27 01:19:58.034 I [file_utils.cpp(40):Exists] stat failed: ENOENT
                                                                                                        06-27 01:19:58.034 I [file_utils.cpp(40):Exists] stat failed: ENOENT
                                                                                                        06-27 01:19:58.034 I [file_utils.cpp(40):Exists] stat failed: ENOENT
                                                                                                        06-27 01:19:58.038 I [cdm_engine.cpp(977):GetProvisioningRequest] cert_type = Widevine
                                                                                                        06-27 01:19:58.046 I [file_utils.cpp(40):Exists] stat failed: ENOENT
                                                                                                        06-27 01:19:58.046 I [file_utils.cpp(40):Exists] stat failed: ENOENT
                                                                                                        06-27 01:19:58.366 I [file_utils.cpp(40):Exists] stat failed: ENOENT
                                                                                                        06-27 01:19:58.367 I [file_utils.cpp(40):Exists] stat failed: ENOENT
                                                                                                        06-27 01:19:58.367 I [file_utils.cpp(40):Exists] stat failed: ENOENT
                                                                                                        06-27 01:20:01.610 I [cdm_engine.cpp(1053):HandleProvisioningResponse] response_size = 3940, security_level = Default
                                                                                                        06-27 01:20:01.612 I [file_utils.cpp(40):Exists] stat failed: ENOENT
                                                                                                        06-27 01:20:01.622 I [file_utils.cpp(40):Exists] stat failed: ENOENT
                                                                                                        06-27 01:20:01.623 I [file_utils.cpp(40):Exists] stat failed: ENOENT
                                                                                                        06-27 01:20:01.623 I [cdm_engine.cpp(190):OpenSession] New session: session_id = sid17
                                                                                                        06-27 01:20:01.623 I [file_utils.cpp(40):Exists] stat failed: ENOENT
                                                                                                        06-27 01:20:01.623 I [cdm_engine.cpp(940):QueryOemCryptoSessionId] session_id = sid17
                                                                                                        06-27 01:20:01.628 I [cdm_engine.cpp(2055):SetPlaybackId] session_id = sid17, playback_id = R3-Hol289vvkilhC
                                                                                                        06-27 01:20:01.745 I [cdm_engine.cpp(277):GenerateKeyRequest] session_id = sid17, key_set_id = <empty>, license_type = Streaming
                                                                                                        06-27 01:20:01.745 I [file_utils.cpp(40):Exists] stat failed: ENOENT
                                                                                                        06-27 01:20:01.746 I [file_utils.cpp(40):Exists] stat failed: ENOENT
                                                                                                        06-27 01:20:01.810 I [file_utils.cpp(40):Exists] stat failed: ENOENT
                                                                                                        06-27 01:20:01.811 I [file_utils.cpp(40):Exists] stat failed: ENOENT
                                                                                                        06-27 01:20:01.811 I [cdm_engine.cpp(940):QueryOemCryptoSessionId] session_id = sid18
                                                                                                        06-27 01:20:01.811 I [cdm_engine.cpp(190):OpenSession] New session: session_id = sid18
                                                                                                        06-27 01:20:01.811 I [file_utils.cpp(40):Exists] stat failed: ENOENT
                                                                                                        06-27 01:20:01.814 I [cdm_engine.cpp(2055):SetPlaybackId] session_id = sid18, playback_id = R3-Hol289vvkilhC
                                                                                                        06-27 01:20:01.823 I [file_utils.cpp(40):Exists] stat failed: ENOENT
                                                                                                        06-27 01:20:01.823 I [file_utils.cpp(40):Exists] stat failed: ENOENT
                                                                                                        06-27 01:20:01.823 I [cdm_engine.cpp(277):GenerateKeyRequest] session_id = sid18, key_set_id = <empty>, license_type = Streaming
                                                                                                        06-27 01:20:01.861 I [cdm_engine.cpp(845):QuerySessionStatus] session_id = sid18
                                                                                                        06-27 01:20:04.548 I [cdm_engine.cpp(356):AddKey] session_id = sid18, key_set_id = <empty>
                                                                                                        06-27 01:20:04.846 I [cdm_engine.cpp(356):AddKey] session_id = sid17, key_set_id = <empty>
                                                                                                        06-27 01:33:08.581 I [cdm_engine.cpp(845):QuerySessionStatus] session_id = sid18
                                                                                                        06-27 01:33:43.632 I [cdm_engine.cpp(235):CloseSession] session_id = sid17
                                                                                                        06-27 01:33:43.632 I [cdm_engine.cpp(235):CloseSession] session_id = sid18
                                                                                                        06-27 01:34:25.780 I found instance=castkey [email protected]::IDrmFactory
2024-06-27 16:34:39.030 13958-13985 ExoPlayerImplInternal   com.example.webviewtest              E      06-27 01:34:25.780 I found instance=clearkey [email protected]::IDrmFactory
                                                                                                        06-27 01:34:25.781 I found instance=widevine [email protected]::IDrmFactory
                                                                                                        06-27 01:34:25.781 I found instance=playready [email protected]::IDrmFactory
                                                                                                        06-27 01:34:25.781 I found instance=netflix [email protected]::IDrmFactory
                                                                                                        06-27 01:34:25.781 I found instance=default [email protected]::IDrmFactory
                                                                                                        06-27 01:34:36.731 I [file_utils.cpp(40):Exists] stat failed: ENOENT
                                                                                                        06-27 01:34:36.731 I [file_utils.cpp(40):Exists] stat failed: ENOENT
                                                                                                        06-27 01:34:36.732 I [file_utils.cpp(40):Exists] stat failed: ENOENT
                                                                                                        06-27 01:34:36.733 I [file_utils.cpp(40):Exists] stat failed: ENOENT
                                                                                                        06-27 01:34:36.734 I [file_utils.cpp(40):Exists] stat failed: ENOENT
                                                                                                        06-27 01:34:36.734 I [cdm_engine.cpp(190):OpenSession] New session: session_id = sid19
                                                                                                        06-27 01:34:36.734 I [cdm_engine.cpp(940):QueryOemCryptoSessionId] session_id = sid19
                                                                                                        06-27 01:34:36.739 I [cdm_engine.cpp(2055):SetPlaybackId] session_id = sid19, playback_id = 09jXs1BJxW2xKQN8
                                                                                                        06-27 01:34:36.845 I [cdm_engine.cpp(277):GenerateKeyRequest] session_id = sid19, key_set_id = <empty>, license_type = Streaming
                                                                                                        06-27 01:34:36.845 I [file_utils.cpp(40):Exists] stat failed: ENOENT
                                                                                                        06-27 01:34:36.845 I [file_utils.cpp(40):Exists] stat failed: ENOENT
                                                                                                        06-27 01:34:36.883 I [cdm_engine.cpp(845):QuerySessionStatus] session_id = sid19
                                                                                                        06-27 01:34:38.679 I [cdm_engine.cpp(356):AddKey] session_id = sid19, key_set_id = <empty>
                                                                                                        06-27 01:34:38.891 E [policy_engine.cpp(51):CanDecryptContent] Provided content key is not in license: key_id = E18D47DADECC47CBA1E8708E9E1C798A
                                                                                                      ============================== End of DRM Plugin Log ==============================
                                                                                                          at android.media.MediaCodec.native_queueSecureInputBuffer(Native Method)
                                                                                                          at android.media.MediaCodec.queueSecureInputBuffer(MediaCodec.java:2904)
                                                                                                          at androidx.media3.exoplayer.mediacodec.AsynchronousMediaCodecBufferEnqueuer.doQueueSecureInputBuffer(AsynchronousMediaCodecBufferEnqueuer.java:233)
                                                                                                          at androidx.media3.exoplayer.mediacodec.AsynchronousMediaCodecBufferEnqueuer.doHandleMessage(AsynchronousMediaCodecBufferEnqueuer.java:194)
                                                                                                          at androidx.media3.exoplayer.mediacodec.AsynchronousMediaCodecBufferEnqueuer.access$000(AsynchronousMediaCodecBufferEnqueuer.java:45)
                                                                                                          at androidx.media3.exoplayer.mediacodec.AsynchronousMediaCodecBufferEnqueuer$1.handleMessage(AsynchronousMediaCodecBufferEnqueuer.java:91)
                                                                                                          at android.os.Handler.dispatchMessage(Handler.java:106)
                                                                                                          ... 3 more

Sorry but I don't know much about how to patch react-native-video library, I'm a react native newbie😭, and it seems that when build the release apk, it will re-downloads the dependency (using expo cli), so I'm not sure if the release apk is ok even if in development mode it works

@freeboub
Copy link
Collaborator

@DidRanyeStudyToday you can try with the PR I just open.
I don't like this patch as it will be applied for all apps, I will rework the change to make it dynamic.
patch-package tool is the solution for a quick fix. the native code you will patch is rebuild dynamically so it should be Ok

@freeboub
Copy link
Collaborator

Sorry, I will make a clean PR when I will switch back to: #3867
I will add a new prop to control this multiDrm value from app !

@freeboub freeboub self-assigned this Jun 27, 2024
@DidRanyeStudyToday
Copy link
Author

DidRanyeStudyToday commented Jun 27, 2024

Thank you for your support, We modified ReactExoplayerView.java in node_modules as #3947 , and now the DRM HLS can be played.

Adding a prop to the <Video/> drm is definitely a good idea. In the drm video example of media3, there is an option setMultiSession, so I think it is a very important option for the exoplayer:

https://developer.android.com/media/media3/exoplayer/media-items#protected-content

Looking forward to your version update!

@freeboub
Copy link
Collaborator

freeboub commented Jun 27, 2024

I just updated this PR: #3867
in the futur you will have the enable the flag in drm props
drm={ multiDrm: true ...yourProps }

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