Jump to content

Is it possible to disable "picture in picture" (PIP) on website video background

Recommended Posts

  • Replies 3
  • Views 1.3k
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

I'm using firefox to find the issue on my device windows. But its happening on a few MAC devices with safari also. Chrome windows seems fine now which is great. Just wondering if its possible to make sure there is a hard lock on the PIP for other devices. Any way to target the PIP with css etc?

Cheers

Edited by MAC1
Link to comment
  • 3 weeks later...

I tried javascript code injection into the footer, it doesn't work but is this close or help find a answer?

<!-- PIP FIX -->

<script>
  document.addEventListener('DOMContentLoaded', function() {
    var sectionId = '64d255619ec2f716e2c78975';
    var section = document.querySelector('[data-section-id="' + sectionId + '"]');

    if (section) {
      var videos = section.querySelectorAll('video');

      videos.forEach(function(video) {
        video.addEventListener('enterpictureinpicture', function(event) {
          event.preventDefault(); // Prevent entering PiP mode
        });

        video.addEventListener('leavepictureinpicture', function(event) {
          // Handle events when leaving PiP mode if needed
        });
      });
    }
  });
</script>

<!-- end PIP FIX -->
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.