Open jrhager84 opened 2 years ago
Same problem ,
What version are you using? I'm encountering similar issues with react-native@0.69.2
, react-native-video@^6.0.0-alpha.1
, react-native-video-controls@^2.8.1
Same for me too.... Any solution ???
In my case the crash was due to using react-native-gesture-handler
on a specific app page (the same where the video component was*). After removing usages of react-native-gesture-handler
in that page and switching previous logic to React Native's gesture system, the page worked fine without crashing.
*I'm not using react-native-video-controls
directly, but its dependency react-native-video
(i needed my own custom video controls UI) but the issue is still relevant.
I fixed this problems with
import { Dimensions } from "react-native";
// ...
// render() component
<VideoPlayer style={{
left: 0,
top: 0,
bottom: 0,
right: 0,
width: Dimensions.get('window').width,
height: 2160 * (Dimensions.get('window').width / 3840)
}} source={{ uri: "https://www.google.com/google.mp4" }}
/>
// this will fit your player to 16:9 aspect ratio
I had to patch the package to replace
const percent = this.state.currentTime / this.state.duration;
with
const percent = this.state.duration === 0 ? 0 : this.state.currentTime / this.state.duration;
in VideoPlayer.js since it doesn't look like they're merging any PRs recently
Now i know this error only occurred in DEBUG mode. I fixed it by briefly pressing the pause button, then waiting for the video to finish loading and then pressing the play button.
I had to patch the package to replace
const percent = this.state.currentTime / this.state.duration;
withconst percent = this.state.duration === 0 ? 0 : this.state.currentTime / this.state.duration;
in VideoPlayer.js since it doesn't look like they're merging any PRs recently
This is working, can we raise and merge PR ???
I had to patch the package to replace const percent = this.state.currentTime / this.state.duration; with const percent = this.state.duration === 0 ? 0 : this.state.currentTime / this.state.duration; in VideoPlayer.js since it doesn't look like they're merging any PRs recently
This is working! Thanks!
When using the Video component from react-native-video-controls, I get this error. With the Video component from react-native-video, it works perfectly. I also have found that if I leave the
controls
enabled for the native controls, the error doesn't happen. Is there something I'm doing wrong?My Base player:
My live video player:
The error in Metro: