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

Better player error handling #6180

Merged
merged 4 commits into from
Nov 21, 2024

Conversation

absidue
Copy link
Member

@absidue absidue commented Nov 17, 2024

Better player error handling

Pull Request Type

  • Bugfix

Related issue

closes #6028
closes #6198
Probably also #6074

Description

This pull request makes various changes to the player error handling.

  1. When an error happens that we consider to be critical enough to trigger a format fallback, we now ignore any other errors that occur because of the previous format, as the legacy formats can throw multiple errors in a row, which ends up interrupting the fallback to the audio formats, which then throws an error because it got interrupted and we end up in an extremely quick loop piling up thousands of errors in just a few seconds as it attempts to fallback and keeps interrupting itself. This results in it being impossible to do anything with the window as it is stuck in that endless loop.
  2. We now fully unload the previous format during a format switch before loading the next one, this helps with number 1 as we can separate which errors happened when and helps slow down the fallbacks and errors, giving the user more time to leave the page if they do end up in an error loop
  3. We now ignore errors when destroying the player, while I haven't found any direct problems caused by that, it's just a precaution to hopefully allow the user to always leave the watch page.
  4. When an error happens in the response filter, shaka-player throws a RESPONSE_FILTER_ERROR which is a wrapper around the original error, previously we weren't unwrapping the nested errors so we didn't actually log or look at the original error.
    This can happen if the user is using a blocked IP and uses an Invidious instance far away from them without having Proxy Videos Through Invidious enabled. In that scenario YouTube will redirect you multiple times to give you a googlevideo server that is closer to your IP address and the last redirect will get a 403 from YouTube because of your blocked IP, this then results in RESPONSE_FILTER_ERROR -> RESPONSE_FILTER_ERROR -> RESPONSE_FILTER_ERROR -> BAD_HTTP_STATUS error chain. We have handling for BAD_HTTP_STATUS errors but we weren't getting to that before because we weren't looking at the original error.

Testing

  1. Check that changing formats still works
  2. If you have access to a blocked IP address: Use the Invidious API with Proxy Videos Through Invidious disabled and check that the 403 IP block message shows up, instead of it switching formats.

Desktop

  • OS: Windows
  • OS Version: 10
  • FreeTube version: f9736fb

@FreeTubeBot FreeTubeBot enabled auto-merge (squash) November 17, 2024 14:25
@github-actions github-actions bot added the PR: waiting for review For PRs that are complete, tested, and ready for review label Nov 17, 2024
@efb4f5ff-1298-471a-8973-3d47447115dc
  1. Check that changing formats still works

Error :(

VirtualBoxVM_btnuayIo5J.mp4
  1. If you have access to a blocked IP address: Use the Invidious API with Proxy Videos Through Invidious disabled and check that the 403 IP block message shows up, instead of it switching formats.

Looks to be working correctly

VirtualBoxVM_kO3I1g2Niz.mp4

@efb4f5ff-1298-471a-8973-3d47447115dc efb4f5ff-1298-471a-8973-3d47447115dc added PR: changes requested and removed PR: waiting for review For PRs that are complete, tested, and ready for review labels Nov 17, 2024
@absidue absidue added PR: waiting for review For PRs that are complete, tested, and ready for review and removed PR: changes requested labels Nov 19, 2024
@absidue
Copy link
Member Author

absidue commented Nov 19, 2024

Should be fixed now.

@efb4f5ff-1298-471a-8973-3d47447115dc

still doesnt work :(

VirtualBoxVM_yMdGa5Sefo.mp4

@absidue absidue added PR: waiting for review For PRs that are complete, tested, and ready for review and removed PR: changes requested labels Nov 20, 2024
@FreeTubeBot FreeTubeBot merged commit d555278 into FreeTubeApp:development Nov 21, 2024
5 checks passed
@github-actions github-actions bot removed the PR: waiting for review For PRs that are complete, tested, and ready for review label Nov 21, 2024
@absidue absidue deleted the better-player-errors branch November 21, 2024 05:16
PikachuEXE added a commit to PikachuEXE/FreeTube that referenced this pull request Nov 24, 2024
* development: (273 commits)
  Translated using Weblate (Serbian)
  Translated using Weblate (Czech)
  Translated using Weblate (French)
  Translated using Weblate (German)
  Translated using Weblate (Spanish)
  Fix text colour in player overflow menu (FreeTubeApp#6213)
  Add warning message to proxy settings (FreeTubeApp#6099)
  Migrate SubscribedChannels view to Composition API (FreeTubeApp#6131)
  Translated using Weblate (Croatian)
  Translated using Weblate (English (United Kingdom))
  Translated using Weblate (Afrikaans)
  Translated using Weblate (Afrikaans)
  Better player error handling (FreeTubeApp#6180)
  Translated using Weblate (Arabic)
  Translated using Weblate (Afrikaans)
  local API: Fix playlists and podcasts not appearing in search results (FreeTubeApp#6196)
  Translated using Weblate (Serbian)
  Translated using Weblate (Hungarian)
  Bump shaka-player from 4.11.11 to 4.12.1 (FreeTubeApp#6193)
  Translated using Weblate (French)
  ...

# Conflicts:
#	src/renderer/views/SubscribedChannels/SubscribedChannels.js
Soham456 pushed a commit to Soham456/FreeTube that referenced this pull request Dec 5, 2024
* Better player error handling

* Fix format switching

* Fix legacy quality handling
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants