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

Unknown duration error #276

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

colinmcardell
Copy link

Fix for error when attempting to playback live audio streams.

A live stream will not return a duration or a current time value. Resolved issue #40 by checking player duration or currentTime against CMTIME_IS_INDEFINITE or CMTIME_IS_INVALID respectively and return -1 if invalid.

Adds methods to ReactPlayer for duration and position that accommodates check of live streams that wouldn't have a known duration or position. If duration and position are unknown/invalid the -duration or -position method will return -1. Implements usage of these methods in AudioPlayer allowing playback of live streams without throwing an error on the React side like RCTJSONStringify() encountered the following error: Invalid number value (NaN)... as the number now return will be -1.

This fix will cause no significant changes in usage of the library. Note again that live stream duration and position values will be -1.

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

Successfully merging this pull request may close these issues.

None yet

1 participant