From 084098645828740a5f96a011eb3bd1d69c5a9e6e Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Sat, 4 Apr 2015 12:22:51 +0200 Subject: Disable Meter in !Chrome browsers --- assets/js/lustiges-script.js | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'assets') diff --git a/assets/js/lustiges-script.js b/assets/js/lustiges-script.js index d4db5f6..417b234 100644 --- a/assets/js/lustiges-script.js +++ b/assets/js/lustiges-script.js @@ -433,18 +433,15 @@ $(function() { // multiviewer $(function() { + var audioMeter = !!window.chrome; $('body.multiview') .find('audio, video') - //.prop('muted', true) .each(function(idx, player) { var $player = $(player), $meter = $player.closest('.cell').find('.meter'), - $timer = $player.closest('.cell').find('.timer'), - ctx = new AudioContext(), - audioSrc = ctx.createMediaElementSource(player), - analyser = ctx.createAnalyser(); + $timer = $player.closest('.cell').find('.timer'); $player.on("timeupdate", function(e) { @@ -474,6 +471,18 @@ $(function() { $timer.text(txt); }); + if(!audioMeter) + { + $player.prop('muted', true); + $meter.hide(); + return; + } + + var + ctx = new AudioContext(), + audioSrc = ctx.createMediaElementSource(player), + analyser = ctx.createAnalyser(); + // we have to connect the MediaElementSource with the analyser audioSrc.connect(analyser); @@ -483,7 +492,6 @@ $(function() { var w = 100 / analyser.frequencyBinCount; for (var i = 0; i < analyser.frequencyBinCount; i++) { var c = Math.floor( i * 255 / analyser.frequencyBinCount ); - console.log(c); $('