HTML5 Video // Completely Hide Controls

后端 未结 7 984
我在风中等你
我在风中等你 2020-11-27 02:58

How Could I completely hide HTML5 video controls?

相关标签:
7条回答
  • 2020-11-27 03:21
    document.addEventListener("DOMContentLoaded", function() { initialiseMediaPlayer(); }, false);
    
    
    function initialiseMediaPlayer() {
    
        mediaPlayer = document.getElementById('media-video');
    
        mediaPlayer.controls = false;
    
        mediaPlayer.addEventListener('volumechange', function(e) { 
            // Update the button to be mute/unmute
            if (mediaPlayer.muted) changeButtonType(muteBtn, 'unmute');
            else changeButtonType(muteBtn, 'mute');
        }, false);  
        mediaPlayer.addEventListener('ended', function() { this.pause(); }, false); 
    }
    
    0 讨论(0)
提交回复
热议问题