Menu

Picture-in-picture for a video player on Android phones
📰

Picture-in-picture for a video player on Android phones

DEV Community: kotlin·Yonto Player·about 7 hours ago
#Jl9dQWAC
#devtokotlin#devto#dev#window#player
Long article (1117 words) — no AI summary yet.
Reading 0:00
15s threshold

On an Android phone, a video can shrink into a small floating window and keep playing while the viewer uses another app. It looks like a single feature, but it is really a handful of small decisions: what the activity declares, how the app enters the window, what the window shows, how each player engine feeds it, and what the screen does while it is that small. Here is how Yonto Player's phone and tablet app makes each one, and why.

The activity declares support

Picture-in-picture is a mode of an activity, so the manifest is where it starts. A simplified outline of the flags that matter on the player's activity:

<!-- Simplified outline, not the real file. --> <activity android:name= ".MainActivity" android:supportsPictureInPicture= "true" android:configChanges= "orientation|screenSize|smallestScreenSize|screenLayout|density|..." android:launchMode= "singleTask" />

Enter fullscreen mode

Exit fullscreen mode

supportsPictureInPicture is the declaration itself.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.