VEX-7094: Android: Crash in ReactExoplayerView.java Line 694 (#30)
When moving init logic to a different thread we missed one function that was not captured if an error occurred. This PR wraps the source init function that happens on a different thread in a try/catch to capture any errors that occur.
This commit is contained in:
parent
9035e7dfc9
commit
c584022d34
@ -540,8 +540,15 @@ class ReactExoplayerView extends FrameLayout implements
|
|||||||
// Initialize handler to run on the main thread
|
// Initialize handler to run on the main thread
|
||||||
activity.runOnUiThread(new Runnable() {
|
activity.runOnUiThread(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
|
try {
|
||||||
// Source initialization must run on the main thread
|
// Source initialization must run on the main thread
|
||||||
initializePlayerSource(self, drmSessionManager);
|
initializePlayerSource(self, drmSessionManager);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
self.playerNeedsSource = true;
|
||||||
|
Log.e("ExoPlayer Exception", "Failed to initialize Player!");
|
||||||
|
Log.e("ExoPlayer Exception", ex.toString());
|
||||||
|
self.eventEmitter.error(ex.toString(), ex, "1001");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -620,7 +627,7 @@ class ReactExoplayerView extends FrameLayout implements
|
|||||||
|
|
||||||
private void initializePlayerSource(ReactExoplayerView self, DrmSessionManager drmSessionManager) {
|
private void initializePlayerSource(ReactExoplayerView self, DrmSessionManager drmSessionManager) {
|
||||||
ArrayList<MediaSource> mediaSourceList = buildTextSources();
|
ArrayList<MediaSource> mediaSourceList = buildTextSources();
|
||||||
MediaSource videoSource = buildMediaSource(srcUri, extension, drmSessionManager);
|
MediaSource videoSource = buildMediaSource(self.srcUri, self.extension, drmSessionManager);
|
||||||
MediaSource mediaSource;
|
MediaSource mediaSource;
|
||||||
if (mediaSourceList.size() == 0) {
|
if (mediaSourceList.size() == 0) {
|
||||||
mediaSource = videoSource;
|
mediaSource = videoSource;
|
||||||
|
Loading…
Reference in New Issue
Block a user