Skip to content

Commit

Permalink
VEX-7093: Protect initialization of DRM (#29)
Browse files Browse the repository at this point in the history
This PR will fix the crash from the experiment on react-native-video

Jira: VEX-7093

velocity PR: crunchyroll/velocity#2443

The crash was caused by using the player object before it was set by another thread, the change simply waits for the player to be available before executing any player interaction after DRM initialization.

Reviews
Major reviewer (domain expert): @jctorresM
Minor reviewer: @jacob-livingston
  • Loading branch information
gabriel-rivero committed Apr 29, 2022
1 parent f6e9cc8 commit b274541
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,16 @@ private void initializePlayerSource(ReactExoplayerView self, DrmSessionManager d
mediaSource = new MergingMediaSource(textSourceArray);
}

// wait for player to be set
while (player == null) {
try {
wait();
} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
Log.e("ExoPlayer Exception", ex.toString());
}
}

boolean haveResumePosition = resumeWindow != C.INDEX_UNSET;
if (haveResumePosition) {
player.seekTo(resumeWindow, resumePosition);
Expand Down

0 comments on commit b274541

Please sign in to comment.