Skip to content

[iOS] Exiting video player turns episode picker to placeholder #1643

@samglt

Description

@samglt

Describe the bug

Playing an episode of a series from the series view and then exiting causes the episode selector to change to a placeholder view.

This started happening after #1589 which refreshes the SeriesItemViewModel after exiting the player. I see that the recordings in the PR don't show this, but in my simulator and on my own devices this happens every time.

If I add a sleep of a few hundred ms in the SeriesItemViewModel's refresh method here between when the seasons are cleared and re-added then this stops happening. I see that the recordings in the PR have a significant lag before the episode selector reappears after exiting the player, so I think this is why it's not happening for everyone.

After the series VM is refreshed, all the season VMs are in initial state (so the episode selector shows a placeholder) and if there's enough of a delay the SeriesEpisodeSelector view will notice and refresh the current season, but if it's too fast nothing happens and it stays in initial.

Adding the following to SeriesEpisodeSelector does fix this problem, but it also makes the selector flash and lose its place (see second clip).

.onChange(of: selectionViewModel?.state) { _ in
    guard let selectionViewModel else { return }

    if selectionViewModel.state == .initial {
        selectionViewModel.send(.refresh)
    }
}
Issue
refresh.mov
Partial Fix
refresh2.mov

Application version

main

Where did you install the app from?

None

Device information

Simulator, iPhone 11, others

OS version

18.5

Jellyfin server version

10.10.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions