Commit 8b931cbc authored by Rafael Pinto's avatar Rafael Pinto
Browse files

Added channel property to allow audio panning

parent b86a2a7e
Loading
Loading
Loading
Loading
+1 −0
Changes for Video.js: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -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,
+6 −0
Changes for android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java: 6 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -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);
+6 −0
Changes for android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerViewManager.java: 6 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ public class ReactExoplayerViewManager extends ViewGroupManager<ReactExoplayerVi
    private static final String PROP_PAUSED = "paused";
    private static final String PROP_MUTED = "muted";
    private static final String PROP_VOLUME = "volume";
    private static final String PROP_CHANNEL = "channel";
    private static final String PROP_PROGRESS_UPDATE_INTERVAL = "progressUpdateInterval";
    private static final String PROP_SEEK = "seek";
    private static final String PROP_RATE = "rate";
@@ -131,6 +132,11 @@ public class ReactExoplayerViewManager extends ViewGroupManager<ReactExoplayerVi
        videoView.setVolumeModifier(volume);
    }

    @ReactProp(name = PROP_CHANNEL)
    public void setChannel(final ReactExoplayerView videoView, final String channel) {
        videoView.setChannel(channel);
    }

    @ReactProp(name = PROP_PROGRESS_UPDATE_INTERVAL, defaultFloat = 250.0f)
    public void setProgressUpdateInterval(final ReactExoplayerView videoView, final float progressUpdateInterval) {
        videoView.setProgressUpdateInterval(progressUpdateInterval);
+14 −0
Changes for android/src/main/java/com/brentvatne/react/ReactVideoView.java: 14 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -77,6 +77,10 @@ public class ReactVideoView extends ScalableVideoView implements MediaPlayer.OnP
    public static final String EVENT_PROP_WHAT = "what";
    public static final String EVENT_PROP_EXTRA = "extra";

    public static final String CHANNEL_LEFT = "left";
    public static final String CHANNEL_BOTH = "both";
    public static final String CHANNEL_RIGHT = "right";

    private ThemedReactContext mThemedReactContext;
    private RCTEventEmitter mEventEmitter;

@@ -95,6 +99,7 @@ public class ReactVideoView extends ScalableVideoView implements MediaPlayer.OnP
    private boolean mPaused = false;
    private boolean mMuted = false;
    private float mVolume = 1.0f;
    private String mChannel = CHANNEL_BOTH;
    private float mProgressUpdateInterval = 250.0f;
    private float mRate = 1.0f;
    private float mActiveRate = 1.0f;
@@ -368,6 +373,10 @@ public class ReactVideoView extends ScalableVideoView implements MediaPlayer.OnP

        if (mMuted) {
            setVolume(0, 0);
        } else if (CHANNEL_LEFT.equals(mChannel)){
            setVolume(mVolume, 0);
        } else if (CHANNEL_RIGHT.equals(mChannel)){
            setVolume(0, mVolume);
        } else {
            setVolume(mVolume, mVolume);
        }
@@ -378,6 +387,11 @@ public class ReactVideoView extends ScalableVideoView implements MediaPlayer.OnP
        setMutedModifier(mMuted);
    }

    public void setChannel(final String channel) {
        mChannel = channel;
        setMutedModifier(mMuted);
    }

    public void setProgressUpdateInterval(final float progressUpdateInterval) {
        mProgressUpdateInterval = progressUpdateInterval;
    }
+6 −0
Changes for android/src/main/java/com/brentvatne/react/ReactVideoViewManager.java: 6 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ public class ReactVideoViewManager extends SimpleViewManager<ReactVideoView> {
    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<ReactVideoView> {
        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);