From 8b931cbc5d82efec691cabab1b5256435b4b029b Mon Sep 17 00:00:00 2001 From: Rafael Pinto Date: Tue, 5 Jun 2018 02:25:46 +0100 Subject: [PATCH] Added channel property to allow audio panning --- Video.js | 1 + .../brentvatne/exoplayer/ReactExoplayerView.java | 6 ++++++ .../exoplayer/ReactExoplayerViewManager.java | 6 ++++++ .../java/com/brentvatne/react/ReactVideoView.java | 14 ++++++++++++++ .../brentvatne/react/ReactVideoViewManager.java | 6 ++++++ 5 files changed, 33 insertions(+) diff --git a/Video.js b/Video.js index aced6e55..0510f416 100644 --- a/Video.js +++ b/Video.js @@ -277,6 +277,7 @@ Video.propTypes = { paused: PropTypes.bool, muted: PropTypes.bool, volume: PropTypes.number, + channel: PropTypes.string, rate: PropTypes.number, playInBackground: PropTypes.bool, playWhenInactive: PropTypes.bool, 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 aa60ac14..6ccce609 100644 --- a/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java +++ b/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java @@ -650,6 +650,12 @@ class ReactExoplayerView extends FrameLayout implements } } + public void setChannel(String channel) { + if (player != null) { + player.setChannel(channel); + } + } + public void seekTo(long positionMs) { if (player != null) { eventEmitter.seek(player.getCurrentPosition(), positionMs); diff --git a/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerViewManager.java b/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerViewManager.java index b500f400..161a3648 100644 --- a/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerViewManager.java +++ b/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerViewManager.java @@ -27,6 +27,7 @@ public class ReactExoplayerViewManager extends ViewGroupManager { public static final String PROP_PAUSED = "paused"; public static final String PROP_MUTED = "muted"; public static final String PROP_VOLUME = "volume"; + public static final String PROP_CHANNEL = "channel"; public static final String PROP_PROGRESS_UPDATE_INTERVAL = "progressUpdateInterval"; public static final String PROP_SEEK = "seek"; public static final String PROP_RATE = "rate"; @@ -124,6 +125,11 @@ public class ReactVideoViewManager extends SimpleViewManager { videoView.setVolumeModifier(volume); } + @ReactProp(name = PROP_CHANNEL) + public void setChannel(final ReactVideoView videoView, final String channel) { + videoView.setChannel(channel); + } + @ReactProp(name = PROP_PROGRESS_UPDATE_INTERVAL, defaultFloat = 250.0f) public void setProgressUpdateInterval(final ReactVideoView videoView, final float progressUpdateInterval) { videoView.setProgressUpdateInterval(progressUpdateInterval);