Reputation: 119
I have a HTML5 page which has voice-over. It is playing the video perfectly on loading the page. I need to check the system's audio driver status, If it is disabled, i need to pop a message box saying "Audio driver is disabled". If it is enabled nothing to do.
My HTML5 code to add audio.
<audio preload="auto" id="Scene 1.0"><source src="sounds/Scene 1.0.mp3"></audio>
Upvotes: 1
Views: 535
Reputation: 136658
You cannot (yet) get the audio outputs from HTMLMediaElement
.
However, you can try creating a new AudioContext
(browser compatibility), then check its destination property. I believe that if the maxChannelCount
property is less than 1, then the driver is not instantiated.
function check_audioOut(){
if(!window.AudioContext) return 'not accessible';
var audioCtx = new AudioContext();
return (audioCtx.destination.maxChannelCount>0)?'enabled': 'disabled';
}
document.body.innerHTML = 'audio driver ' + check_audioOut();
Note that you won't be able to check if it is muted or not.
Upvotes: 3