Skip to content

feat: draggable PiP with fullscreen toggle#415

Merged
barrydeen merged 6 commits intomainfrom
fix/pip-drag-and-zindex
Apr 2, 2026
Merged

feat: draggable PiP with fullscreen toggle#415
barrydeen merged 6 commits intomainfrom
fix/pip-drag-and-zindex

Conversation

@barrydeen
Copy link
Copy Markdown
Owner

@barrydeen barrydeen commented Apr 2, 2026

Summary

  • PiP mini player is now draggable — drag it anywhere on screen
  • Expanding PiP to fullscreen reuses the same ExoPlayer (no re-buffering)
  • Fullscreen has a mini player button to return to PiP mode
  • Back button and close in fullscreen also return to PiP instead of stopping playback
  • Regular (non-PiP) fullscreen is unchanged

Test plan

  • Enter PiP on a video, drag the mini player around the screen
  • Tap expand — verify fullscreen opens with seamless playback
  • In fullscreen, tap the mini player (PiP) button — verify it returns to PiP
  • In fullscreen, press back — verify it returns to PiP
  • Tap close in fullscreen — verify it returns to PiP
  • Open a regular (non-PiP) fullscreen video — verify no PiP button shown, close works normally

Use a Popup window so the floating player renders in its own window layer,
guaranteeing it stays above inline video AndroidViews in the feed. Add drag
gesture support with screen-edge clamping so users can reposition the mini
player anywhere on screen.
…ering

The Popup-based approach caused the PiP to vanish. Revert to the original
Box overlay with AnimatedVisibility, using a FrameLayout wrapper with high
translationZ to ensure the PiP PlayerView renders above inline video
AndroidViews in the feed.
translationZ doesn't work across different Android ViewGroup parents.
Switch to an Android Dialog which creates its own window layer, ensuring
the PiP player always renders above inline video views in the feed.
Drag repositioning uses window attribute manipulation instead of Compose
offset for reliable positioning within the Dialog window.
Fullscreen now expands the PiP dialog to full screen instead of opening a
separate FullScreenVideoPlayer with a new ExoPlayer. Back button or the
mini player button returns to PiP mode. This keeps the same player instance
throughout, so playback never interrupts or orphans.
Remove the Dialog-based approach which caused multiple issues. Restore
the original AnimatedVisibility Box overlay which was stable, adding only
the drag gesture for repositioning. The PiP may go behind inline video
AndroidViews but is otherwise reliable.
When expanding PiP to fullscreen, the same ExoPlayer is reused. The
fullscreen view now has a mini player button to return to PiP. Pressing
back or closing the fullscreen also returns to PiP instead of stopping
playback entirely.
@barrydeen barrydeen changed the title fix: draggable PiP with proper z-ordering feat: draggable PiP with fullscreen toggle Apr 2, 2026
@barrydeen barrydeen merged commit 0647dab into main Apr 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant