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

New Year, New Video Player + Other Goodies #593

Merged
merged 135 commits into from Apr 20, 2023

Conversation

LePips
Copy link
Member

@LePips LePips commented Sep 23, 2022

With the new year, this means another one of my huge PRs encompassing months worth of work and not adhering to my own git guidelines.

iOS/iPadOS - New Video Player

The video player has been entirely re-designed with new visuals and customization options. Now mostly in SwiftUI, future features can be more easily implemented and managed which is great for future contributions.

The new video player is influenced by iOS 16's new native video player:

iOS - Movie Default

IMG_9906

iOS - TV Show Default

Simulator Screen Shot - iPhone 14 Pro - 2022-12-19 at 18 13 41

iPadOS - Movie Default

Simulator Screen Shot - iPad Pro (11-inch) (4th generation) - 2023-04-19 at 21 14 51

iPadOS - TV Show Default

Simulator Screen Shot - iPad Pro (11-inch) (4th generation) - 2023-04-19 at 21 17 18

More customization is provided to enhance your playback experience.

Video Player Settings

Simulator Screen Recording - iPhone 14 Pro - 2022-12-20 at 15 13 33

Below are highlights for some of the new features.

Gestures

Actions performed during a gesture are now fully customizable and more can be easily added in the future. During most actions a toast will appear to provide information about the results of the gesture.

New gestures include:

  • long press
  • multi-tap in same area
  • double touch
  • horizontal pan
  • vertical pan with different actions on left/right side
  • pinch
  • swipe

Note: horizontal scrub and horizontal swipe cannot be used together due to gesture detection conflicts

Buttons

There are two places where buttons can appear:

  • the bar, which are buttons always shown on the overlay
  • the menu, which can be accessed by tapping the menu icon.

Now, you are freely able to choose which buttons appear in each area and their ordering.

Slider Color

The slider color can be customized using the new default iOS color picker.

iOS - Slider Color Picker

Slider Type

With the introduction of a new slider type, Capsule, the more familiar Thumb type is also available. These two types contain different behaviors, where Capsule allows the whole slider to be dragged where Thumb only receives input on the thumb.

iOS - Slider Type

Simulator Screen Shot - iPhone 14 Pro - 2022-12-20 at 15 33 55

Subtitles

  • Font: Subtitle font now only uses the font family instead of the font family + style. This was done for simplification.
  • Size: Subtitle size is now a value in the range of 8-24 instead of a list of static values.
  • Color: Subtitle colors have been implemented.

An additional note has been added to Settings to clarify that these settings may not take effect on all subtitle types.

Timestamp

The timestamp can even be configured:

  • Scrub Current Time: Show the current playback time during scrubbing
  • Timestamp Type: Split the time values across the bar or have them compact
  • Trailing Value: Show either the time left or the total duration

Native Player

The native player was previously known as the "experimental player" and was, frankly, only implemented to appease a few people who requested it. Now it is being provided as an explicit option for clarity. It may be removed when the MPV rendering layer has been implemented.

Closed Issues

JellyfinAPI

With the new async/await generated JellyfinAPI, the entire networking stack has been rewritten and is now up to date with new features in Swift. This update fixes a few outstanding issues, like crashes due to force unwrapped optionals, and allows a few other architectural changes to take place, like session dependency injection.

Logs

The entire logging layer has been replaced by Pulse, an amazing framework for network and general logging. Logs can now be viewed inside the app (iOS, iPadOS, and tvOS) for troubleshooting and exporting. All of the UI for logging is provided by PulseUI and fits comfortably in the design of Swiftfin. Lastly, sensitive information like IPs, access tokens, and passwords used in network calls can be redacted so that logs can be safely shared when reporting an Issue.

The issue template will be updated to provide instructions exporting and sharing logs.

iOS Logs
tvOS Logs

Simulator Screen Shot - Apple TV 4K (3rd generation) - 2023-04-19 at 21 50 33

Other UX Improvements

Many UX improvements have also been incorporated. I would work on these to take my mind of off the refactor as they give me little wins to keep up motivation.

Below are some highlights.

App Accent Color

