[iOS] Rotation doesn't work in new media player
As noted in #1581, there are some issues when rotating the new player view. Transcoded video doesn't properly fill the screen and locks up until you force quit the app, and on my device non-transcoded video also doesn't fill the screen, but you can still rotate back to portrait without quitting the app.
This happens on iOS 18 & 26 on my devices
Example
https://github.com/user-attachments/assets/9303c7e1-bb4a-4fa1-a6f7-2e77833e23d0
Looking into it more, I think the screen filling issue is related to the NavigationRoute's .fullscreen transition style, since I can replace the VideoPlayerViewShim here with a Rectangle and the screen still doesn't fill on rotation. I can also use change .fullscreen to .push and the player rotates fine.
I was looking at this for #1713 and I was noticing that the fullscreen for iOS is a lot busier compared to tvOS. This could be related to what's going on here:
NavigationInjectionView.swift:
.presentation(
$coordinator.presentedFullScreen,
transition: .zoomIfAvailable(
options: .init(
dimmingVisualEffect: .systemThickMaterialDark,
options: .init(
isInteractive: isPresentationInteractive
)
),
otherwise: .slide(.init(edge: .bottom), options: .init(isInteractive: isPresentationInteractive))
)
) { routeBinding, _ in
let vc = UIPreferencesHostingController {
NavigationInjectionView(coordinator: .init()) {
routeBinding.wrappedValue.destination
.environment(\.presentationControllerShouldDismiss, $isPresentationInteractive)
}
}
// TODO: presentation options for customizing background color, dimming effect, etc.
vc.view.backgroundColor = .black
return vc
}
That's part of the new player change, it was simpler previously. I haven't checked what happens if you replace it with the previous commit
On iOS/iPadOS Transmission.PresentationLink is used to get more complex behavior. In the app delegate, the top-most UIPreferencesHostingController is then used to determine the orientation mask.
However, I'm now wondering if my comment:
ultimately different than https://github.com/jellyfin/Swiftfin/issues/1149.
is incorrect, as this is mostly seen with transcoded streams with VLCKit. Meaning, I'm wondering if there's a threading issue that's causing the UIPreferencesHostingController to not properly respond and become unresponsive.
I have a partial fix for this, updating the frame size in UIPreferencesHostingController. This doesn't affect the transcoded video side of this; the UI still stops responding and the video player doesn't resize either, even though it fixes the issue in non-transcoded video like in my above example.
override public func viewWillTransition(
to size: CGSize,
with coordinator: any UIViewControllerTransitionCoordinator
) {
super.viewWillTransition(to: size, with: coordinator)
view.frame.size = size
}
It doesn't look pretty, but making it look good is beyond my UIKit knowledge.
https://github.com/user-attachments/assets/4957fd01-737e-460d-9a25-459a2140c2e9
A few more notes about the transcoded video issue:
- I can avoid it when playing a video by immediately rotating my device while it's buffering, while waiting til it's playing causes the issue, which seems to be the opposite of what Joe experienced.
- When I cause the issue in a fast release build, it looks exactly the same as before, but if I cause it in a slow debug build it also causes the video itself (not the controls) to stretch vertically and stay that way. That does sound like some kind of threading issue.
Hm, now I'm facing this on every stream - which certainly didn't happen during development.
Hm, now I'm facing this on every stream - which certainly didn't happen during development.
For the time being, to get the TestFlight out, does it make sense to keep this locked in landscape like previous? Then shoot to resolve this for the final 1.4 (worst case 1.5).
Marking as External as this seems to be related to the Transmission package.
After #1719 I still get this sometimes, with the following rough steps:
- I'm playing something
- Exited the app for a couple minutes with the audio paused
- Re-opened swiftfin to find the overlay responds but the video doesn't play
- Exited the player
- The interface outside the player isn't responding to input
yes need to auto landscape on play, now is locked potrait unless phone rotate is on, prev build is fine. using streamfin/infuse now