From e272da0ede919b188be58805af6cb91b19283f6a Mon Sep 17 00:00:00 2001 From: Steven Vandevelde Date: Wed, 20 Feb 2019 16:21:59 +0100 Subject: [PATCH] Connect more ports --- src/Applications/UI.elm | 1 + src/Javascript/audio-engine.js | 4 ++-- src/Javascript/index.js | 14 +++++++------- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/Applications/UI.elm b/src/Applications/UI.elm index b80f823f..d6180123 100644 --- a/src/Applications/UI.elm +++ b/src/Applications/UI.elm @@ -463,6 +463,7 @@ subscriptions _ = -- Audio -------- + , Ports.activeQueueItemEnded (QueueMsg << always Queue.Shift) , Ports.setAudioDuration SetAudioDuration , Ports.setAudioHasStalled SetAudioHasStalled , Ports.setAudioIsLoading SetAudioIsLoading diff --git a/src/Javascript/audio-engine.js b/src/Javascript/audio-engine.js index a03b066e..279672da 100644 --- a/src/Javascript/audio-engine.js +++ b/src/Javascript/audio-engine.js @@ -173,7 +173,7 @@ function audioErrorEvent(event) { // NOTE: Weird issue with Chrome if (event.target.duration && (event.target.currentTime / event.target.duration) > 0.975) { console.log("Moving on to the next track.") - this.app.ports.activeQueueItemEnded.send() + this.app.ports.activeQueueItemEnded.send(null) } break case event.target.error.MEDIA_ERR_SRC_NOT_SUPPORTED: @@ -213,7 +213,7 @@ function audioEndEvent(event) { if (this.repeat) { event.target.play() } else { - this.app.ports.activeQueueItemEnded.send() + this.app.ports.activeQueueItemEnded.send(null) } } diff --git a/src/Javascript/index.js b/src/Javascript/index.js index 4ee0601a..b724d847 100644 --- a/src/Javascript/index.js +++ b/src/Javascript/index.js @@ -55,7 +55,7 @@ app.ports.activeQueueItemChanged.subscribe(item => { if (item) { insertTrack(orchestrion, item) } else { - app.ports.setIsPlaying.send(false) + app.ports.setAudioIsPlaying.send(false) setProgressBarWidth(0) } }) @@ -81,12 +81,12 @@ app.ports.seek.subscribe(percentage => { }) -// app.ports.unstall.subscribe(_ => { -// if (orchestrion.audio) { -// clearTimeout(orchestrion.unstallTimeoutId) -// unstallAudio(orchestrion.audio) -// } -// }) +app.ports.unstall.subscribe(_ => { + if (orchestrion.audio) { + clearTimeout(orchestrion.unstallTimeoutId) + unstallAudio(orchestrion.audio) + } +}) -- 2.54.0