chore: lint code

This commit is contained in:
Krzysztof Moch
2025-01-20 13:28:27 +01:00
parent 2e6ac0d5a0
commit 85a9a1472f
6 changed files with 71 additions and 52 deletions
+29 -22
View File
@@ -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>
);
}