How to check if SOUND is ON/OFF on HTML5 video -


i need show sound icon on top of video, when sound off , hide when sound on. reason code below not working.

if (video.prop('muted') === true) {       video.mouseenter( function() {sound.show()} ).mouseleave( function() {sound.hide()} );     } else {    sound.hide();  }  <video id="video" controls  muted preload="none" width="446" height="250"></video> 

i figured out. works that.

 video.mouseenter( function() {   if (video.prop('muted') === true) {     sound.show()   }   else {     sound.hide()   } }); video.mouseleave( function() {   sound.hide(); }); 

considering video element:

<video id="video" controls muted preload="none" width="446" height="250"> </video> 

you can determine whether sound on testing volume , muted media properties of element:

var video = document.getelementbyid("video"); if (video.muted || video.volume === 0) {     // sound off } 

Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -