• Browser
  • Mail
  • News
  • Community
  • About
Register Login
HomeBlogsForumThemesSocial

Vivaldi

  • Browser
  • Mail
  • News
  • Community
  • About

Navigation

    • Home
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    1. Home
    2. Desktop
    3. Archive
    4. Picture-in-Picture on Twitch

    Picture-in-Picture on Twitch

    Archive
    pic-in-pic twitch
    4
    8
    4.8k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • KompostenK
      Komposten Translator
      last edited by A Former User

      Is PiP supposed to work on Twitch? My brother used it for Twitch way back when it was still a snapshot-only feature, but I've never managed to get the option to show up and nowadays he can't get it to work either.

      Twitch is probably the platform where I would find this feature the most useful.

      1 Reply Last reply Reply Quote 0
      • GuilimoteG
        Guilimote
        last edited by

        Or just create a bookmark with the following url:
        javascript:document.querySelector('div.player-video video').requestPictureInPicture();void(0);

        Then, when on the relevant Twitch page, just open this bookmark 😉

        (inspired from https://www.reddit.com/r/Twitch/comments/9ar32h/pictureinpicture_chrome/)

        1 Reply Last reply Reply Quote 3
        • KompostenK
          Komposten Translator
          last edited by

          Hmm, I thought Twitch switched over to an HTML5 player a while ago. 🤔
          Anyway, thanks for the tips!

          GuilimoteG 1 Reply Last reply Reply Quote 0
          • GuilimoteG
            Guilimote @Komposten
            last edited by

            @Komposten Yeah it is a HTML5 player, but not in the native way the browser is expecting it.
            They have kind of a proprietary layer to manage the chat or their specific features.

            @Gwen-Dragon haha you're welcome 😉

            1 Reply Last reply Reply Quote 0
            • KompostenK
              Komposten Translator
              last edited by Komposten

              I used @Guilimote's reddit user Smaxx' little JS snippet and added a PiP button to the Twitch interface (using an "inject javascript" extension that I already had installed, called Custom JavaScript for websites).

              Screenshot:
              0_1562334476044_c59b0757-6908-40f7-b856-3d8732747c88-image.png

              Code:

              //Wait for the player overlay to load, then add the pip button.
              waitForOverlay();
              
              function waitForOverlay() {
              	if (!createPipButton()) {
              		setTimeout(waitForOverlay, 300);
              	}
              }
              
              
              function createPipButton() {
              	if (document.querySelector("#pip-button")) {
              		return true;
              	}
              	
              	let buttons = document.querySelector('div.player-buttons-right');
              	
              	if (buttons) {
              		let theatre = document.querySelector("button.qa-theatre-mode-button");
              		if (theatre) {
              			//Copy the theatre-mode button.
              			let pip = theatre.cloneNode(true);
              			pip.classList.remove("qa-theatre-mode-button");
              			pip.id = "pip-button";
              			
              			//Set the button to activate PiP on click.
              			pip.setAttribute("onClick", "document.querySelector('div.player-video video').requestPictureInPicture()");
              			pip.querySelector(".player-tip").setAttribute("data-tip", "Picture-in-Picture");
              			
              			//Change the icon.
              			pip.querySelector("#icon_theatre").id = "icon_pip";
              			pip.querySelector("#icon_pip path").setAttribute("d", "M23 8a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1h16zm-6 12h5v-5h-5v5zM8 20h14V10H8v10z");
              			
              			//Insert the button.
              			buttons.insertBefore(pip, theatre);
              			
              			return true;
              		}
              	}
              	
              	return false;
              }
              
              // Re-add the pip button (if needed) after the user navigates.
              // Needed since Twitch doesn't reload the page.
              var titleObserver = new MutationObserver(waitForOverlay);
              titleObserver.observe(document.querySelector("title"), { childList: true, characterData: true });
              
              GuilimoteG 1 Reply Last reply Reply Quote 1
              • GuilimoteG
                Guilimote @Komposten
                last edited by

                @Komposten The code is not even from me, I found it in the link of my 1st post 😉 But wow, your tweak seems to be GREAT!

                KompostenK 1 Reply Last reply Reply Quote 0
                • KompostenK
                  Komposten Translator @Guilimote
                  last edited by

                  @Guilimote Fair enough, credit for the original JS snippet goes to Smaxx on reddit, then. 😉

                  1 Reply Last reply Reply Quote 0
                  • ukanukU
                    ukanuk Ambassador
                    last edited by

                    I noticed the Picture-in-Picture button for video is not available on Facebook, either. (At least not on the new Beta interface on Facebook Live videos being watched after the fact, i.e. no longer live). Presumably it's the same problem, where Facebook is not actually using an HTML5 player.

                    1 Reply Last reply Reply Quote 0
                    • 1 / 1
                    • First post
                      Last post

                    Looks like your connection to Vivaldi Forum was lost, please wait while we try to reconnect.

                    Copyright © Vivaldi Technologies™ — All rights reserved. Privacy Policy | Code of conduct | Terms of use | Vivaldi Status