fix: omit packager assets from caching (#1438)
This commit is contained in:
@@ -5,39 +5,70 @@
|
||||
*/
|
||||
|
||||
import React, { Component } from "react";
|
||||
import { StyleSheet, Text, View, Dimensions, TouchableOpacity } from "react-native";
|
||||
import { Alert, StyleSheet, Text, View, Dimensions, TouchableOpacity } from "react-native";
|
||||
import Video from "react-native-video";
|
||||
|
||||
const { height, width } = Dimensions.get("screen");
|
||||
|
||||
type Props = {};
|
||||
export default class App extends Component<Props> {
|
||||
|
||||
type State = {
|
||||
showLocal: boolean
|
||||
};
|
||||
|
||||
function Button({ text, onPress }: { text: string, onPress: () => void }) {
|
||||
return (
|
||||
<TouchableOpacity
|
||||
onPress={onPress}
|
||||
style={styles.button}
|
||||
>
|
||||
<Text style={{color: 'white'}}>{text}</Text>
|
||||
</TouchableOpacity>
|
||||
)
|
||||
}
|
||||
|
||||
export default class App extends Component<Props, State> {
|
||||
state = {
|
||||
showLocal: false
|
||||
}
|
||||
render() {
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
<Video
|
||||
source={{
|
||||
uri:
|
||||
"https://rawgit.com/mediaelement/mediaelement-files/master/big_buck_bunny.mp4"
|
||||
}}
|
||||
source={
|
||||
this.state.showLocal ?
|
||||
require('../basic/broadchurch.mp4') :
|
||||
{
|
||||
uri: "https://rawgit.com/mediaelement/mediaelement-files/master/big_buck_bunny.mp4"
|
||||
}
|
||||
}
|
||||
ref={player => {
|
||||
this.player = player;
|
||||
}}
|
||||
onEnd={() => {
|
||||
this.player.seek(0);
|
||||
}}
|
||||
onError={(err) => {
|
||||
Alert.alert(JSON.stringify(err))
|
||||
}}
|
||||
style={{ flex: 1, height, width }}
|
||||
/>
|
||||
<TouchableOpacity
|
||||
onPress={async () => {
|
||||
let response = await this.player.save();
|
||||
let uri = response.uri;
|
||||
console.log("Download URI", uri);
|
||||
}}
|
||||
style={styles.button}
|
||||
>
|
||||
<Text style={{color: 'white'}}>Save</Text>
|
||||
</TouchableOpacity>
|
||||
<View style={styles.absoluteOverlay}>
|
||||
<Button
|
||||
onPress={async () => {
|
||||
let response = await this.player.save();
|
||||
let uri = response.uri;
|
||||
console.warn("Download URI", uri);
|
||||
}}
|
||||
text="Save"
|
||||
/>
|
||||
<Button
|
||||
onPress={() => {
|
||||
this.setState(state => ({ showLocal: !state.showLocal }))
|
||||
}}
|
||||
text={this.state.showLocal ? "Show Remote" : "Show Local"}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
@@ -50,13 +81,20 @@ const styles = StyleSheet.create({
|
||||
alignItems: "center",
|
||||
backgroundColor: "#F5FCFF"
|
||||
},
|
||||
button: {
|
||||
absoluteOverlay: {
|
||||
flexDirection: 'row',
|
||||
position: 'absolute',
|
||||
top: 50,
|
||||
right: 16,
|
||||
top: 0,
|
||||
width: '100%',
|
||||
marginTop: 50,
|
||||
},
|
||||
button: {
|
||||
padding: 10,
|
||||
backgroundColor: '#9B2FAE',
|
||||
borderRadius: 8
|
||||
borderRadius: 8,
|
||||
flex: 1,
|
||||
alignItems: 'center',
|
||||
marginHorizontal: 5,
|
||||
},
|
||||
welcome: {
|
||||
fontSize: 20,
|
||||
|
||||
Reference in New Issue
Block a user