Stream proxy: MediaTailor redirect gre do klienta (fix 404 po signal switchu); VU varovalka ob tihem analizatorju
This commit is contained in:
@@ -156,6 +156,7 @@
|
||||
var audioCtx = null, analyser = null, vuRaf = null, freqData = null;
|
||||
function initAnalyser(){
|
||||
if (audioCtx || !window.AudioContext && !window.webkitAudioContext) return;
|
||||
if (!(window.Hls && Hls.isSupported())) return; // native HLS (Safari): CORS taint bi ubil zvok
|
||||
try {
|
||||
audioCtx = new (window.AudioContext || window.webkitAudioContext)();
|
||||
var src = audioCtx.createMediaElementSource(video);
|
||||
@@ -167,9 +168,13 @@
|
||||
freqData = new Uint8Array(analyser.frequencyBinCount);
|
||||
} catch(e) { audioCtx = null; analyser = null; }
|
||||
}
|
||||
var vuZeroFrames = 0;
|
||||
function vuLoop(){
|
||||
if (!analyser) return;
|
||||
analyser.getByteFrequencyData(freqData);
|
||||
var total = 0; for (var z = 0; z < freqData.length; z++) total += freqData[z];
|
||||
if (total === 0) { if (++vuZeroFrames > 150 && !video.paused && !video.muted) { vuEl.classList.remove('live'); for (var q = 0; q < vuBars.length; q++) vuBars[q].style.transform=''; vuRaf = requestAnimationFrame(vuLoop); return; } }
|
||||
else { vuZeroFrames = 0; if (!video.muted) vuEl.classList.add('live'); }
|
||||
var n = vuBars.length; // 7 stolpcev, razporejenih cez spekter (bas -> visine)
|
||||
for (var i = 0; i < n; i++) {
|
||||
var a = Math.floor(i * freqData.length / (n + 4));
|
||||
|
||||
Reference in New Issue
Block a user