frosty/lib/screens/channel/video/native_video_player_interface.dart
Tommy Chow 880a9c92aa fix(video): sync android pip state and playback across both players
Three related PiP gaps on Android:

`handleAndroidPipChanged` lived on `NativeVideoPlayerInterface`, and
`notifyPip` type-checked against it, so the WebView store never learned it
was in PiP — `_isInPipMode` stayed false for the whole session and the
overlay kept auto-hiding behind the PiP window. Moved to the shared
`VideoPlayerInterface` and implemented in both stores. The WebView store's
two JS PiP channel bodies collapse into one `_setPipActive` state machine,
now shared with the Android callback.

`NativeVideoStore` never called `_pip.setIsPlaying()`, so with the
`mediaOnlyPause` layout the PiP window's button was stuck on whatever glyph
it started with, and `onPipAction` — which toggles blind — could do the
opposite of what the button showed.

`VideoStore.handleAppResume()` did nothing in video mode, while the native
store calls `play()`. Backgrounding can suspend the webview's playback with
no way for the page to restart itself, leaving it dead until a manual
refresh. Resumes now unless the user was the one who paused.

Not fixed: PiP with the WebView player. Twitch's embed refuses to play
below 400x300 CSS pixels and a PiP window is far under that, Android
resizes the activity before firing onPictureInPictureModeChanged so any
correction arrives too late, and the embed latches once tripped. The native
player has no such constraint. Refs #563.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-08 11:47:54 -07:00

8 lines
382 B
Dart

import 'package:frosty/screens/channel/video/video_player_interface.dart';
/// Capabilities that only the native player can meaningfully support.
/// Callers that need these must type-check against this interface.
abstract class NativeVideoPlayerInterface extends VideoPlayerInterface {
/// Whether the current quality is an HLS audio-only variant.
bool get isAudioOnlyMode;
}