mirror of
https://github.com/Luzifer/twitch-manager.git
synced 2024-12-21 04:11:17 +00:00
Add sound player
This commit is contained in:
parent
fd7327d634
commit
87ba88fc53
1 changed files with 10 additions and 0 deletions
|
@ -27,6 +27,10 @@ const app = new Vue({
|
||||||
created() {
|
created() {
|
||||||
window.setInterval(() => { this.time = new Date() }, 1000)
|
window.setInterval(() => { this.time = new Date() }, 1000)
|
||||||
this.startSocket()
|
this.startSocket()
|
||||||
|
|
||||||
|
this.sound = new Audio()
|
||||||
|
this.sound.addEventListener('load', () => this.sound.play(), true)
|
||||||
|
this.sound.autoplay = true
|
||||||
},
|
},
|
||||||
|
|
||||||
data: {
|
data: {
|
||||||
|
@ -34,6 +38,7 @@ const app = new Vue({
|
||||||
avail: false,
|
avail: false,
|
||||||
backoff: 100,
|
backoff: 100,
|
||||||
},
|
},
|
||||||
|
sound: null,
|
||||||
store: {},
|
store: {},
|
||||||
socket: null,
|
socket: null,
|
||||||
time: new Date(),
|
time: new Date(),
|
||||||
|
@ -43,6 +48,10 @@ const app = new Vue({
|
||||||
el: '#app',
|
el: '#app',
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
playSound(soundUrl) {
|
||||||
|
this.sound.src = soundUrl
|
||||||
|
},
|
||||||
|
|
||||||
showAlert(title, text) {
|
showAlert(title, text) {
|
||||||
this.$bvToast.toast(text, {
|
this.$bvToast.toast(text, {
|
||||||
title,
|
title,
|
||||||
|
@ -96,6 +105,7 @@ const app = new Vue({
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.showAlert('New Follower', `${to} just followed`)
|
this.showAlert('New Follower', `${to} just followed`)
|
||||||
|
this.playSound('/public/doorbell.webm')
|
||||||
},
|
},
|
||||||
|
|
||||||
version(to, from) {
|
version(to, from) {
|
||||||
|
|
Loading…
Reference in a new issue