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

onProgress not working for webm files #503

Closed
ankithkonda opened this issue Oct 21, 2018 · 12 comments
Closed

onProgress not working for webm files #503

ankithkonda opened this issue Oct 21, 2018 · 12 comments

Comments

@ankithkonda
Copy link

ankithkonda commented Oct 21, 2018

Hi onProgress is only called once when a webm file is being played. onProgress works as expected with mp3 files

The webm file i'm using is audio only.

@cookpete
Copy link
Owner

@ankithkonda Do you have an example file where this happens? I can't find one anywhere to debug the problem.

@grydstedt
Copy link

I've been trying to play this long Amazon Polly file and onProgress is only ever called once. Here is a longer lorem ipsum file from Polly:

https://polly.us-east-1.amazonaws.com/v1/speech?OutputFormat=mp3&Text=Contrary%20to%20popular%20belief%2C%20Lorem%20Ipsum%20is%20not%20simply%20random%20text.%20It%20has%20roots%20in%20a%20piece%20of%20classical%20Latin%20literature%20from%2045%20BC%2C%20making%20it%20over%202000%20years%20old.%20Richard%20McClintock%2C%20a%20Latin%20professor%20at%20Hampden-Sydney%20College%20in%20Virginia%2C%20looked%20up%20one%20of%20the%20more%20obscure%20Latin%20words%2C%20consectetur%2C%20from%20a%20Lorem%20Ipsum%20passage%2C%20and%20going%20through%20the%20cites%20of%20the%20word%20in%20classical%20literature%2C%20discovered%20the%20undoubtable%20source.%20Lorem%20Ipsum%20comes%20from%20sections%201.10.32%20and%201.10.33%20of%20%22de%20Finibus%20Bonorum%20et%20Malorum%22%20%28The%20Extremes%20of%20Good%20and%20Evil%29%20by%20Cicero%2C%20written%20in%2045%20BC.%20This%20book%20is%20a%20treatise%20on%20the%20theory%20of%20ethics%2C%20very%20popular%20during%20the%20Renaissance.%20The%20first%20line%20of%20Lorem%20Ipsum%2C%20%22Lorem%20ipsum%20dolor%20sit%20amet..%22%2C%20comes%20from%20a%20line%20in%20section%201.10.32.&TextType=text&VoiceId=Kendra&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAI2A3V5SI7DVXU2TQ%2F20181120%2Fus-east-1%2Fpolly%2Faws4_request&X-Amz-Date=20181120T104524Z&X-Amz-Expires=3600&X-Amz-Signature=c425aee6c806fcc9ca3e3c8b649444dcded1a54b8956ec7a851d13278014f68e&X-Amz-SignedHeaders=host

@cookpete
Copy link
Owner

@grydstedt I'm getting a 403 error for that URL :(

@ammar17
Copy link

ammar17 commented Feb 4, 2019

I also have the same problem with webm videos (generated with the MediaDevices.getUserMedia lib).
indeed, when I start playing the video, the onProgress function does not fire at each progressInterval
@cookpete @grydstedt, have you found a solution to this problem?
thanks

@cookpete
Copy link
Owner

onProgress requires a duration in order to return the percentages for played and loaded:

https://github.com/CookPete/react-player/blob/37700cc6a8c7a1d6c2d1796862ff4aafb45739f9/src/Player.js#L102-L107

My guess is that these files are not returning a valid duration for some reason.

@ankithkonda
Copy link
Author

@cookpete sorry this completely fell off my radar. Do you have an example file where this happens? I can't find one anywhere to debug the problem. happy to send through an example in a few days

@cookpete
Copy link
Owner

@ankithkonda I still can't reproduce this myself, but a falsey duration is the only reasonable explanation for onProgress not firing correctly for certain files.

@janakhad
Copy link

@cookpete
In the case when duration is equal to Infinity (this is the case for streams), this check:
https://github.com/CookPete/react-player/blob/37700cc6a8c7a1d6c2d1796862ff4aafb45739f9/src/Player.js#L113
will always be if (0 !== 0 || 0 !== 0) since there will be 0 when dividing any number by infinity. I suggest checking here playedSeconds and loadedSeconds instead of played and loaded.

@KasJones
Copy link

Hi @cookpete! I was wondering if you have a fix for this, I've noticed you closed the issue

@cookpete
Copy link
Owner

Hi @KasFijolek, this should hopefully be fixed in v1.11.1 after I took @janakhad's suggestion and updated the logic to compare playedSeconds and loadedSeconds instead of played and loaded fractions, which would always be zero for streams with Infinity duration.

@KasJones
Copy link

awesome, thanks for the swift response! 🙂

albanqoku added a commit to albanqoku/react-player that referenced this issue Feb 24, 2021
Webmaster1116 added a commit to Webmaster1116/video-player that referenced this issue May 20, 2021
webmiraclepro added a commit to webmiraclepro/video-player that referenced this issue Sep 9, 2022
@ragnarok22
Copy link

I'm getting the same problem with webp files. I printed the value of onDuration and still getting Infinity value. The weird thing is, when you do it manually on browser console you get the correct values

image

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

7 participants