The accent color used throughout the app can be changed from the default purple used by Swiftfin. Some views that contain text use this accent color and will dynamically update the text color for the best contrast.

Note: some views may require an app restart to update as they are redrawn and receive the new color.

iOS - Color Picker

Simulator Screen Recording - iPhone 14 Pro - 2022-12-20 at 15 48 32

iOS - Blue Play Button

App Icon

The app icon is now customizable in a few different colors and styles. More app icons can be added in the future by the community and guidelines for what designs will be accepted will be made in the future.

iOS - App Icon Selection

Simulator Screen Recording - iPhone 14 Pro - 2022-12-20 at 15 53 14

iOS - Home Screen

iOS - Cinematic Item Image

When using the Cinematic item view type, currently it will use the backdrop along with the logo. The backdrop is a landscape image being used in a portrait context so most posters won't be framed nicely. So, an option was added when using the Cinematic item view type to instead use the portrait photo. This does not bring any tangible benefits, but is an option nonetheless. What should ultimately happen is the server allowing another portrait image with no language tag which would work in portrait design contexts.

Extras

Basic functionality for extras have been added. While extras technically have progress user data associated with them, I have deliberately left out indicators/played state handling as I don't see much utility in them. However, this can be added in the future if truly desired.

Haptics

Basic haptics were added for basic feedback such as favoriting, setting played status, and scrubbing over chapters on the slider. Haptics can be disabled in Settings.

Indicators

Indicators on posters were added to indicate whether an item has been favorited, played, unplayed, or is in progress. The presence of these individual indicators is customizable in Settings.

Item Pages

Items contain a lot of fields and the app retrieves a lot of items. Network calls for items will now only retrieve a minimum set of fields to increase network and memory performance. Only when an item is selected will the full information for the item be retrieved.

Item Video Player Routing

Previously, item pages retrieved playback information in the background, which allowed a quick launch of video playback, however caused more issues as this was a bad UX decision. Now, when launching the video player it will retrieve playback information synchronously and present a loading view.

Library Image

In a previous release, I had made it so that libraries would retrieve a random item to use as a background image. However, I had neglected the fact that library images can be set by the server. You may now decide between the random and server-set option.

Settings

All settings are now in new menus with a consideration for descriptions, organization, and ordering.

Other

tvOS

tvOS didn't receive as much attention as iOS/iPadOS, but some features are highlighted below.

Horizontal Scrolling Lag

The latest tvOS releases have introduced significant lag when scrolling horizontally through items. I tracked this down to the .focused(...) modifier that was used to indicate that an item was, well, focused. While performance is fine among just a few items (like user buttons for signing in), lag compounds when used among many items. This issue has been tracked to SwiftUI itself, among many other performance issues.

However, knowing what item is focused is essential to views like the cinematic view on the home screen. To mostly fix this the modifier is only set if the focus state is desired, improving performance for all horizontal scrolling views except for the cinematic view. I find this acceptable since users tend to slow down on this view and not rapidly scroll.

Overall I find this saddening, as it would have been beneficial to know the focus state to set the title color between white/grey, better mirroring the UIKit (but unusable) views.

Cinematic Library Background

Libraries now have a background that will change to the background of the selected item. Currently, the tab bar is still shown as a limitation of SwiftUI, but I have some ideas to work around it.

tvOS Cinematic LIbrary

Simulator Screen Recording - Apple TV 4K (2nd generation) - 2023-04-19 at 22 09 41

Other

Just to list a few:

Future Work

Currently, this PR does break some stuff and will live in TestFlight while fixes and localizations are implemented.

My Thoughts

I worked way too long on this and wanted this done forever ago. However, life happens and gets in the way sometimes. Nothing we can do but keep moving forward.

@LePips LePips marked this pull request as ready for review April 20, 2023 04:19
@LePips LePips requested a review from PangMo5 April 20, 2023 04:19
PangMo5
PangMo5 previously approved these changes Apr 20, 2023
Copy link
Member

@PangMo5 PangMo5 left a comment

Choose a reason for hiding this comment

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

