Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

115
Vistas
Click to launch full screen video on mobile not working. Does work on desktop and emulated through Safari user agent select

I have the following function that I am using to expand an auto-playing video when the user clicks on the media area. (Sample video link supplied)

if(heroVideo) {
    const heroVideoCont = heroVideo.querySelector('video');

    heroVideoCont.addEventListener('click', () => expandVideo(heroVideoCont));

    function expandVideo(targ) {
        if(targ.requestFullscreen) {
            targ.requestFullscreen();
        } else if(targ.webkitRequestFullscreen) {
            targ.webkitRequestFullscreen();
        } else if(targ.msRequestFullScreen) {
            targ.msRequestFullScreen();
        }
    } 

    function controlVideoVolume(targ) {
        if(document.fullscreenElement) {
            targ.removeAttribute('muted');
        } else {
            targ.setAttribute('muted', '');
        }
    }

    document.addEventListener('fullscreenchange', () => 
       controlVideoVolume(heroVideoCont));
    document.addEventListener('mozfullscreenchange', () => 
       controlVideoVolume(heroVideoCont));
    document.addEventListener('webkitfullscreenchange', () => 
       controlVideoVolume(heroVideoCont));
    }

<div class="hero__container--media">
     <video src="http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerBlazes.mp4" autoplay="autoplay" loop="loop" muted playsinline="" preload="metadata"></video>
</div>

It appears as expected on desktop versions of Chrome and Safari. It also works on Safari with user agent iOS 14.1.0 selected.

However, it does not work on mobile (only iPhone iOS 15.1 tested). I changed the event listener to a tap event but this had no change. The only way I seemed to be able to get it to expand was to add the controls attribute. Although this helps I am in the usual situation of design 'demands' that no native controls are displayed in its inline state.

Any guidance would be ideal.

As a bonus, the muted/unmute function does not work with Safari. Is there a workaround for this or is it just native functionality that cannot be overwritten?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda