Added channel property to allow audio panning
This commit is contained in:
@@ -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);
|
||||
|
Reference in New Issue
Block a user