'How to disable Picture in Picture mode on HTML5 video
How do you disable Picture in Picture mode on html5 videos?
Please note I'm not referring to this question which relates to Apple's AVKit
I know you can disable video download with controlsList="nodownload", how is it possible for Picture in Picture mode.
<video controls controlsList="nodownload">
<source src="https://www.w3schools.com/html/mov_bbb.ogg" type="video/mp4">
<source src="https://www.w3schools.com/html/mov_bbb.mp4" type="video/ogg">
</video>
Solution 1:[1]
If you want to do it through JavaScript. This code applies for all videos on your page and it disables the download,take picture and right click context which also contains download option.
You may want to change jQuery to $
I wrote this code add it to my theme in WordPress to disable the download in all videos in my site.
jQuery('video').on("loadeddata", function() {
jQuery('video').attr('controlsList', 'nodownload');
jQuery('video').bind('contextmenu',function() { return false; });
jQuery('video').attr('disablePictureInPicture', 'true');
});
Solution 2:[2]
Use this:
<video controls disablePictureInPicture>
The disablePictureInPicture is a boolean flag that would disable picture in picture item in three dots menu.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Shady Mohamed Sherif |
| Solution 2 | AmerllicA |
