Added channel property to allow audio panning
This commit is contained in:
parent
b86a2a7e12
commit
8b931cbc5d
1
Video.js
1
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,
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user