-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix/fullscreen implementation for modals fix (#58)
* allow new interface for safe playback in modals on Android * simplify modal config
- Loading branch information
Showing
7 changed files
with
229 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
import React, { useRef, useState } from 'react'; | ||
import Player from '../components/Player'; | ||
import PlayerContainer from '../components/PlayerContainer'; | ||
import { Alert, Modal, StyleSheet, Text, Pressable, View, StatusBar, Dimensions } from 'react-native'; | ||
export const { height } = Dimensions.get('window'); | ||
|
||
|
||
export default () => { | ||
const playerRef = useRef([]); | ||
|
||
const [modalVisible, setModalVisible] = useState(false); | ||
|
||
let jwConfig = { | ||
"title": "Basic Modal implementation", | ||
"fullScreenOnLandscape": true, | ||
"landscapeOnFullScreen": true, | ||
"playerInModal": true, | ||
"playlist": [ | ||
{ | ||
"file": "https://content.bitsontherun.com/videos/q1fx20VZ-52qL9xLP.mp4", | ||
} | ||
] | ||
} | ||
|
||
return ( | ||
<View style={styles.centeredView}> | ||
<Modal | ||
animationType="fade" | ||
transparent={true} | ||
visible={modalVisible} | ||
onRequestClose={() => { | ||
setModalVisible(!modalVisible); | ||
}}> | ||
<View style={styles.modalView}> | ||
<Player | ||
ref={playerRef} | ||
style={{ flex: 1 }} | ||
config={{ | ||
autostart: true, | ||
styling: { | ||
colors: {}, | ||
}, | ||
...jwConfig | ||
}} | ||
/> | ||
</View> | ||
<Pressable | ||
style={[styles.button, styles.buttonClose]} | ||
onPress={() => setModalVisible(false)}> | ||
<Text style={styles.textStyle}>Hide Modal</Text> | ||
</Pressable> | ||
</Modal> | ||
<Pressable | ||
style={[styles.button, styles.buttonOpen]} | ||
onPress={() => setModalVisible(true)}> | ||
<Text style={styles.textStyle}>Show Modal</Text> | ||
</Pressable> | ||
|
||
</View> | ||
); | ||
}; | ||
const styles = StyleSheet.create({ | ||
centeredView: { | ||
flex: 1, | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
marginTop: 22, | ||
}, | ||
modalView: { | ||
marginTop:height / 3, | ||
height: 300 | ||
}, | ||
button: { | ||
borderRadius: 20, | ||
padding: 10, | ||
elevation: 2, | ||
}, | ||
buttonOpen: { | ||
backgroundColor: '#F194FF', | ||
}, | ||
buttonClose: { | ||
backgroundColor: '#2196F3', | ||
}, | ||
textStyle: { | ||
color: 'white', | ||
fontWeight: 'bold', | ||
textAlign: 'center', | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters