Skip to content

Commit

Permalink
Add stream seeking logic back in, and update bulid number
Browse files Browse the repository at this point in the history
  • Loading branch information
ironman5366 committed May 29, 2019
1 parent 3c385ef commit ad9aa57
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
8 changes: 8 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,14 @@ <h1>Upcoming</h1>

// 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
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "krlxdesktop",
"version": "1.0.3",
"version": "1.0.4",
"description": "A desktop player for KRLX",
"main": "index.js",
"scripts": {
Expand Down
10 changes: 9 additions & 1 deletion schedule.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,21 @@ <h1>Schedule</h1>
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
Expand Down

0 comments on commit ad9aa57

Please sign in to comment.