Turn OFF Picture-in-Picture using JavaScript

Apr 22, 2024

We need to turn off picture-in-picture for videos.  I found this online, but I need to know how to work this for Storyline videos (not iframes).  Can this work in Storyline? How would I post the source... same as other internal assets, story_content/external_files/???

<video id="vid" controls muted>
<source src="https://www.w3schools.com/html/mov_bbb.mp4">
</video>
<script>
vid=document.getElementById("vid")
vid.disablePictureInPicture = true
</script>

or

const videoElement = document.querySelector('video');
videoElement.disablePictureInPicture = true;
9 Replies
Nedim Ramic

Yeah, it's a browser feature that isn't accessible to web properties. Firefox has implemented this feature autonomously, apart from the W3C working draft specification. Since the draft isn't a standard, Firefox opted not to adhere to it, whereas Chrome did. The script I shared earlier works across different browsers, at least in my experience. It simply hides the PiP icon in the Storyline video. Interestingly, I've noticed that the Storyline video PiP icon is no longer visible in Firefox. Is it just me?

Elyse Smith

Good morning! I did try the JavaScript suggested by BJ and Nedim, but neither seemed to work? I was, however, able to turn it off on the browser itself. Question for those on this thread, is this only an issue when using Review or will this also be a problem once I have my course in LMS? I haven't tested it yet in our LMS.