-
-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
onEnd callback doesnt trigger when rewind #60
Comments
Hello @FightFarewellFearless. Thanks for trying out the library and opening an issue. I'll look into it this weekend or the next. It will be a lot faster if you can provide a reproduction code. Thank you! |
Sure. This is my video component <Videos
key={
this.state.data.streamingLink[this.state.part].sources[0].src
}
showOnEnd={true}
title={this.state.data.title}
disableBack={!this.state.fullscreen}
onBack={this.onBack}
toggleResizeModeOnFullscreen={false}
isFullscreen={this.state.fullscreen}
onEnterFullscreen={this.enterFullscreen.bind(this)}
onExitFullscreen={this.exitFullscreen.bind(this)}
source={{
uri: this.state.data.streamingLink[this.state.part].sources[0]
.src,
}}
onEnd={this.onEnd}
rewindTime={10}
showDuration={true}
/> And this is my onEnd function onEnd = () => {
if (this.state.part < this.state.data.streamingLink.length - 1) {
this.setState({
part: this.state.part + 1,
});
} So its like going to the next video automatically when the video is end |
@FightFarewellFearless Might not be relevant but - what version of React are you using? Did you also add a onEnd = () => {
console.log('onEnd called'); // <----------------- Add this line here
if (this.state.part < this.state.data.streamingLink.length - 1) {
this.setState({
part: this.state.part + 1,
});
} |
@criszz77 yes, i mean its working fine if i didnt rewind forward, and if i rewind forward and the rewind time larger than the remaining duration, it just replay the video and doesnt trigger the onend function. And im using react version 18.2.0 and react native version 0.71.1 |
Why are you still using class components? They are legacy in React. Nowadays functional components are used along with hooks. |
Perhaps I will need more code to get it running. Like your state. |
Oh, yea, I'm more comfortable using class component. |
Well I strongly suggest you to get comfortable using hooks. They will make your life much easier. |
You can check the full code here if you want https://github.com/FightFarewellFearless/anime-react-native/blob/master/src/Video.js |
Having an understanding of how class components work is also very good to know, but they you have to write a lot of code to actually do something, and thus it’s easier to introduce bugs |
Thanks, i will move soon ig |
@criszz77 ah, also i want to request new feature. Can you add like "try again" if the video is error |
There is an ongoing issue for this here: #23 Unfortunately, I'm quite busy with my other open source project for the moment, but I'll try to get this module improved ASAP. |
Any update? |
I think this pull request will fix it |
Not reproducible. Check #58, maybe you will find a solution there. |
Hey, I think I just found a bug.
For example, if the current duration is 2:50, the video duration is 3:00, and the rewind time is 15 seconds, when you rewind forward at 2:50, the video should end, right? Because it has reached the limit, but it's not. Somehow, it just plays back to 0:00 and doesn't trigger the onEnd callback
The text was updated successfully, but these errors were encountered: