问题
Is there a way for us to disable the "play/pause/full screen on click" functionality for a HTML5 video through javascript and later put it back when we need it again?
回答1:
I don't know if you can disable them but you can remove them using css.
video::-webkit-media-controls-fullscreen-button, video::-webkit-media-controls-play-button, video::-webkit-media-controls-pausebutton {
display: none;
}
http://jsfiddle.net/4ce23z2a/
I hope this helps.
回答2:
I'm not sure why <video>
doesn't honor event.preventDefault();
The way I go around this is pretty hacky. I just override the click and dblclick events of the parent div to solve my problem since I only want to prevent pause/play/full screen.
回答3:
The below line can solve the purpose.
video.removeAttribute('controls');
来源:https://stackoverflow.com/questions/28389347/disable-play-pause-full-screen-for-html5-video-on-click-for-youtube