From ad9aa572f44a002e2599a69bede21dd11a0d4bd2 Mon Sep 17 00:00:00 2001 From: Will Beddow Date: Wed, 29 May 2019 08:22:09 -0500 Subject: [PATCH] Add stream seeking logic back in, and update bulid number --- index.html | 8 ++++++++ package.json | 2 +- schedule.html | 10 +++++++++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 586d941..c23a135 100644 --- a/index.html +++ b/index.html @@ -154,6 +154,14 @@

Upcoming

// Update the Audio var method = pause ? 'pause': 'play'; + var bufferLength = yourAudio.buffered.length; + if (bufferLength >= 1){ + bufferLength--; + console.log("Buffering"); + // Seek to the end of the stream regardless + yourAudio.currentTime = yourAudio.buffered.end(bufferLength); + } + yourAudio[method](); // Prevent Default Action diff --git a/package.json b/package.json index f0c9f03..3088f99 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "krlxdesktop", - "version": "1.0.3", + "version": "1.0.4", "description": "A desktop player for KRLX", "main": "index.js", "scripts": { diff --git a/schedule.html b/schedule.html index a7b3588..7478bfd 100644 --- a/schedule.html +++ b/schedule.html @@ -70,13 +70,21 @@

Schedule

ctrl = document.getElementById('audioControl'); function do_playpause(){ + // Update the Button // Update the Button var pause = ctrl.innerHTML === pause_button; ctrl.innerHTML = pause ? play_button : pause_button; // Update the Audio var method = pause ? 'pause': 'play'; - visitor.event("Music", method).send(); + var bufferLength = yourAudio.buffered.length; + if (bufferLength >= 1){ + bufferLength--; + console.log("Buffering"); + // Seek to the end of the stream regardless + yourAudio.currentTime = yourAudio.buffered.end(bufferLength); + } + yourAudio[method](); // Prevent Default Action