Spectrum Analyzer и Safari
Всем привет, подскажите плз, может кто знает как прикрутить эквалайзер
при проигрывании аудио ? Может есть какая то библиотека, если не HTML5 средствами, то JS. Нужен вот типа такого сколько не смотрю, ни один не работает в Safari, кто подскажет, почему? Спасибо. |
Источник http://www.smartjava.org/content/exp...ualizing-sound
// check if the default naming is enabled, if not use the chrome one.
if (! window.AudioContext) {
if (! window.webkitAudioContext) {
alert('no audiocontext found');
}
window.AudioContext = window.webkitAudioContext;
}
var context = new AudioContext();
var audioBuffer;
var sourceNode;
// load the sound
setupAudioNodes();
loadSound("wagner-short.ogg");
function setupAudioNodes() {
// create a buffer source node
sourceNode = context.createBufferSource();
// and connect to destination
sourceNode.connect(context.destination);
}
// load the specified sound
function loadSound(url) {
var request = new XMLHttpRequest();
request.open('GET', url, true);
request.responseType = 'arraybuffer';
// When loaded decode the data
request.onload = function() {
// decode the data
context.decodeAudioData(request.response, function(buffer) {
// when the audio is decoded play the sound
playSound(buffer);
}, onError);
}
request.send();
}
function playSound(buffer) {
sourceNode.buffer = buffer;
sourceNode.start(0);
}
// log if an error occurs
function onError(e) {
console.log(e);
}
|
Эт че такое? В Сафари работает?
|
| Часовой пояс GMT +3, время: 13:34. |