From 79a7177714666030575e697c6d0ad553239065b3 Mon Sep 17 00:00:00 2001 From: Evert Prants Date: Mon, 14 Jan 2019 19:31:05 +0200 Subject: [PATCH] Autoplay Policy Changes mitigation attempt #2 --- public/index.js | 6 +++--- public/player.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/public/index.js b/public/index.js index caf9f36..dc13a19 100644 --- a/public/index.js +++ b/public/index.js @@ -44,7 +44,7 @@ // Context bullshit let playerContext = [] - window.resumeContexts = function () { + window.resumeAudioContexts = function () { for (let i in playerContext) { let ctx = playerContext[i] if (ctx && ctx.resume) { @@ -347,11 +347,11 @@ playing.innerHTML = title document.title = title + window.resumeAudioContexts() + audio.src = '/api/serve/by-id/' + id audio.play() - window.resumeAudioContexts() - updateQT(q) nowPlaying = id diff --git a/public/player.js b/public/player.js index 5e8e46d..9382e31 100644 --- a/public/player.js +++ b/public/player.js @@ -167,12 +167,12 @@ audio.addEventListener('stop', togglePlayButton, false) play.addEventListener('click', function (e) { + window.resumeAudioContexts() if (audio.paused) { audio.play() } else { audio.pause() } - window.resumeAudioContexts() }, false) mute.addEventListener('click', function (e) {