FreeTubeApp / FreeTubeApp/FreeTube

[Feature Request]: Configurable audio delay for Bluetooth audio peripherals

Open
#5,600 3 comments 0 reactions 0 assignees View on GitHub
E: new feature
Dominant language
Vue
Stars
21.9k
Forks
1.5k
Avg merge
1d 15h
Merged PRs (30d)
62

Description

### Guidelines

- [X] I have searched the issue tracker for [open](https://github.com/FreeTubeApp/FreeTube/issues?q=is%3Aopen+is%3Aissue) and [closed](https://github.com/FreeTubeApp/FreeTube/issues?q=is%3Aissue+is%3Aclosed) issues that are similar to the feature request I want to file, without success.
- [X] I have searched the [documentation](https://docs.freetubeapp.io/) for information that matches the description of the feature request I want to file, without success.
- [X] This issue contains only one feature request.

### Problem Description

This is a rehash of a previous (prematurely closed) feature request from issue #576 from 2020 for reconsideration in the Bluetooth audio peripherals landscape of 2024 where it has gained significant popularity and become much more affordable and commonplace.

Unfortunately, latency issues for Bluetooth audio devices have not significantly improved in the last four years without issues with hardware support or codec licensing (i.e. Qualcomm only open-sourcing aptX and aptX HD with latencies ~200-300ms but not the lower latency aptX Adaptive at ~70-150ms) and not all devices support aptX. Some manufacturers opt to use their own proprietary codec like Sony's LDAC, also ~200ms, which Windows's Bluetooth stack does not support (although Windows 11 eventually did get basic aptX). This means, for compatibility, many Bluetooth headphones may fall back to SBC codec with ~220 latency. Whichever the case, today, almost all Bluetooth audio peripherals connected to a PC will have significant audio latency that cannot be ignored. This is the case for headphones, earbuds, and wireless speakers using Bluetooth.

For mobile devices, many video player apps (including Netflix and YouTube) support delaying the video to automatically compensate for this audio delay. Unfortunately, this is not the case for PC. Video players on PC do not handle this automatically and, at most, it has to be configured manually by the user. FreeTube, unfortunately, does not currently support this feature.

Previously in #576, the workaround suggested opening the video with an external player (which may delegate the task entirely to another library the user has to maintain and keep updated manually, such as [yt-dlp](https://github.com/yt-dlp/yt-dlp)), on top of the actual player. This is not only slow, tedious, and error-prone but also does not support FreeTube's many features, such as SponsorBlock, captions, quality selection, and privacy options.

Video and audio having separate streams also seems to be the norm now with DASH formats.

### Proposed Solution

I propose adding a button under the video player that pops open a slider allowing the user the change the audio delay (displayed in milliseconds) and observe its effect by changing the playing video and audio streams in real-time, which allows the user to figure out the delay for their device experimentally. Audio sync test videos are available on YouTube to help with this ([example](https://youtu.be/ucZl6vQ_8Uo)). Setting it to 0ms would disable the feature (no delay). The button itself may be optional and only show when toggled in the settings page (disabled by default, for users without Bluetooth audio peripherals).

For ease of toggle (since users may take off their headphones and switch back to speakers), I also propose adding a checkbox next to the pop up slider to quickly toggle the delay feature on or off.

The slider value and on/off toggle would be saved to settings and applied across all videos.

Optionally, but useful: Automatically toggle the delay on when a Bluetooth peripheral is set as PC's current audio playback device and off otherwise.

### Alternatives Considered

Just adding an audio delay slider to the settings page under Player Settings may be the simplest UI change, outside of the underlying work needed to get audio delay working. But this would be quite inconvenient compared to the proposed solution.

### Issue Labels

new feature

### Additional Information

See [this video](https://youtu.be/U3_b4UEYoWM) for an audible sample of different audio latencies up to 300ms.

In the worst case, Bluetooth can delay up to 300 ms, and as can be heard, it is quite awful.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.