Html5 AudioContext Object is supported. but It is not working gearS1 (SM-R750) device. (I cannot hear a sound.)
In gearS2 (SM-R730S) device, It works well. (I can hear a sound)
Both two devices to support the AudioContext object, why don't play sound gearS1 ??
ref by.
http://www.html5rocks.com/en/tutorials/webaudio/intro/?redirect_from_locale=ko
my test code,
function soundPlayWithArrayBuf(aSounds){ if(!audioCtx){ try { window.AudioContext = window.AudioContext || window.webkitAudioContext; } catch (e) { alert(e); } audioCtx = new window.AudioContext(); if(!audioCtx)return; }
var sndArray = new Array(); for (var i = 0x00, len = aSounds.length; i < len; i++) { sndArray.push(new Promise(function(resolve, reject){ var xmlhttp = new XMLHttpRequest(); xmlhttp.responseType = 'arraybuffer'; xmlhttp.onreadystatechange = function(){ if(xmlhttp.readyState == 4 && xmlhttp.status == 200){ var result = xmlhttp.response; resolve(result); xmlhttp = null; } } var aURL = SND_PATH+".mp3"; xmlhttp.open('GET', aURL, true); xmlhttp.timeout = 10000; xmlhttp.ontimeout = function() { xmlhttp.abort(); reject(null); xmlhttp = null; }; xmlhttp.send(); })); } Promise.all(sndArray).then(function(sounds){ for(var i = 0; i < sounds.length; i++){ audioCtx.decodeAudioData(sounds[i], function(buf){ var source = audioCtx.createBufferSource(); source.buffer = buf; source.connect(audioCtx.destination); source.start(0); }); } }, function(e){ alert(e); } ); } |