Update index.ios.js

This commit is contained in:
Harrison Mendonça 2020-04-20 20:12:34 -03:00
parent 4157a609ac
commit 052f49e472

View File

@ -52,6 +52,7 @@ class VideoPlayer extends Component {
paused: true, paused: true,
skin: 'custom', skin: 'custom',
ignoreSilentSwitch: null, ignoreSilentSwitch: null,
mixWithOthers: null,
isBuffering: false, isBuffering: false,
filter: FilterType.NONE, filter: FilterType.NONE,
filterEnabled: true filterEnabled: true
@ -155,6 +156,18 @@ class VideoPlayer extends Component {
) )
} }
renderMixWithOthersControl(mixWithOthers) {
const isSelected = (this.state.mixWithOthers == mixWithOthers);
return (
<TouchableOpacity onPress={() => { this.setState({mixWithOthers: mixWithOthers}) }}>
<Text style={[styles.controlOption, {fontWeight: isSelected ? "bold" : "normal"}]}>
{mixWithOthers}
</Text>
</TouchableOpacity>
)
}
renderCustomSkin() { renderCustomSkin() {
const flexCompleted = this.getCurrentTimePercentage() * 100; const flexCompleted = this.getCurrentTimePercentage() * 100;
const flexRemaining = (1 - this.getCurrentTimePercentage()) * 100; const flexRemaining = (1 - this.getCurrentTimePercentage()) * 100;
@ -170,6 +183,7 @@ class VideoPlayer extends Component {
volume={this.state.volume} volume={this.state.volume}
muted={this.state.muted} muted={this.state.muted}
ignoreSilentSwitch={this.state.ignoreSilentSwitch} ignoreSilentSwitch={this.state.ignoreSilentSwitch}
mixWithOthers={this.state.mixWithOthers}
resizeMode={this.state.resizeMode} resizeMode={this.state.resizeMode}
onLoad={this.onLoad} onLoad={this.onLoad}
onBuffer={this.onBuffer} onBuffer={this.onBuffer}
@ -226,10 +240,16 @@ class VideoPlayer extends Component {
<View style={styles.generalControls}> <View style={styles.generalControls}>
{ {
(Platform.OS === 'ios') ? (Platform.OS === 'ios') ?
<View style={styles.ignoreSilentSwitchControl}> <>
{this.renderIgnoreSilentSwitchControl('ignore')} <View style={styles.ignoreSilentSwitchControl}>
{this.renderIgnoreSilentSwitchControl('obey')} {this.renderIgnoreSilentSwitchControl('ignore')}
</View> : null {this.renderIgnoreSilentSwitchControl('obey')}
</View>
<View style={styles.mixWithOthersControl}>
{this.renderMixWithOthersControl('mix')}
{this.renderMixWithOthersControl('duck')}
</View>
</> : null
} }
</View> </View>
@ -257,6 +277,7 @@ class VideoPlayer extends Component {
volume={this.state.volume} volume={this.state.volume}
muted={this.state.muted} muted={this.state.muted}
ignoreSilentSwitch={this.state.ignoreSilentSwitch} ignoreSilentSwitch={this.state.ignoreSilentSwitch}
mixWithOthers={this.state.mixWithOthers}
resizeMode={this.state.resizeMode} resizeMode={this.state.resizeMode}
onLoad={this.onLoad} onLoad={this.onLoad}
onBuffer={this.onBuffer} onBuffer={this.onBuffer}
@ -313,10 +334,16 @@ class VideoPlayer extends Component {
<View style={styles.generalControls}> <View style={styles.generalControls}>
{ {
(Platform.OS === 'ios') ? (Platform.OS === 'ios') ?
<View style={styles.ignoreSilentSwitchControl}> <>
{this.renderIgnoreSilentSwitchControl('ignore')} <View style={styles.ignoreSilentSwitchControl}>
{this.renderIgnoreSilentSwitchControl('obey')} {this.renderIgnoreSilentSwitchControl('ignore')}
</View> : null {this.renderIgnoreSilentSwitchControl('obey')}
</View>
<View style={styles.mixWithOthersControl}>
{this.renderMixWithOthersControl('mix')}
{this.renderMixWithOthersControl('duck')}
</View>
</> : null
} }
</View> </View>
</View> </View>
@ -399,6 +426,12 @@ const styles = StyleSheet.create({
alignItems: 'center', alignItems: 'center',
justifyContent: 'center' justifyContent: 'center'
}, },
mixWithOthersControl: {
flex: 1,
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'center'
},
controlOption: { controlOption: {
alignSelf: 'center', alignSelf: 'center',
fontSize: 11, fontSize: 11,