Skip to content
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

onDuration returns null for HTML5 player #52

Closed
whitegrey opened this issue Apr 12, 2016 · 2 comments
Closed

onDuration returns null for HTML5 player #52

whitegrey opened this issue Apr 12, 2016 · 2 comments

Comments

@whitegrey
Copy link

onDuration will return null if you programmatically set playing={true} immediately after the component mounts. The video will still play. This problem doesn't exist for youtube sources.

I assume this is because onDuration is being called before the video has fully loaded because putting playVideo() in a timeOut will fix the problem.

@cookpete
Copy link
Owner

I've just taken a look and it looks like the oncanplay HTML5 player event is being called after the onplay event when you set playing={true} like you describe. I guess we need a better way of knowing when duration is ready (the call has already moved from onReady to onPlay in 8ef84fb to fix an issue with Youtube)

cookpete added a commit that referenced this issue Apr 18, 2016
To duplicate the issue outlined in #52
cookpete added a commit that referenced this issue Jun 1, 2016
To duplicate the issue outlined in #52
@cookpete
Copy link
Owner

cookpete commented Jun 3, 2016

Fixed in 0.7.2

david-hub024 pushed a commit to david-hub024/React_VideoPlayer that referenced this issue Dec 23, 2018
To duplicate the issue outlined in cookpete/react-player#52
david-hub024 pushed a commit to david-hub024/React_VideoPlayer that referenced this issue Dec 23, 2018
Some players need onDuration to be called onReady (FilePlayer) and some need it onPlay (YouTube)
Instead of spreading onDuration amongst individual player files, here we just delay onDuration until onPlay if it returns null when onReady fires
Fixes cookpete/react-player#52
david-hub024 pushed a commit to david-hub024/React_VideoPlayer that referenced this issue May 23, 2020
To duplicate the issue outlined in cookpete/react-player#52
david-hub024 pushed a commit to david-hub024/React_VideoPlayer that referenced this issue May 23, 2020
Some players need onDuration to be called onReady (FilePlayer) and some need it onPlay (YouTube)
Instead of spreading onDuration amongst individual player files, here we just delay onDuration until onPlay if it returns null when onReady fires
Fixes cookpete/react-player#52
albanqoku added a commit to albanqoku/react-player that referenced this issue Feb 24, 2021
To duplicate the issue outlined in cookpete/react-player#52
albanqoku added a commit to albanqoku/react-player that referenced this issue Feb 24, 2021
Some players need onDuration to be called onReady (FilePlayer) and some need it onPlay (YouTube)
Instead of spreading onDuration amongst individual player files, here we just delay onDuration until onPlay if it returns null when onReady fires
Fixes cookpete/react-player#52
Webmaster1116 added a commit to Webmaster1116/video-player that referenced this issue May 20, 2021
To duplicate the issue outlined in cookpete/react-player#52
Webmaster1116 added a commit to Webmaster1116/video-player that referenced this issue May 20, 2021
Some players need onDuration to be called onReady (FilePlayer) and some need it onPlay (YouTube)
Instead of spreading onDuration amongst individual player files, here we just delay onDuration until onPlay if it returns null when onReady fires
Fixes cookpete/react-player#52
webmiraclepro added a commit to webmiraclepro/video-player that referenced this issue Sep 9, 2022
To duplicate the issue outlined in cookpete/react-player#52
webmiraclepro added a commit to webmiraclepro/video-player that referenced this issue Sep 9, 2022
Some players need onDuration to be called onReady (FilePlayer) and some need it onPlay (YouTube)
Instead of spreading onDuration amongst individual player files, here we just delay onDuration until onPlay if it returns null when onReady fires
Fixes cookpete/react-player#52
philip-luther added a commit to philip-luther/react-player that referenced this issue Nov 22, 2024
To duplicate the issue outlined in cookpete/react-player#52
philip-luther added a commit to philip-luther/react-player that referenced this issue Nov 22, 2024
Some players need onDuration to be called onReady (FilePlayer) and some need it onPlay (YouTube)
Instead of spreading onDuration amongst individual player files, here we just delay onDuration until onPlay if it returns null when onReady fires
Fixes cookpete/react-player#52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants