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

Media player: Add seek and speed controls #2608

Merged
merged 1 commit into from
Apr 26, 2024

Conversation

ztec
Copy link
Contributor

@ztec ztec commented Apr 10, 2024

When listening to podcast, it is usual to want to speed up the playback. #2521 was addressing the need globally, this PR allow to address it for just the current open enclosure media. (no save) Some Browser already include this control directly, but Firefox does not (directly anyway).

Also, it is often useful to be able to skip chunk of a podcast, to skip commercials for example, or get back a bit because we couldn't hear the last part. I added rudimentary seek controls with the usual +/-10 and 30 seconds chuck size. This is pretty handy when podcast are very long and using the seek bar is way too tricky to just skip 30s.

As always, I'm French and could only provide English and French translation for the few text I added in the locale/translations files. Any help is welcome.

Tested mostly on Firefox (121.0) and quickly on Vivaldi(6.5.3206.53), chrome based.


If anything seems odd or require more work, feel free to ask. I'm available to improve things.

I did not find a way to have the global user configured playback rate in the sub-template enclosure_media_controls.html. Any proposition is welcome and would remove the need for JS to have this information displayed. (JS still needed to control the playback tho)

I did my best with the CSS. Any improvement here is also welcome. I wanted to have something really simple but still responsive. It is not always perfectly aligned (as it is centered) when resizing, but it will fit all screens.

The change look like this:
Firefox player with controls beneath it
Vivaldi player with controls beneath it, on a mobile view

Fixes: #1845 #1846


Do you follow the guidelines?

speedIndicator.forEach((speedI) => {
// Two digit precision to ensure we always have the same number of characters (4) to avoid controls moving when clicking buttons because of more or less characters.
// The trick only work on rate less than 10, but it feels an acceptable tread of considering the feature
speedI.innerText = `${enclosure.playbackRate.toFixed(2)}x`;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I felt this duplication did not worth the hassle of factorization. But happy to improve it if this felling is not shared.

@ztec ztec force-pushed the podcast/media_controls branch 2 times, most recently from 86bc95e to bd5861d Compare April 10, 2024 16:04
internal/ui/static/js/app.js Outdated Show resolved Hide resolved
@fguillot
Copy link
Member

The speed button does not seems to work for me. Tested with Chrome and Firefox. See screen recording below:

Recording.2024-04-10.195845.mp4

@ztec
Copy link
Contributor Author

ztec commented Apr 11, 2024

@fguillot Did you cleared the JS cache ? 😅

Do you have any logs or errors in the console ? What version of chrome exactly, on which OS ? I will test it today to see what's happening.

@fguillot
Copy link
Member

@fguillot Did you cleared the JS cache ? 😅

Do you have any logs or errors in the console ? What version of chrome exactly, on which OS ? I will test it today to see what's happening.

Added a comment here: #2608 (comment)

@ztec
Copy link
Contributor Author

ztec commented Apr 22, 2024

I've rebased the branch and re-tested. All seems ok.

When listening to podcast, it is usual to want to speed up the playback.
miniflux#2521 was addressing the need globally, this PR
allow to address it for just the current open enclosure media. (no save) Some Browser
already include this control directly, but firefox does not (directly anyway).

Also, it is often useful to be able to skip chunk of a podcast, to skip commercials
for example, or get back a bit because we couldn't hear the last part. I added rudimentary
seek controls with the usual +/-10 and 30 seconds chuck size. This is pretty handy when podcast
are very long and using the seek bar is way too tricky to just skip 30s.

As always, I'm French and could only provide English and French translation for the few
text I added in the locale/translations files. Any help is welcome.

Tested mostly on Firefox (121.0) and quickly on Vivaldi(6.5.3206.53), chrome based.

Fixes: miniflux#1845 miniflux#1846
@fguillot fguillot merged commit 93bc9ce into miniflux:main Apr 26, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Media player: Conrol playback speed
3 participants