1.3 KiB
1.3 KiB
Player Enhancements Design
1. Pause Shows Controls
- Add
Player.Listenerto ExoPlayer, monitoronPlayWhenReadyChanged - When
playWhenReadybecomes false: show control panel, cancel auto-hide timer - When
playWhenReadybecomes true: restart auto-hide timer - WebView playback: not supported (can't detect pause)
2. Brightness/Volume Gestures
- Replace click listener with
OnTouchListeneron playerView/playerWebView ACTION_DOWN: record startY, determine left/right half of screen- Left half: brightness mode
- Right half: volume mode
ACTION_MOVE: calculate deltaY, adjust brightness/volume proportionallyACTION_UP: if delta < threshold, treat as click (toggle controls); reset state- Brightness:
window.attributes.screenBrightness(activity-scoped, no permission) - Volume:
AudioManager.setStreamVolume(STREAM_MUSIC, ...) - Show floating indicator (TextView overlay) during adjustment
3. Playback Position Resume
- Add
playbackPosition: Long?toPlayHistoryentity - Add
updatePosition(id, position)toPlayHistoryDao - Save position every 5 seconds via handler, and on pause/destroy
- On player entry: read position from history, seek to it after prepare
- Pass
resume_positionvia Intent from SearchFragment - ExoPlayer only (WebView excluded)