Skip to content

Native player uses stale cached display preferences, never refreshes after WebView settings change #1908

@skalthoff

Description

@skalthoff

Bug information

Describe the bug

The native video player loads display preferences (skip forward/back length) once in PlayerViewModel.init {} and caches them for the entire app session. When a user changes these settings in the WebView-based settings UI, the native player continues using the old cached values. There is no bridge between the WebView and native player to communicate settings changes.

Affected code:

PlayerViewModel.kt (lines 169-189) loads preferences once at init:

viewModelScope.launch {
    val displayPreferencesDto = withContext(Dispatchers.IO) {
        displayPreferencesApi.getDisplayPreferences(
            displayPreferencesId = Constants.DISPLAY_PREFERENCES_ID_USER_SETTINGS,
            client = Constants.DISPLAY_PREFERENCES_CLIENT_EMBY,
        ).content
    }
    displayPreferences = DisplayPreferences(
        skipBackLength = customPrefs?.get(Constants.DISPLAY_PREFERENCES_SKIP_BACK_LENGTH)?.toLongOrNull()
            ?: Constants.DEFAULT_SEEK_TIME_MS,
        skipForwardLength = customPrefs?.get(Constants.DISPLAY_PREFERENCES_SKIP_FORWARD_LENGTH)?.toLongOrNull()
            ?: Constants.DEFAULT_SEEK_TIME_MS,
    )
}

fastForward() and rewind() (lines 551-557) read exclusively from this cached object:

fun fastForward() {
    playerOrNull?.seekToOffset(displayPreferences.skipForwardLength)
}

There is no @JavascriptInterface method in NativeInterface.kt to receive display preference updates from the WebView, and no mechanism to refresh the cache after settings change.

Steps to reproduce:

  1. Open the Jellyfin Android app
  2. Play a video and note the skip forward duration (default 30s)
  3. Go to Settings > Playback and change Skip Forward Length to 10s, tap Save
  4. Play a video again and use the skip forward button — it still skips 30s
  5. Force-close the app and reopen — now it correctly skips 10s

Expected behavior: Changed skip duration should take effect immediately without requiring an app restart.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions