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

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

Draft
wants to merge 43 commits into
base: development
Choose a base branch
from

Conversation

absidue
Copy link
Member

@absidue absidue commented Apr 18, 2024

DRAFT: 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 due to Invidious limitations
  • 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 with keep your playback rate, selected subtitle, audio language and video quality settings and 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.
  • Seeking on live streams when the uploader hasn't disabled it (4 hours back for normal ones, 2 hours on low latency live streams). Not supported when video proxying is enabled, as Invidious doesn't support proxying DASH live streams.
  • 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), local API only.
  • 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.
  • 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 straigh 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

  • The error handling for fatal errors isn't finished yet, it gets logged to the console but it doesn't show the message in the UI yet.
  • Invidious' video proxy doesn't support live or post live DVR DASH, so we have to keep using the HLS manifests when the "Proxy Videos Through Invidious" setting is enabled, which means you can't seek in them or use the captions if there are any.
  • Invidious' DASH manifests don't include the vp9 or opus streams and the API doesn't return enough information on the vp9 streams for us to be able to generate our own DASH manifest for them (height and width are missing), so vp9 playback is only supported on the local API, when "Proxy Videos Through Invidious" is disabled. Return actual height, width and fps for streams in /api/v1/videos iv-org/invidious#4586
  • 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

Live DASH at live edge

live-dash-live-edge

Live DASH seeked back a few hours

live-dash-seeked

Live audio only with subtitles

live-audio-seeked-subtitles

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:

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.

This comment was marked as outdated.

This comment was marked as outdated.

efb4f5ff-1298-471a-8973-3d47447115dc

This comment was marked as resolved.

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

Bugs found :)

VirtualBoxVM_rSYCV6aiZM.mp4
VirtualBoxVM_oANe1ccYRQ.mp4

This comment was marked as outdated.

@absidue
Copy link
Member Author

absidue commented May 20, 2024

I unfortunately can't solve the second one properly, unless we want to add an extra if on every second line in that file. The problem is that you are navigating too quickly, so the player component is getting destroyed in the middle of the asynchronous setup and as the setup is asynchronous it means that every single line could cause an error.

This comment was marked as outdated.

Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment