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

Migrate video player from video.js to shaka-player #4978

Merged
merged 128 commits into from
Sep 2, 2024

Conversation

absidue
Copy link
Member

@absidue absidue commented Apr 18, 2024

Migrate video player from video.js to shaka-player

Pull Request Type

  • Bugfix
  • Feature Implementation

Related issue

Description

After almost a years worth of work, here is the shaka-player migration.

Significant improvements and new features

  • vp9 and opus during DASH playback. vp9 only works on the local API and Invidious instances that have a version number of 2024.07.21 or newer.
  • The video player will now match the users display language when possible (41/45 locales) and custom player elements added by FreeTube are now translatable. shaka-player doesn't support Estonian et (eesti keel), Basque eu (Euskera), Galician gl (galego) and Icelandic is (Íslenska), for those languages it will use English (US) instead.
  • Stats are now supported for all 3 Media Formats, not just DASH.
  • Switching formats will keep your playback rate, selected subtitle, audio language and video quality settings, additionally the player will no longer flash while switching.
  • The player should be a lot more usuable on mobile screens, as player elements get moved into an overflow menu when they don't fit.
  • You can now watch just finished live streams (Post-Live-DVR) from the start with the local API and you'll get thumbnails on the seek bar when they are available (the thumbnails seem to be missing on about 50% of Post-Live-DVR streams).
  • The video player will pick up most settings changes without having to leave the watch page, such as changing the display language or the playback rate interval.
  • Subtitles will now work on live streams that have them (very rare but they do exist).
  • Support for VR videos that use equirectangular projection, shaka-player doesn't support YouTube's other projection types yet, local API only (The ANDROID_TESTSUITE client that Invidious uses, claims that all video streams use normal rectangular projection, so we don't have a way to identify VR videos through Invidious).

Significant bug fixes

  • The subtitle translation feature now works on all videos, not just ones that are in English local API only.
  • Starting at a certain timestamp from the video URL or resuming a partially watched video, should now work all the time, instead of just randomly.
  • Long videos start straight away and no longer freeze FreeTube for almost a minute.

Missing/Removed features

  • shaka-player doesn't have any subtitle settings. Maybe in the future we could implement our own ones, but it's not-trivial to implement, so creating a replacement is out-of-scope for this pull request.
  • I removed the ability to seek into sponsor block segments that are set to skip, as it was causing the skipping to not work properly, due to the existing implementation being fundamentally flawed. If someone would like to add something like that back in the future, it should require a specific user-interaction to unskip the segment, e.g. a button in the skip message, instead of allowing users to manually seek into the segment.

Known issues

  • Focus is not restored properly from exiting video player menus using keyboard navigation (will not be addressed in this pull request).

Screenshots

DASH

dash

DASH with controls faded away

dash-controls-faded-away

DASH in full screen mode

dash-fullscreen

DASH in full window mode

dash-full-window

DASH stats

dash-stats

Audio only with seek bar thumbnails and stats visible

audio-only-with-stats-thumbnails

Audio only with quality selector visible

audio-only-with-stats-quality

DASH with a vertical video/short

short-dash

Audio only with a vertical video/short and the FreeTube locale preference set to French

ui-language-french

Mobile audio only with the the overflow menu closed

mobile-menu-closed

Mobile audio only with the overflow menu open

mobile-menu-open

Mobile DASH with the overflow menu open on a video with subtitles and multiple audio languages

mobile-menu-open-everything

VR video that uses equirectangular projection

vr-equirectangular-projection

Testing

Desktop

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

@absidue
Copy link
Member Author

absidue commented Apr 21, 2024

Relevant Invidious pull requests:

  • Fix proxying live DASH streams iv-org/invidious#4589
    Current workaround: Use HLS manifests when proxying is enabled, which means no seeking but at least you can still watch the live stream.
  • API: Return actual stream height, width and fps iv-org/invidious#4586
    Current workaround: Fetch the DASH manifest in addition to making the API request, as their DASH manifest doesn't use harcoded values. However as Invidious' player doesn't support WebM DASH, they only include the h264 and AV1 streams in the DASH manifests, so supporting vp9 when Invidious is used as the backend or proxying is enabled is not currently possible.

This comment was marked as outdated.

1 similar comment

This comment was marked as duplicate.

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

This comment was marked as outdated.

Co-authored-by: ChunkyProgrammer <78101139+ChunkyProgrammer@users.noreply.github.com>

This comment was marked as outdated.

@PikachuEXE
Copy link
Collaborator

Tested live streams
Re-tested auto generated caption for 4.0.11
No idea what else or if anything else should be tested

@ngocphamm

This comment was marked as resolved.

@PikachuEXE
Copy link
Collaborator

Player settings > Display play button in video player

@ngocphamm

This comment was marked as resolved.

@github-actions github-actions bot added PR: merge conflicts / rebase needed and removed PR: waiting for review For PRs that are complete, tested, and ready for review labels Aug 26, 2024
Copy link
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

Copy link
Contributor

Conflicts have been resolved. A maintainer will review the pull request shortly.

Copy link
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

Copy link
Contributor

Conflicts have been resolved. A maintainer will review the pull request shortly.

@PikachuEXE
Copy link
Collaborator

No further tests from me (except daily test via custom build) until something else popups up

Copy link
Member

@ChunkyProgrammer ChunkyProgrammer left a comment

Choose a reason for hiding this comment

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

I'm approving under the assumption that we will do a Release Candidate sometime before the next full release

@absidue
Copy link
Member Author

absidue commented Aug 30, 2024

A release candidate sounds good to me, as this pull request contains a lot of changes.

@absidue absidue added the PR: waiting for review For PRs that are complete, tested, and ready for review label Aug 31, 2024
Copy link
Collaborator

@PikachuEXE PikachuEXE left a comment

Choose a reason for hiding this comment

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

Let's RC

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

This comment was marked as outdated.

@FreeTubeBot FreeTubeBot merged commit b3ff837 into FreeTubeApp:development Sep 2, 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 2, 2024
@absidue absidue deleted the shaka-migration branch September 2, 2024 20:02
PikachuEXE added a commit to PikachuEXE/FreeTube that referenced this pull request Sep 3, 2024
* development: (49 commits)
  Translated using Weblate (Serbian)
  Translated using Weblate (Turkish)
  Translated using Weblate (English (United Kingdom))
  Translated using Weblate (Italian)
  Translated using Weblate (Chinese (Simplified Han script))
  Translated using Weblate (Italian)
  Translated using Weblate (Italian)
  Translated using Weblate (Italian)
  Translated using Weblate (Italian)
  Translated using Weblate (French)
  Translated using Weblate (German)
  Bump swiper from 11.1.10 to 11.1.12 (FreeTubeApp#5635)
  Translated using Weblate (Spanish)
  Bump the stylelint group with 2 updates (FreeTubeApp#5633)
  Migrate video player from video.js to shaka-player (FreeTubeApp#4978)
  Bump lefthook from 1.7.14 to 1.7.15 (FreeTubeApp#5634)
  Bump electron-context-menu from 4.0.2 to 4.0.4 (FreeTubeApp#5636)
  Bump youtubei.js from 10.3.0 to 10.4.0 (FreeTubeApp#5637)
  Cleanup the Hide Profile Pictures in Comments code (FreeTubeApp#5625)
  Switch to non-deprecated Electron navigation history APIs (FreeTubeApp#5626)
  ...

# Conflicts:
#	src/renderer/store/modules/index.js
@CodingMadness

This comment has been minimized.

@FreeTubeApp FreeTubeApp locked and limited conversation to collaborators Sep 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.