# Picture-in-Picture (PiP)

> Float the video in a corner while the user does something else.

- **Applies to:** AppMint and Appwright
- **Source:** the Integration Guide shipped inside the app; this page is generated from it.
- **HTML:** https://freewebtoapk.com/docs/picture-in-picture

Floating Video Window Support

### 1. What is Picture-in-Picture?

PiP allows your app to continue showing content in a small floating window when the user presses Home or switches apps.

Perfect for:

- Video streaming apps (YouTube-style)
- Live sports / event websites
- Video conferencing web apps
- Music visualizer websites
- Educational video platforms

### 2. Enable in Generator

In Step 2 (Display Settings):

1. Scroll to 'Display Options'
2. Toggle ON 'Picture-in-Picture (PiP)'
3. Generate your APK

Requires Android 8.0 (API 26) or higher. Older devices will ignore this setting gracefully.

### 3. How It Works

When PiP is enabled:

1. User is watching video / using your app
2. User presses Home button
3. App shrinks to a small floating window
4. User can interact with other apps while watching
5. Tapping the PiP window returns to full app

The PiP window shows whatever the WebView was displaying at the moment.

### 4. Website Optimization (Optional)

Your website can detect PiP mode and optimize the view. When the window shrinks, you may want to hide menus and show only the video.

```
// Detect PiP mode in your website JS:
document.addEventListener('resize', function() {
  if (window.innerWidth < 300) {
    // PiP mode - show only video
    document.querySelector('.navbar').style.display = 'none';
    document.querySelector('video').style.width = '100%';
  } else {
    // Full mode - restore UI
    document.querySelector('.navbar').style.display = 'block';
  }
});
```

### 5. Limitations

⚠️ Android 8.0+ only (API 26)

⚠️ Some devices may not support PiP (e.g., Android Go edition)

⚠️ PiP window size is controlled by Android, not your app

✅ Works with both video and non-video content

✅ No website changes required - works out of the box

