hammi
Posted on Nov 6
Edited on Nov 6
i'm the developer of rkmovies, a 4k media player that runs as a web app inside a thin android webview shell. the whole apk is 1.17 mb because it bundles zero native media libraries. playback uses the system's mediacodec decoders through artplayer.
one feature people asked for constantly: picture-in-picture. you open whatsapp mid-episode and the video keeps playing in a floating window.
in a webview you can't call an android api directly. you only get what the browser engine exposes. so the pip toggle in the settings menu is a four-layer fallback chain:
if document.pictureInPictureElement is set, the video is already in pip. call exitPictureInPicture() to toggle off.
otherwise try art.video.requestPictureInPicture(). that's the w3c api, and chrome supports it from android 8.…