diff --git a/README.md b/README.md index 7088de3..a8b6295 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,15 @@ https://dagammla.gitlab.io/keep-silk-open/test.html Usually your browser will timeout after ~10 minutes +For debugging, it can be helpful to visualize the audio element. +To do this, write the following: + + + --- ## Experimental! diff --git a/keep.js b/keep.js index 52dd465..5f73982 100644 --- a/keep.js +++ b/keep.js @@ -13,6 +13,9 @@ const alwaysUse = typeof AlwaysUseSilk != "undefined" && !!AlwaysUseSilk if (userAgent.includes("silk") || alwaysUse){ + + const visualMode = typeof SilkVisualMode != "undefined" && !!SilkVisualMode + let source = document.currentScript.getAttribute("src") const lastDivider = source.lastIndexOf("/") source = source.slice(0, lastDivider + 1) + "media.mp3" @@ -20,11 +23,10 @@ const nowQuery = () => `?q=${Date.now()}` const audio = document.createElement("audio") - audio.controls = false + audio.controls = visualMode audio.src = source + nowQuery() audio.muted = true audio.autoplay = true - audio.loop = true document.body.appendChild(audio) const listenEvents = ["keydown", "pointerdown", "click"] @@ -47,11 +49,11 @@ audio.play() } + audio.onended = reload + const startMedia = () => { reload() audio.muted = false - audio.loop = false - audio.onended = reload } audio.onplaying = () => removeAllListeners(startMedia) diff --git a/test.html b/test.html index b1eacfe..28d2317 100644 --- a/test.html +++ b/test.html @@ -1,3 +1,10 @@

Test Page

-

This page should stay open on your Amazon Echo Show device

\ No newline at end of file +

TAP THE SCREEN

+

The Audio Element will be invisible on your page

+ + \ No newline at end of file