pub async fn player_on_playback_ended(
player: State<'_, PlayerStateWrapper>,
repository_manager: State<'_, RepositoryManagerWrapper>,
db: State<'_, DatabaseWrapper>,
item_id: Option<String>,
repository_handle: Option<String>,
) -> Result<(), String>Expand description
Handle playback ended event - triggers autoplay decision logic This is called from:
- Frontend when HTML5 video ends (Linux/desktop) - passes itemId + repositoryHandle for the video
- Frontend when audio track ends via backend event - no itemId/repositoryHandle needed
- Android JNI callback also triggers this logic directly
TRACES: UR-023, UR-026, UR-040 | DR-047, DR-052, DR-129