VEX-7093: Protect initialization of DRM (#29)
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
This commit is contained in:
@@ -632,6 +632,16 @@ class ReactExoplayerView extends FrameLayout implements
|
||||
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);
|
||||
|
Reference in New Issue
Block a user