Loading README.md +9 −0 Changes for README.md: 9 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -231,6 +231,7 @@ var styles = StyleSheet.create({ * [repeat](#repeat) * [resizeMode](#resizemode) * [selectedTextTrack](#selectedtexttrack) * [stereoPan](#stereopan) * [volume](#volume) #### ignoreSilentSwitch Loading Loading @@ -337,6 +338,14 @@ If a track matching the specified Type (and Value if appropriate) is unavailable Platforms: Android ExoPlayer, iOS #### stereoPan Adjust the balance of the left and right audio channels. Any value between –1.0 and 1.0 is accepted. * **-1.0** - Full left * **0.0 (default)** - Center * **1.0** - Full right Platforms: Android MediaPlayer #### volume Adjust the volume. * **1.0 (default)** - Play at full volume Loading Video.js +1 −0 Changes for Video.js: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -284,6 +284,7 @@ Video.propTypes = { paused: PropTypes.bool, muted: PropTypes.bool, volume: PropTypes.number, stereoPan: PropTypes.number, rate: PropTypes.number, playInBackground: PropTypes.bool, playWhenInactive: PropTypes.bool, Loading android/src/main/java/com/brentvatne/react/ReactVideoView.java +22 −0 Changes for android/src/main/java/com/brentvatne/react/ReactVideoView.java: 22 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import java.io.IOException; import java.util.HashMap; import java.util.Map; import java.lang.Math; import java.math.BigDecimal; @SuppressLint("ViewConstructor") public class ReactVideoView extends ScalableVideoView implements MediaPlayer.OnPreparedListener, MediaPlayer Loading Loading @@ -95,6 +96,7 @@ public class ReactVideoView extends ScalableVideoView implements MediaPlayer.OnP private boolean mPaused = false; private boolean mMuted = false; private float mVolume = 1.0f; private float mStereoPan = 0.0f; private float mProgressUpdateInterval = 250.0f; private float mRate = 1.0f; private float mActiveRate = 1.0f; Loading Loading @@ -359,6 +361,14 @@ public class ReactVideoView extends ScalableVideoView implements MediaPlayer.OnP } } // reduces the volume based on stereoPan private float calulateRelativeVolume() { float relativeVolume = (mVolume * (1 - Math.abs(mStereoPan))); // only one decimal allowed BigDecimal roundRelativeVolume = new BigDecimal(relativeVolume).setScale(1, BigDecimal.ROUND_HALF_UP); return roundRelativeVolume.floatValue(); } public void setMutedModifier(final boolean muted) { mMuted = muted; Loading @@ -368,7 +378,14 @@ public class ReactVideoView extends ScalableVideoView implements MediaPlayer.OnP if (mMuted) { setVolume(0, 0); } else if (mStereoPan < 0) { // louder on the left channel setVolume(mVolume, calulateRelativeVolume()); } else if (mStereoPan > 0) { // louder on the right channel setVolume(calulateRelativeVolume(), mVolume); } else { // same volume on both channels setVolume(mVolume, mVolume); } } Loading @@ -378,6 +395,11 @@ public class ReactVideoView extends ScalableVideoView implements MediaPlayer.OnP setMutedModifier(mMuted); } public void setStereoPan(final float stereoPan) { mStereoPan = stereoPan; setMutedModifier(mMuted); } public void setProgressUpdateInterval(final float progressUpdateInterval) { mProgressUpdateInterval = progressUpdateInterval; } Loading android/src/main/java/com/brentvatne/react/ReactVideoViewManager.java +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 Loading @@ -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_STEREO_PAN = "stereoPan"; public static final String PROP_PROGRESS_UPDATE_INTERVAL = "progressUpdateInterval"; public static final String PROP_SEEK = "seek"; public static final String PROP_RATE = "rate"; Loading Loading @@ -124,6 +125,11 @@ public class ReactVideoViewManager extends SimpleViewManager<ReactVideoView> { videoView.setVolumeModifier(volume); } @ReactProp(name = PROP_STEREO_PAN) public void setStereoPan(final ReactVideoView videoView, final float stereoPan) { videoView.setStereoPan(stereoPan); } @ReactProp(name = PROP_PROGRESS_UPDATE_INTERVAL, defaultFloat = 250.0f) public void setProgressUpdateInterval(final ReactVideoView videoView, final float progressUpdateInterval) { videoView.setProgressUpdateInterval(progressUpdateInterval); Loading Loading
README.md +9 −0 Changes for README.md: 9 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -231,6 +231,7 @@ var styles = StyleSheet.create({ * [repeat](#repeat) * [resizeMode](#resizemode) * [selectedTextTrack](#selectedtexttrack) * [stereoPan](#stereopan) * [volume](#volume) #### ignoreSilentSwitch Loading Loading @@ -337,6 +338,14 @@ If a track matching the specified Type (and Value if appropriate) is unavailable Platforms: Android ExoPlayer, iOS #### stereoPan Adjust the balance of the left and right audio channels. Any value between –1.0 and 1.0 is accepted. * **-1.0** - Full left * **0.0 (default)** - Center * **1.0** - Full right Platforms: Android MediaPlayer #### volume Adjust the volume. * **1.0 (default)** - Play at full volume Loading
Video.js +1 −0 Changes for Video.js: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -284,6 +284,7 @@ Video.propTypes = { paused: PropTypes.bool, muted: PropTypes.bool, volume: PropTypes.number, stereoPan: PropTypes.number, rate: PropTypes.number, playInBackground: PropTypes.bool, playWhenInactive: PropTypes.bool, Loading
android/src/main/java/com/brentvatne/react/ReactVideoView.java +22 −0 Changes for android/src/main/java/com/brentvatne/react/ReactVideoView.java: 22 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import java.io.IOException; import java.util.HashMap; import java.util.Map; import java.lang.Math; import java.math.BigDecimal; @SuppressLint("ViewConstructor") public class ReactVideoView extends ScalableVideoView implements MediaPlayer.OnPreparedListener, MediaPlayer Loading Loading @@ -95,6 +96,7 @@ public class ReactVideoView extends ScalableVideoView implements MediaPlayer.OnP private boolean mPaused = false; private boolean mMuted = false; private float mVolume = 1.0f; private float mStereoPan = 0.0f; private float mProgressUpdateInterval = 250.0f; private float mRate = 1.0f; private float mActiveRate = 1.0f; Loading Loading @@ -359,6 +361,14 @@ public class ReactVideoView extends ScalableVideoView implements MediaPlayer.OnP } } // reduces the volume based on stereoPan private float calulateRelativeVolume() { float relativeVolume = (mVolume * (1 - Math.abs(mStereoPan))); // only one decimal allowed BigDecimal roundRelativeVolume = new BigDecimal(relativeVolume).setScale(1, BigDecimal.ROUND_HALF_UP); return roundRelativeVolume.floatValue(); } public void setMutedModifier(final boolean muted) { mMuted = muted; Loading @@ -368,7 +378,14 @@ public class ReactVideoView extends ScalableVideoView implements MediaPlayer.OnP if (mMuted) { setVolume(0, 0); } else if (mStereoPan < 0) { // louder on the left channel setVolume(mVolume, calulateRelativeVolume()); } else if (mStereoPan > 0) { // louder on the right channel setVolume(calulateRelativeVolume(), mVolume); } else { // same volume on both channels setVolume(mVolume, mVolume); } } Loading @@ -378,6 +395,11 @@ public class ReactVideoView extends ScalableVideoView implements MediaPlayer.OnP setMutedModifier(mMuted); } public void setStereoPan(final float stereoPan) { mStereoPan = stereoPan; setMutedModifier(mMuted); } public void setProgressUpdateInterval(final float progressUpdateInterval) { mProgressUpdateInterval = progressUpdateInterval; } Loading
android/src/main/java/com/brentvatne/react/ReactVideoViewManager.java +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 Loading @@ -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_STEREO_PAN = "stereoPan"; public static final String PROP_PROGRESS_UPDATE_INTERVAL = "progressUpdateInterval"; public static final String PROP_SEEK = "seek"; public static final String PROP_RATE = "rate"; Loading Loading @@ -124,6 +125,11 @@ public class ReactVideoViewManager extends SimpleViewManager<ReactVideoView> { videoView.setVolumeModifier(volume); } @ReactProp(name = PROP_STEREO_PAN) public void setStereoPan(final ReactVideoView videoView, final float stereoPan) { videoView.setStereoPan(stereoPan); } @ReactProp(name = PROP_PROGRESS_UPDATE_INTERVAL, defaultFloat = 250.0f) public void setProgressUpdateInterval(final ReactVideoView videoView, final float progressUpdateInterval) { videoView.setProgressUpdateInterval(progressUpdateInterval); Loading