Skip to content

[Feature Request]: Add sleep timer feature for video playback — users have no way to auto-stop playback after a set duration #546

Description

@prince-pokharna

Summary

ARVIO is used as a primary media hub on TV, phone, and tablet. A common use case is falling asleep to content — users want playback to automatically stop after 15, 30, 45, or 60 minutes. This is a standard feature in all major media apps (Netflix, Plex, VLC) and its absence is a noticeable gap for the ARVIO user base.

Problem

  • There is no sleep timer option in the current player controls.
  • The README and changelog (CHANGELOG.md) mention no sleep timer feature in any release up to v1.9.962.
  • Without a sleep timer, TV users must either stay awake to stop playback or leave content running all night.
  • This is particularly relevant for the IPTV live TV use case, where streams run indefinitely.

Proposed Solution

Implement a sleep timer integrated into the Media3/ExoPlayer playback controls:

1 — Sleep timer data model:

// SleepTimer.kt
enum class SleepTimerOption(val minutes: Int?) {
    OFF(null),
    FIFTEEN(15),
    THIRTY(30),
    FORTY_FIVE(45),
    SIXTY(60),
    END_OF_EPISODE(null) // stops after current episode completes
}

2 — ViewModel integration:

// PlayerViewModel.kt
private var sleepTimerJob: Job? = null

fun setSleepTimer(option: SleepTimerOption) {
    sleepTimerJob?.cancel()
    option.minutes?.let { minutes ->
        sleepTimerJob = viewModelScope.launch {
            delay(minutes * 60 * 1000L)
            player.pause()
            _sleepTimerExpired.emit(true)
        }
    }
}

3 — Player UI — sleep timer button in overlay controls (TV remote navigable):

// Show countdown: "Sleep: 28:43" updating every minute
// Long press to cancel

4 — Notification shown when 5 minutes remain: "Playback stops in 5 minutes. Tap to extend."

Additional Notes

  • The "End of Episode" option detects episode completion via the Player.Listener.onMediaItemTransition callback.
  • Timer survives app backgrounding via a foreground service or WorkManager.

I am happy to implement this. Could you assign this issue to me?

Labels: feature, enhancement, player, GSSoC 2026

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions