Improved audio player

This commit is contained in:
Eduard Urbach 2018-03-11 04:51:10 +01:00
parent 42c16053a9
commit 5c9fe711c9
3 changed files with 5 additions and 1 deletions

View File

@ -19,6 +19,7 @@
justify-content center justify-content center
align-items center align-items center
font-size 1.5rem font-size 1.5rem
color text-color
background rgba(0, 0, 0, 0.03) background rgba(0, 0, 0, 0.03)
border none border none
border-radius 50% border-radius 50%

View File

@ -14,7 +14,7 @@ component Track(track *arn.SoundTrack, user *arn.User)
.sound-track-media.video-container .sound-track-media.video-container
iframe.lazy.video(data-src=media.EmbedLink(), allowfullscreen="allowfullscreen") iframe.lazy.video(data-src=media.EmbedLink(), allowfullscreen="allowfullscreen")
if user != nil && media.Service == "Youtube" && (user.Role == "admin" || user.Role == "editor") && track.File != "" if user != nil && media.Service == "Youtube" && track.File != ""
.buttons .buttons
button.action(data-action="playAudio", data-trigger="click", data-src="/audio/" + track.File) button.action(data-action="playAudio", data-trigger="click", data-src="/audio/" + track.File)
Icon("play") Icon("play")

View File

@ -23,6 +23,9 @@ export function playAudio(arn: AnimeNotifier, button: HTMLButtonElement) {
audioNode.buffer = buffer audioNode.buffer = buffer
audioNode.connect(audioContext.destination) audioNode.connect(audioContext.destination)
audioNode.start(0) audioNode.start(0)
audioNode.onended = () => {
document.getElementById("audio-player").classList.add("fade-out")
}
}, console.error) }, console.error)
} }
request.send() request.send()