This is a large PR. I think it would be a good idea to merge this PR first, and then post a separate PR to fix any issues or comments you have with the code.
The changes are very cool.
Thanks for the great work!

@PangMo5
Copy link
Member

PangMo5 commented Apr 20, 2023

CI failed, do we need a fix?

@LePips
Copy link
Member Author

LePips commented Apr 20, 2023

Yes, but I have messed up Homebrew on my machine so it may take a while.

Regarding "reviewing this PR", that will just take place as active development instead of a direct response to this PR.

@LePips
Copy link
Member Author

LePips commented Apr 20, 2023

The build errors come from my VLCUI package which is new as of this PR. The package itself does not contain the Carthage dependencies and instead links to them through the master project. This same error does come up upon first building the project from a package cache reset during normal development but is fixed by just rebuilding a second time. So, it looks like either the CI system will need some work or I will need to find a different way to link/incorporate VLCUI.

@PangMo5 If you're able to check my branch out and build both projects on the latest Xcode, we can consider that good in the meantime.

@PangMo5
Copy link
Member

PangMo5 commented Apr 20, 2023

@PangMo5 If you're able to check my branch out and build both projects on the latest Xcode, we can consider that good in the meantime.

I'm using Xcode 14.3 and there seem to be two errors.

The first is that the R.swift (named R.swift, but the internal command is swiftgen) Build Phase doesn't seem to be working correctly.

This could be an issue with my settings.

The second is https://github.com/gunterhager/UDPBroadcastConnection

carthage update --use-xcframeworks fails to build the framework with the error below.

Build Failed
	Task failed with exit code 70:
	/usr/bin/xcrun xcodebuild -project /Users/pangmo5/gitRepo/Swiftfin/Carthage/Checkouts/UDPBroadcastConnection/UDPBroadcast.xcodeproj -scheme UDPBroadcast\ tvOS -configuration Release -derivedDataPath /Users/pangmo5/Library/Caches/org.carthage.CarthageKit/DerivedData/14.3_14E222b/UDPBroadcastConnection/v5.0.3 -sdk appletvos ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES archive VALIDATE_WORKSPACE=NO -archivePath /var/folders/0p/wl3js02j5dncgjlf_nqd368m0000gn/T/UDPBroadcastConnection SKIP_INSTALL=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=NO CLANG_ENABLE_CODE_COVERAGE=NO STRIP_INSTALLED_PRODUCT=NO (launched in /Users/pangmo5/gitRepo/Swiftfin/Carthage/Checkouts/UDPBroadcastConnection)

After that, when I build the project, I get the following error due to that library.

Module compiled with Swift 5.6.1 cannot be imported by the Swift 5.8 compiler: /Users/pangmo5/Library/Developer/Xcode/DerivedData/Swiftfin-elzjbtxrpsakmmflotepvnfjletj/Index.noindex/Build/Products/Debug-iphoneos/UDPBroadcast.framework/Modules/UDPBroadcast.swiftmodule/arm64-apple-ios.swiftmodule

If you pull your project into a new folder and build it, does it still build?

@LePips
Copy link
Member Author

LePips commented Apr 20, 2023

swiftgen has always complained since it is run on every build but that is just a warning.

The Carthage dependencies are complaining because they were built with Swift 5.6.1 and not 5.8. You will need to delete the contents of the Carthage folder and rebuild.

@PangMo5
Copy link
Member

PangMo5 commented Apr 20, 2023

swiftgen has always complained since it is run on every build but that is just a warning.

The Carthage dependencies are complaining because they were built with Swift 5.6.3 and not 5.8. You will need to delete the contents of the Carthage folder and rebuild.

Ah, right, I cleared the Carthage folder and did carthage update --use-xcframeworks again and it works fine.

There's a swift 5.8 syntax issue, so I get an error, but after fixing that, it works.

I checked that both Swiftfin and Swiftfin tvOS build fine in Xcode 14.3.

@LePips LePips merged commit a08a92e into jellyfin:main Apr 20, 2023
1 of 3 checks passed
@LePips LePips deleted the refactor-video-playback branch April 20, 2023 15:33
@taedium8vitae

This comment was marked as spam.

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