Skip to content

Add Picture-in-Picture mode for the player - #78

Open
Omurshid wants to merge 1 commit into
Stremio:mainfrom
Omurshid:feature/picture-in-picture
Open

Add Picture-in-Picture mode for the player#78
Omurshid wants to merge 1 commit into
Stremio:mainfrom
Omurshid:feature/picture-in-picture

Conversation

@Omurshid

@Omurshid Omurshid commented Jun 4, 2026

Copy link
Copy Markdown

Summary

Adds a Chrome-extension-style Picture-in-Picture mode: a floating, always-on-top window that detaches the MPV video from the main window so playback continues while you browse the catalog. The same MPV instance is reparented (SetParent, no re-buffering) into the PiP window and returned to the main window on exit.

Features

  • Floating PiP window — borderless, draggable, and resizable; stays on top of other apps. Position/size are persisted across sessions.
  • Glass controls overlay — a custom GDI+ overlay (restore, close, play/pause, skip, seek slider, transparency toggle) that auto-hides shortly after the cursor leaves the window. Drawn as individual rounded "pills" via a window region so the video shows through the gaps.
  • Transparency toggle — flips the PiP window to ~60% opacity (WS_EX_LAYERED) so you can see content behind it; the state is remembered.
  • Native PiP button — injected into the web player controls by cloning Stremio's own fullscreen button, so it inherits the exact styling and auto-hide behavior. Also available from the system-tray menu.

How it works

The toggle is plumbed through the existing web↔shell IPC, mirroring the fullscreen flow:
win-set-pip (web → shell) triggers a notice handled on the UI thread; state is broadcast back with win-pip-changed. Entering PiP locates MPV's child render window and reparents it into the floating window; exiting reparents it back and re-fits the WebView.

New files

  • src/stremio_app/pip_window.rs — the floating window, GDI+ overlay, drag/resize, transparency, MPV reparenting.
  • src/stremio_app/mpv_hwnd.rs — locates MPV's child render window.

Notes

  • Windows-only, consistent with the rest of the shell.
  • cargo build, cargo clippy, and cargo test are all clean (0 warnings).

🤖 Generated with Claude Code

Adds a floating, always-on-top Picture-in-Picture window that detaches the
MPV video from the main window so playback can continue while browsing the
catalog. The same MPV instance is reparented (SetParent, no re-buffering)
into the PiP window and returned to the main window on exit.

Highlights:
- Borderless, draggable, resizable PiP window with a custom GDI+ "glass"
  controls overlay (restore, close, play/pause, skip, seek slider,
  transparency toggle) that auto-hides shortly after the cursor leaves.
- Transparency toggle (WS_EX_LAYERED) to see content behind the window;
  window position/size/transparency are persisted across sessions.
- PiP button injected into the web player controls, cloned from Stremio's
  own fullscreen button so it inherits the native styling and auto-hide,
  plus a system-tray "Picture-in-Picture" toggle.
- Toggle plumbed through the existing web<->shell IPC (win-set-pip /
  win-pip-changed), mirroring the fullscreen flow.

New files: src/stremio_app/pip_window.rs, src/stremio_app/mpv_hwnd.rs

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@kKaskak

kKaskak commented Jun 15, 2026

Copy link
Copy Markdown
Member

i do not have the capacity to review this claude generated 1700 lines of code pr im sorry

@DavidAGInnovation

Copy link
Copy Markdown

I reviewed this implementation and opened a focused alternative in #92.

The main review concerns are:

  • the PR injects its own PiP control even though stremio-web#1354 owns the web control and IPC contract;
  • the custom GDI+ overlay makes the change roughly 1,700 lines and duplicates player controls;
  • the MPV lookup falls back to the first non-WebView child, which can select the wrong window;
  • the current PR is merge-conflicting.

#92 keeps the native shell responsibility focused: it handles the IPC, reparents the existing MPV child, resizes it with the PiP window, restores it on close, and persists placement.

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.

3 participants