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

fix(fuselage): AudioPlayer: Infinity duration audio files crashing #1159

Merged
merged 2 commits into from
Sep 11, 2023

Conversation

yash-rajpal
Copy link
Member

@yash-rajpal yash-rajpal commented Sep 11, 2023

Proposed changes (including videos or screenshots)

Issue(s)

Further comments

The issue is that some kind of audio files are not returning the correct duration with metaData, they are returning Infinity which is crashing the UI.

So this is a common issue and we have a few workarounds for solving this -

  1. Fetch the entire file in background and then get the duration. Didn't use this approach as it would unnecessarily download(fetch) the entire file.

  2. Seek the audio element to play some audio by setting the currentTime of the element, set this currentTime to some very big number, which will cause it to fetch the real duration of the audio file and then we can use this duration. I've used this approach, but I ran into another issue when using this approach. After setting the currentTime to a very big number, the audio element was breaking for no apparent reason. It was not seeking the audio current time to any desired location, so had to create a new Audio element and use this new element to fetch the duration.

@yash-rajpal yash-rajpal marked this pull request as ready for review September 11, 2023 15:29
Copy link
Member

@dougfabris dougfabris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@dougfabris dougfabris merged commit 385170c into develop Sep 11, 2023
@dougfabris dougfabris deleted the audioPlayer-Infinity-duration branch September 11, 2023 17:27
dougfabris added a commit that referenced this pull request Sep 13, 2023
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.

2 participants