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

Proxy live streams when "Proxy Videos Through Invidious" is enabled #5649

Merged
merged 1 commit into from
Sep 10, 2024

Conversation

absidue
Copy link
Member

@absidue absidue commented Sep 4, 2024

Proxy live streams when "Proxy Videos Through Invidious" is enabled

Pull Request Type

  • Feature Implementation

Description

Currently FreeTube doesn't proxy live streams through Invidious, this pull request adds support for that. As you can tell from the code it requires some hackiness to get it to work:

  1. Invidious swaps out the path parameters for query parameters, which means the URL no longer looks like a file path with a file extension, so shaka-player isn't able to guess the mime type based on the file extension, it does then try to do a HEAD request to check the Content-Type header but that's application/octet-stream, so also not useful.
  2. Then I came up with a fix that worked with Invidious instances that use the built-in video proxy in Invidious but broke with ones using the Piped video proxy
  3. The fix to get it working on the Piped video proxy broke with Invidious' own video proxy again
  4. Finally I found something that worked with both video proxies and allowed shaka-player to actually play it

The code has various comments that explain what each bit does, so hopefully we'll all know what it does and why it is there in the future.

Testing

  1. Turn on the "Proxy Videos Through Invidious" setting
  2. Watch live videos e.g. https://youtu.be/jfKfPfyJRdk with both the local and the Invidious API
  3. Check the Network tab of the devtools that the index.m3u8 and seg.ts requests are going to your currently selected Invidious instance.

Desktop

  • OS: Windows
  • OS Version: 10
  • FreeTube version: 45c8caf

@FreeTubeBot FreeTubeBot enabled auto-merge (squash) September 4, 2024 20:58
@github-actions github-actions bot added the PR: waiting for review For PRs that are complete, tested, and ready for review label Sep 4, 2024
@PikachuEXE
Copy link
Collaborator

Can't test yet, got issue playing any video in local/IV API in dev ("Proxy Videos Through Invidious" on

image

Or you got a working instance? (I tried a few from https://api.invidious.io already

Copy link
Member

Choose a reason for hiding this comment

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

lgtm

@absidue
Copy link
Member Author

absidue commented Sep 5, 2024

Can't test yet, got issue playing any video in local/IV API in dev ("Proxy Videos Through Invidious" on
Or you got a working instance? (I tried a few from https://api.invidious.io already

As that bug only affects non-live videos and this pull request is about live videos, any of the instances on the list should work :).

@PikachuEXE
Copy link
Collaborator

Still can't with instance https://invidious.perennialte.ch with invidious.jing.rocks
(They use diff versions)

image

image
image

Just instances outdated?

@absidue
Copy link
Member Author

absidue commented Sep 7, 2024

Invidious returning a 403 usually means it got a 403 from YouTube, so probably that instance is IP blocked for live streams or something.

During my testing https://iv.ggtyler.dev and https://invidious.reallyaweso.me worked well.

@FreeTubeBot FreeTubeBot merged commit da1514b into FreeTubeApp:development Sep 10, 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 Sep 10, 2024
@absidue absidue deleted the live-proxying branch September 11, 2024 04:17
PikachuEXE added a commit to PikachuEXE/FreeTube that referenced this pull request Sep 12, 2024
* development: (24 commits)
  Add ability to see comment replies of community posts through invidious (FreeTubeApp#5589)
  Bump electron-builder from 24.13.3 to 25.0.5 (FreeTubeApp#5674)
  Change Sponsorblock Default Category Colors (FreeTubeApp#5686)
  Proxy live streams when "Proxy Videos Through Invidious" is enabled (FreeTubeApp#5649)
  Translated using Weblate (Belarusian)
  Translated using Weblate (Hebrew)
  Fix saving Invidious thumbnail URLs for subscriptions (FreeTubeApp#5662)
  Bump peter-evans/create-pull-request from 6 to 7 (FreeTubeApp#5676)
  Bump webpack-dev-server from 5.0.4 to 5.1.0 (FreeTubeApp#5672)
  Use auto-generated playlists for the videos tab on artist topic channels (FreeTubeApp#5661)
  Rewrite locale file updating to be more Vue 3 friendly (FreeTubeApp#5660)
  Bump sass from 1.77.8 to 1.78.0 (FreeTubeApp#5673)
  Bump electron from 32.0.1 to 32.0.2 (FreeTubeApp#5671)
  Bump marked from 14.1.0 to 14.1.2 (FreeTubeApp#5670)
  Bump postcss from 8.4.44 to 8.4.45 in the stylelint group (FreeTubeApp#5669)
  Bump the eslint group with 2 updates (FreeTubeApp#5668)
  Cleanup a few vue-i18n usages (FreeTubeApp#5663)
  Use nextTick instead of setTimeout to wait until Vue has rendered changes (FreeTubeApp#5664)
  Translated using Weblate (Estonian)
  Translated using Weblate (Belarusian)
  ...

# Conflicts:
#	src/renderer/components/ft-community-post/ft-community-post.js
#	src/renderer/helpers/api/local.js
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