-
Notifications
You must be signed in to change notification settings - Fork 1
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
Bugfix/playbutton ended state #33
base: develop
Are you sure you want to change the base?
Conversation
@@ -46,7 +46,7 @@ export class PlayButton extends PureComponent<PlayButtonProps, PlayButtonState> | |||
context.player.addEventListener(PlayerEventType.SEEKING, this.onSeeking); | |||
this.setState({ | |||
paused: context.player.paused, | |||
ended: context.player.currentTime === context.player.duration, | |||
ended: (context.player.duration > 0) && (context.player.currentTime === context.player.duration), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does context.player.ended
not work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would make sense indeed. But I just noticed we don't have this on our API. We're only supporting the ENDED event but never store it as a state.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe it would make sense to rely on something that's "ended" (or the property or the event), because I think on iOS we had an issue where the duration wasn't equal to the last currentTime
.
Afaik it was fixed and it dispatches the ended
event (and reflects it on the property too)
Otherwise, we reintroduce the same issue on the RN level.
(on the other hand, it would be nice if iOS could update the duration properly too, if possible to detect the duration change (if any))
At the very beginning of the stream, on iOS, the currentTime is 0 and without preloading so is the duration. In that case currentTime == duration which makes the playButton assume an ended state upon initialisation.