Skip to content

New feat : Redesigned audio player #279

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

Merged
merged 7 commits into from
Apr 12, 2025

Conversation

alexbelgium
Copy link

@alexbelgium alexbelgium commented Jan 23, 2025

Hi, I've developed a redesigned audio player that will be added to the HA addon. It might interest you also.

Objective :

  • Fix mobile issues : spectrogram disappears once playback is started & no download button
  • Embed gain control as default volume is often too low compared to other playbacks
  • Consistency on player appearance (currently it was using the video controls which is system dependent)

Implementation :

  • Custom audio javascript which is self-contained
  • Resource efficient : lazy loading (file ; audio nodes) and releasing to avoid using too much resources
  • Code for frequency shift and auto-refresh adapted for the new controler

Features :

  • Clean modern UI
    • Mouse & touch aware
    • Allow to start from a specific point by clicking on the spectrogram
    • Consistent accross devices (tested on Windows edge & Firefox ; Ubuntu Firefox ; IOS edge & safari)
  • Audio options
    • Gain control (Off to x16)
    • Highpass (Off to 1000hz)
    • Download
    • Informations on file
  • Persistance of settings (stored in local storage)

Main view :
image

Loading :
image

Options :
image

@alexbelgium alexbelgium marked this pull request as draft January 23, 2025 12:43
@alexbelgium alexbelgium force-pushed the redesigned_audio_player branch from 09c7172 to 9b03a8d Compare January 27, 2025 17:32
@alexbelgium alexbelgium marked this pull request as ready for review January 27, 2025 17:33
@alexbelgium
Copy link
Author

Solved all issues I could find (including loading optimization) but this would still need a bit more testing as I'm not a js expert

@Nachtzuster
Copy link
Owner

Hi @alexbelgium this looks nice.

An issue I found was trying to play a file a second time does not work: the progress bar keeps sitting at the end and nothing happens.

A minor visual thing:
image
Since we're talking audio gain here, I guess it should be expressed in dB, as in 6dB 12dB 18dB 24dB

@alexbelgium
Copy link
Author

Thanks for the feedback ; what is your test system so I can try to replicate?

@Nachtzuster
Copy link
Owner

Thanks for the feedback ; what is your test system so I can try to replicate?

Firefox on both Linux and Windows

@alexbelgium
Copy link
Author

I could replicate ; should now be fixed according to my test !

@Nachtzuster
Copy link
Owner

Confirmed!

One more thing I found: If you play a clip, and after that download it, it starts playing the clip again, but not the until the end.
It seems to just play the time it takes to download the file.

@YvedD
Copy link

YvedD commented Feb 16, 2025

Hi,

Can/will this be implemented in the main branch too?
Looks very promising in any way

@alexbelgium
Copy link
Author

Hi,

Can/will this be implemented in the main branch too? Looks very promising in any way

Thanks ! I'm just a bit struggling for the moment with two bugs that need to be solved first :

  • Abnormal reading of a file after "Info" or "Download" on Firefox (cf. Nachtzuster comment above)
  • When clicking on Info, it moves playback to the end (globally where the user clicked in the panel)

@alexbelgium
Copy link
Author

I think the issue is solved, or at least I can't replicate it anymore on Edge or Firefox. Could you please check? Thanks!

@alexbelgium alexbelgium changed the title Redesigned audio player New feat : Redesigned audio player Mar 5, 2025
@Nachtzuster
Copy link
Owner

@alexbelgium another bug squash confirmed!

I did find some more issues just now (on ubuntu+firefox):

  • On the front page, after a reload or when the 'most recent' clip has not been played yet, you cannot start it by just clicking the spectrum plot, you have to click the play icon. After it has played once, clicking the spectrum does start the playback
  • Today's Detections' spectra are gone:
    image
  • Clicking the spectrum starts the playback from the time in the spectrum. it used to start from the beginning is stopped or pause when playing. I'm guessing this is a bug and not a feature 😄

@alexbelgium
Copy link
Author

Hi, thanks for your comments :

  • the third point is actually voluntary. The idea is that the full spectrum is visible from the start. If we want to start playback, we need to click on the play icon on bottom left. However, once playback is started, you can go to any place you want in the spectrum by clicking on it. It avoids needing to play with the playback bar, and is much more convenient on mobile phones
  • this is the same for the first point : upon refresh the resources is reloaded and therefore logics restarts from 0 (= need to click on bottom left)
  • for today's detections I can't replicate - did you clear your browser cache ?

@hacustom
Copy link

Just voicing an opinion on this, looks like a really nice UI enhancement and I would love to see some of this functionality.

@alexbelgium
Copy link
Author

alexbelgium commented Mar 26, 2025

It's already in the ha addon and docker container if you want to try https://github.com/alexbelgium/hassio-addons/blob/master/birdnet-pi/README_standalone.md

@Nachtzuster
Copy link
Owner

@alexbelgium I had another try with this branch:

  • I'm fine with having the playback start at the 'click time' in the spectrum, that does make sense.
  • Forcing the user to click the play button on first load feels a bit clunky, especially since on the old player clicking the picture just works. Can we have the player play if one clicks the picture at initial load too? (preferably from the beginning for that initial click - not sure if that is possible)
  • The layout in Today's Detections is indeed broken, it is not cache issue. Also happens in a private browser window
    I verified this on another computer (Windows/Firefox+Chrome) -> same
    Interestingly, the layout IS correct under 'Recordings'

@alexbelgium
Copy link
Author

Thanks ; I'll check those. I guess I changed something else in the addon that avoids those observations so I'll use a "vanilla" install from your repo

@alexbelgium alexbelgium closed this Apr 5, 2025
@alexbelgium alexbelgium force-pushed the redesigned_audio_player branch from cda8cde to 32e2bf5 Compare April 5, 2025 09:27
@alexbelgium alexbelgium reopened this Apr 5, 2025
@alexbelgium
Copy link
Author

Pushed again, today's is now fixed but I still need to adapt a bit UI with the logic of one central play button as before

@alexbelgium
Copy link
Author

alexbelgium commented Apr 5, 2025

New style with no more click to move in the spectrogram.

Tested :

  • Windows : Edge + Firefox
  • IOS : safari

image
image

@Nachtzuster
Copy link
Owner

@alexbelgium looks good to me - ready to merge?

@alexbelgium
Copy link
Author

Ready for me

@Nachtzuster Nachtzuster merged commit 7c22e25 into Nachtzuster:main Apr 12, 2025
@Nachtzuster
Copy link
Owner

@alexbelgium thanks!

@hacustom
Copy link

Updated my instance this morning, I like the new interface!

@blogdemoi
Copy link

I don't have this menu, I don't have the 3 dots menu… I just have the usual volume slider.

I am with Manjaro Linux and Firefox, both up to date.

@alexbelgium
Copy link
Author

Mmh have you updated, and cleared your cache? If you use cloudflare it can have it's own cache. You could try in incognito mode to see if it changes something

@blogdemoi
Copy link

Mmh have you updated, and cleared your cache? If you use cloudflare it can have it's own cache. You could try in incognito mode to see if it changes something

Ah, sorry for this, I just had an update this morning and I have the 3 dots menu now and all the options now. That's wonderful and very useful ! Thank you for your hard work.

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.

5 participants