pip insta video call

PIP the video call while you are calling in Instagram video call

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         pip insta video call
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  PIP the video call while you are calling in Instagram video call
// @author       Bibek
// @match        https://www.instagram.com/call/*
// @icon         https://static.cdninstagram.com/rsrc.php/v3/yQ/r/SOrOnJCceiE.png
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    // Function to update video attributes
    function updateVideoAttributes() {
        const videos = document.querySelectorAll('video');

        videos.forEach(video => {
            video.removeAttribute('disablepictureinpicture');
            video.setAttribute('disablepictureinpicturee', '');
        });
    }

    // Wait for 10 seconds before running the script
    setTimeout(function() {
        // Create a button
        const button = document.createElement('button');
        button.innerHTML = 'PIP';
        button.style.cssText = 'position: absolute; right: 40%; bottom: 1.5%; transform: translateY(-50%); background: gray; border-radius: 50%; padding: 8px; cursor: pointer; margin-right: 0;';
        document.body.appendChild(button);

        // Show alert and wait for user confirmation
        const confirmation = confirm("PIP mode will be enabled after 20 seconds. Do you want to proceed?");

        if (confirmation) {
            // Automatically click the button after 10 seconds
            setTimeout(function() {
                button.click();
                console.log("PIP enabled in insta video call");
            }, 20000);
        } else {
            alert("PIP activation canceled.");
        }

        // Add event listener to the button
        button.addEventListener('click', function() {
            updateVideoAttributes();
        });
    }, 10000);



})();