mirror of
https://github.com/zoriya/react-native-video.git
synced 2026-06-06 12:02:44 +00:00
chore: lint code
This commit is contained in:
+29
-22
@@ -1,5 +1,5 @@
|
||||
import * as React from 'react';
|
||||
import { Button, Dimensions, Platform, StyleSheet, View } from 'react-native';
|
||||
import { Button, Dimensions, StyleSheet, View } from 'react-native';
|
||||
import { VideoView, createSource, useVideoPlayer } from 'react-native-video';
|
||||
|
||||
export default function App() {
|
||||
@@ -10,32 +10,39 @@ export default function App() {
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
<View style={styles.videoContainer}>
|
||||
{/* <VideoView player={player} style={styles.box} /> */}
|
||||
{/* Two VideoViews with same player are supported not supported on Android */}
|
||||
{show && (
|
||||
<VideoView player={player} style={styles.box} />
|
||||
)}
|
||||
{show && <VideoView player={player} style={styles.box} />}
|
||||
</View>
|
||||
<Button title="Play" onPress={() => player.play()} />
|
||||
<Button title="Pause" onPress={() => player.pause()} />
|
||||
<Button title="Seek to 3sec" onPress={() => player.currentTime = 3} />
|
||||
<Button title="Seek to 3sec" onPress={() => (player.currentTime = 3)} />
|
||||
<Button title="Toggle" onPress={() => setShow((prev) => !prev)} />
|
||||
<Button title="Preload player" onPress={() => {
|
||||
player.preload().then(() => {
|
||||
// setShow(true);
|
||||
}).catch((error) => {
|
||||
console.error(error);
|
||||
});
|
||||
}} />
|
||||
<Button title="Replace source" onPress={() => {
|
||||
const newSource = createSource("https://www.w3schools.com/html/mov_bbb.mp4")
|
||||
|
||||
newSource.getAssetInformationAsync().then((assetInfo) => {
|
||||
console.log(assetInfo);
|
||||
})
|
||||
<Button
|
||||
title="Preload player"
|
||||
onPress={() => {
|
||||
player
|
||||
.preload()
|
||||
.then(() => {
|
||||
// setShow(true);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error(error);
|
||||
});
|
||||
}}
|
||||
/>
|
||||
<Button
|
||||
title="Replace source"
|
||||
onPress={() => {
|
||||
const newSource = createSource(
|
||||
'https://www.w3schools.com/html/mov_bbb.mp4'
|
||||
);
|
||||
|
||||
player.replaceSourceAsync(newSource);
|
||||
}} />
|
||||
newSource.getAssetInformationAsync().then((assetInfo) => {
|
||||
console.log(assetInfo);
|
||||
});
|
||||
|
||||
player.replaceSourceAsync(newSource);
|
||||
}}
|
||||
/>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user