iPad html5 video with NO controls?

前端 未结 5 1166
忘掉有多难
忘掉有多难 2021-01-30 11:15

This has been killing me all day, but I am not sure how to get a html5 video player working without the native controls.

I want no controls what-so-ever but if I don\'t

5条回答
  •  -上瘾入骨i
    2021-01-30 11:58

    iOS does not support the autoplay attribute of the video tag. It would also appear that you cannot use jQuery to bind to a click event from the video element (see fiddle).

    A workaround is to position an invisible div over the video element and bind the click which plays the video to that (see fiddle):

    HTML:

    CSS:

    #video { border: 1px solid black; }
    #video-overlay { position: absolute; width: 400px; height: 300px; z-index: 999;  }
    

    jQuery:

    $('#video-overlay').click(function(){
       document.getElementById('video').play();
    });
    

提交回复
热议问题