diff --git a/experiments/audioAbstraction/app.js b/experiments/audioAbstraction/app.js index f40902ff..cd13064e 100644 --- a/experiments/audioAbstraction/app.js +++ b/experiments/audioAbstraction/app.js @@ -8,6 +8,7 @@ const loadUrl = document.getElementById("loadUrl"); const info = document.getElementById("info"); const position = document.getElementById("position"); const sourceType = document.getElementById("sourceType"); +const autoplay = document.getElementById("autoplay"); const context = new (window.AudioContext || window.webkitAudioContext)(); @@ -48,6 +49,10 @@ position.addEventListener("change", () => { source.seekToTime(newTime); }); +autoplay.addEventListener("change", () => { + source.setAutoPlay(autoplay.checked); +}); + const updateInfo = () => { const data = { numberOfChannels: source.getNumberOfChannels(), @@ -55,7 +60,8 @@ const updateInfo = () => { duration: source.getDuration(), timeElapsed: source.getTimeElapsed(), sampleRate: source.getSampleRate(), - loop: source.getLoop() + loop: source.getLoop(), + autoplay: source.getAutoPlay() }; info.value = JSON.stringify(data, null, 2); diff --git a/experiments/audioAbstraction/bufferSource.js b/experiments/audioAbstraction/bufferSource.js index ae45cefc..d059de28 100644 --- a/experiments/audioAbstraction/bufferSource.js +++ b/experiments/audioAbstraction/bufferSource.js @@ -181,6 +181,10 @@ } } + getAutoPlay() { + return this._autoPlay; + } + setAutoPlay(shouldAutoPlay) { this._autoPlay = shouldAutoPlay; } diff --git a/experiments/audioAbstraction/elementSource.js b/experiments/audioAbstraction/elementSource.js index aced96e8..fa02f665 100644 --- a/experiments/audioAbstraction/elementSource.js +++ b/experiments/audioAbstraction/elementSource.js @@ -105,6 +105,9 @@ this._loop = shouldLoop; } + getAutoPlay() { + return this._autoPlay; + } setAutoPlay(shouldAutoPlay) { this._autoPlay = shouldAutoPlay; } diff --git a/experiments/audioAbstraction/index.html b/experiments/audioAbstraction/index.html index ecadab76..d43c5d80 100644 --- a/experiments/audioAbstraction/index.html +++ b/experiments/audioAbstraction/index.html @@ -23,7 +23,9 @@
-
+
Autoplay: + +