Incrusté un video vimeo protegido en un sitio. ¿Existe algún método a través de la API de JavaScript para averiguar si se está solicitando una contraseña actualmente?
Por el momento no parece haber otra opción que escuchar un mensaje de error. Desafortunadamente, no hay nada más que hacer que seguir intentando reproducir el video y ver si arroja un error. Desafortunadamente no es tan agradable.
//check if video is playing player.getPaused().then(function(paused) { //try to pause video player.pause().then(function() { //when video was already playing, play again if(!paused) player.play() }).catch(function(error) { //when video couldn't pause and the error is 'PasswordError' if(error.name == 'PasswordError') { //currently vimeo asks for password videoWrp.classList.remove('loading'); videoWrp.classList.add("pw-protection"); //loop over the play function, till password was entered pwLoop = setInterval(function (){ player.play().then(function() { //password was entered videoWrp.classList.remove("pw-protection"); clearInterval(pwLoop); }) }, 500); } }); });