From ebe138fa8dad21a4fd786b41a1e541d44c511c9b Mon Sep 17 00:00:00 2001 From: vengadesh Date: Wed, 6 Dec 2017 08:56:41 -0800 Subject: [PATCH] Raising error for source exception (#799) --- .../java/com/brentvatne/exoplayer/ReactExoplayerView.java | 7 ++++++- android-exoplayer/src/main/res/values/strings.xml | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java b/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java index 52bf24e6..f24d94c2 100644 --- a/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java +++ b/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java @@ -482,6 +482,7 @@ class ReactExoplayerView extends FrameLayout implements @Override public void onPlayerError(ExoPlaybackException e) { String errorString = null; + Exception ex = e; if (e.type == ExoPlaybackException.TYPE_RENDERER) { Exception cause = e.getRendererException(); if (cause instanceof MediaCodecRenderer.DecoderInitializationException) { @@ -504,8 +505,12 @@ class ReactExoplayerView extends FrameLayout implements } } } + else if (e.type == ExoPlaybackException.TYPE_SOURCE) { + ex = e.getSourceException(); + errorString = getResources().getString(R.string.unrecognized_media_format); + } if (errorString != null) { - eventEmitter.error(errorString, e); + eventEmitter.error(errorString, ex); } playerNeedsSource = true; if (isBehindLiveWindow(e)) { diff --git a/android-exoplayer/src/main/res/values/strings.xml b/android-exoplayer/src/main/res/values/strings.xml index b92a238a..4f69ec34 100644 --- a/android-exoplayer/src/main/res/values/strings.xml +++ b/android-exoplayer/src/main/res/values/strings.xml @@ -9,4 +9,6 @@ Unable to instantiate decoder %1$s + Unrecognized media format +