w3c / picture-in-picture

Picture-in-Picture (PiP)
https://w3c.github.io/picture-in-picture
Other
310 stars 39 forks source link

Type Error video.requestPictureInPicture is not a function in Cordova android and iOS app #213

Closed Sukumaran001 closed 1 year ago

Sukumaran001 commented 2 years ago

**I create the video calling app using webrtc, and i have successfully create the video calling app using Cordova on android and iOS.

Next i started to create the Picture-in-Picture mode using JavaScript in my web application that's also works fine, but my mobile app not support requestpictureinpicture mode.

how to enable and controls the JavaScript Picture-in-Picture mode android and iOS device?**

async function videoShrink(video){
    var video = document.getElementsByTagName("video")[0];

    try {
        // If there is no element in Picture-in-Picture yet, request for it
        if (video !== document.pictureInPictureElement) {
            await video.requestPictureInPicture();
        }
        // If Picture-in-Picture already exists, exit the mode
        else {
            await document.exitPictureInPicture();
        }

    } catch (error) {
        // console.log(`Oh Horror! ${error}`);
        console.log(error);
    }   
 }
beaufortfrancois commented 1 year ago

I'm going to close this issue as it is not a spec issue. You may find your answers in https://developer.mozilla.org/en-US/docs/Web/API/Picture-in-Picture_API#browser_compatibility