A music player that connects to your cloud/distributed storage.
5
fork

Configure Feed

Select the types of activity you want to include in your feed.

Listen to 'Web Page Media Control API' events

+67 -23
+20 -6
src/Applications/UI.elm
··· 218 218 ----------------------------------------- 219 219 -- Audio 220 220 ----------------------------------------- 221 - Pause -> 222 - returnWithModel model (Ports.pause ()) 221 + PlayPause -> 222 + if Maybe.isNothing model.queue.activeItem then 223 + update (QueueMsg Queue.Shift) model 223 224 224 - Play -> 225 - returnWithModel model (Ports.play ()) 225 + else if model.audioIsPlaying then 226 + returnWithModel model (Ports.pause ()) 227 + 228 + else 229 + returnWithModel model (Ports.play ()) 226 230 227 231 Seek percentage -> 228 232 returnWithModel model (Ports.seek percentage) ··· 236 240 SetAudioIsLoading isLoading -> 237 241 return { model | audioIsLoading = isLoading } 238 242 239 - SetAudioIsPlaying isPlayinh -> 240 - return { model | audioIsPlaying = isPlayinh } 243 + SetAudioIsPlaying isPlaying -> 244 + return { model | audioIsPlaying = isPlaying } 245 + 246 + Stop -> 247 + returnWithModel model (Ports.pause ()) 241 248 242 249 Unstall -> 243 250 returnWithModel model (Ports.unstall ()) ··· 757 764 , Ports.setAudioHasStalled SetAudioHasStalled 758 765 , Ports.setAudioIsLoading SetAudioIsLoading 759 766 , Ports.setAudioIsPlaying SetAudioIsPlaying 767 + 768 + -- Remote 769 + --------- 770 + , Ports.requestNext <| always (QueueMsg Queue.Shift) 771 + , Ports.requestPlayPause <| always PlayPause 772 + , Ports.requestPrevious <| always (QueueMsg Queue.Rewind) 773 + , Ports.requestStop <| always Stop 760 774 761 775 -- 762 776 , Browser.Events.onResize
+2 -13
src/Applications/UI/Console.elm
··· 82 82 ----------------------------------------- 83 83 -- Buttons 84 84 ----------------------------------------- 85 - , let 86 - playMsg = 87 - if Maybe.isNothing activeQueueItem then 88 - QueueMsg Queue.Shift 89 - 90 - else if isPlaying then 91 - Pause 92 - 93 - else 94 - Play 95 - in 96 - brick 85 + , brick 97 86 [ css buttonsContainerStyles ] 98 87 [ T.flex, T.justify_center, T.mb2, T.mt3, T.pb1 ] 99 88 [ button (smallLight repeat) (icon Icons.repeat 18) (QueueMsg <| Queue.ToggleRepeat) 100 89 , button lightPlaceHolder (icon Icons.fast_rewind 20) (QueueMsg <| Queue.Rewind) 101 - , button (largeLight isPlaying) play playMsg 90 + , button (largeLight isPlaying) play PlayPause 102 91 , button lightPlaceHolder (icon Icons.fast_forward 20) (QueueMsg <| Queue.Shift) 103 92 , button (smallLight shuffle) (icon Icons.shuffle 18) (QueueMsg <| Queue.ToggleShuffle) 104 93 ]
+2 -2
src/Applications/UI/Core.elm
··· 91 91 ----------------------------------------- 92 92 -- Audio 93 93 ----------------------------------------- 94 - | Pause 95 - | Play 94 + | PlayPause 96 95 | Seek Float 97 96 | SetAudioDuration Float 98 97 | SetAudioHasStalled Bool 99 98 | SetAudioIsLoading Bool 100 99 | SetAudioIsPlaying Bool 100 + | Stop 101 101 | Unstall 102 102 ----------------------------------------- 103 103 -- Authentication
+3
src/Applications/UI/Kit.elm
··· 393 393 [ T.absolute 394 394 , T.absolute__fill 395 395 , T.bg_white 396 + , T.br2 396 397 , T.flex 397 398 , T.flex_column 398 399 , T.z_999 ··· 499 500 [ css vesselStyles ] 500 501 [ borderRadius 501 502 , T.bg_white 503 + , T.flex 504 + , T.flex_column 502 505 , T.flex_grow_1 503 506 , T.overflow_scroll 504 507 , T.relative
+13 -1
src/Applications/UI/Ports.elm
··· 1 - port module UI.Ports exposing (activeQueueItemChanged, activeQueueItemEnded, adjustEqualizerSetting, fromAlien, giveBrain, nudgeBrain, pause, play, seek, setAudioDuration, setAudioHasStalled, setAudioIsLoading, setAudioIsPlaying, setRepeat, toBrain, unstall) 1 + port module UI.Ports exposing (activeQueueItemChanged, activeQueueItemEnded, adjustEqualizerSetting, fromAlien, giveBrain, nudgeBrain, pause, play, requestNext, requestPlayPause, requestPrevious, requestStop, seek, setAudioDuration, setAudioHasStalled, setAudioIsLoading, setAudioIsPlaying, setRepeat, toBrain, unstall) 2 2 3 3 import Alien 4 4 import Json.Encode as Json ··· 41 41 42 42 43 43 port fromAlien : (Alien.Event -> msg) -> Sub msg 44 + 45 + 46 + port requestNext : (() -> msg) -> Sub msg 47 + 48 + 49 + port requestPlayPause : (() -> msg) -> Sub msg 50 + 51 + 52 + port requestPrevious : (() -> msg) -> Sub msg 53 + 54 + 55 + port requestStop : (() -> msg) -> Sub msg 44 56 45 57 46 58 port setAudioDuration : (Float -> msg) -> Sub msg
+1 -1
src/Applications/UI/Tracks.elm
··· 352 352 chunk 353 353 [ T.flex 354 354 , T.flex_column 355 - , T.h_100 355 + , T.flex_grow_1 356 356 ] 357 357 [ lazy3 358 358 navigation
+24
src/Javascript/index.js
··· 129 129 const n = document.activeElement 130 130 if (n && !n.dataset.keepFocus) n.blur() 131 131 } 132 + 133 + 134 + 135 + // Media Keys 136 + // ---------- 137 + 138 + document.addEventListener("MediaPlayPause", () => { 139 + app.ports.requestPlayPause.send(null) 140 + }) 141 + 142 + 143 + document.addEventListener("MediaStop", () => { 144 + app.ports.requestStop.send(null) 145 + }) 146 + 147 + 148 + document.addEventListener("MediaPrev", () => { 149 + app.ports.requestPrevious.send(null) 150 + }) 151 + 152 + 153 + document.addEventListener("MediaNext", () => { 154 + app.ports.requestNext.send(null) 155 + })
+2
src/Static/Html/Application.html
··· 3 3 <head> 4 4 5 5 <meta charset="utf-8" /> 6 + <meta name="media-controllable" /> 7 + 6 8 <title>Diffuse</title> 7 9 8 10 <!-- Viewport -->