Commit 5e8534cf authored by ilyak's avatar ilyak

webaudio: unlock audio context on user interaction

parent 2f29cdb5
......@@ -31613,6 +31613,26 @@ static ma_result ma_context_init__webaudio(ma_context* pContext, const ma_contex
miniaudio.get_device_by_index = function(deviceIndex) {
return miniaudio.devices[deviceIndex];
};
miniaudio.unlock_event_types = (function(){
return ['touchstart', 'touchend', 'click'];
})();
miniaudio.unlock = function() {
for(var i = 0; i < miniaudio.devices.length; ++i) {
var device = miniaudio.devices[i];
if (device != null && device.webaudio != null) {
device.webaudio.resume();
}
}
miniaudio.unlock_event_types.map(function(event_type) {
document.removeEventListener(event_type, miniaudio.unlock, true);
});
};
miniaudio.unlock_event_types.map(function(event_type) {
document.addEventListener(event_type, miniaudio.unlock, true);
});
}
return 1;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment