Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Adicione esse script para abrir a transmissão da copa em picture in picture no Safari.
(function () {
var video = document.querySelector('video:not([title="Advertisement"])')
if (!video.webkitSupportsPresentationMode || typeof video.webkitSetPresentationMode !== 'function') {
console.error('Esse código só funciona no Safari!')
return
}
var scoreX = document.querySelector('.placar__equipes')
var button = document.createElement('button')
button.innerHTML = 'Abrir Picture-in-Picture'
button.style.cssText='font-size: 1.3rem; margin:0 auto; display:block; padding: 0.7em 1.25em; border: 0; background-color: #006dcc; color: #fff; cursor: pointer;'
scoreX.parentNode.insertBefore(button, scoreX.nextSibling)
button.addEventListener('click', function(event) {
video.webkitSetPresentationMode('picture-in-picture');
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.