зеркало из https://github.com/nextcloud/spreed.git
Immediatelly pause ringing when join or leave sound is played
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Родитель
de4cc931c0
Коммит
f90f2e7745
|
@ -31,13 +31,22 @@ export const Sounds = {
|
|||
backgroundAudio: null,
|
||||
backgroundInterval: null,
|
||||
|
||||
_playSounceOnce(soundFile) {
|
||||
_playSoundOnce(soundFile) {
|
||||
const file = generateFilePath('spreed', 'img', soundFile)
|
||||
const audio = new Audio(file)
|
||||
audio.volume = 0.75
|
||||
audio.play()
|
||||
},
|
||||
|
||||
_stopWaiting() {
|
||||
console.debug('Stop waiting sound')
|
||||
if (this.backgroundAudio) {
|
||||
this.backgroundAudio.pause()
|
||||
this.backgroundAudio = null
|
||||
}
|
||||
clearInterval(this.backgroundInterval)
|
||||
},
|
||||
|
||||
async playWaiting() {
|
||||
if (!store.getters.playSounds) {
|
||||
return
|
||||
|
@ -59,19 +68,20 @@ export const Sounds = {
|
|||
return
|
||||
}
|
||||
|
||||
if (this.playedWaiting >= 3) {
|
||||
// Played 3 times, so we stop now.
|
||||
this._stopWaiting()
|
||||
}
|
||||
|
||||
console.debug('Playing waiting sound')
|
||||
this.backgroundAudio.play()
|
||||
this.playedWaiting++
|
||||
|
||||
if (this.playedWaiting >= 3) {
|
||||
// Played 3 times, so we stop now.
|
||||
clearInterval(this.backgroundInterval)
|
||||
}
|
||||
}, 15000)
|
||||
},
|
||||
|
||||
async playJoin(force, playWaitingSound) {
|
||||
clearInterval(this.backgroundInterval)
|
||||
this._stopWaiting()
|
||||
|
||||
if (!store.getters.playSounds) {
|
||||
return
|
||||
|
@ -101,12 +111,12 @@ export const Sounds = {
|
|||
if (playWaitingSound) {
|
||||
await this.playWaiting()
|
||||
} else {
|
||||
this._playSounceOnce('join_call.wav')
|
||||
this._playSoundOnce('join_call.wav')
|
||||
}
|
||||
},
|
||||
|
||||
async playLeave(force, playWaitingSound) {
|
||||
clearInterval(this.backgroundInterval)
|
||||
this._stopWaiting()
|
||||
|
||||
if (!store.getters.playSounds) {
|
||||
return
|
||||
|
@ -132,7 +142,7 @@ export const Sounds = {
|
|||
}
|
||||
this.lastPlayedLeave = currentTime
|
||||
|
||||
this._playSounceOnce('leave_call.wav')
|
||||
this._playSoundOnce('leave_call.wav')
|
||||
|
||||
if (playWaitingSound) {
|
||||
this.playWaiting()
|
||||
|
|
Загрузка…
Ссылка в новой задаче