mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-23 06:35:13 +01:00
parent
c6fc0302d2
commit
76f87011a2
1 changed files with 3 additions and 2 deletions
|
@ -92,7 +92,7 @@ function initApp() {
|
||||||
const srvModel = initialSrvModel;
|
const srvModel = initialSrvModel;
|
||||||
return {
|
return {
|
||||||
srvModel,
|
srvModel,
|
||||||
audioContext: new AudioContext(),
|
audioContext: window.AudioContext ? new AudioContext() : null,
|
||||||
displayPaymentDetails: false,
|
displayPaymentDetails: false,
|
||||||
remainingSeconds: srvModel.expirationSeconds,
|
remainingSeconds: srvModel.expirationSeconds,
|
||||||
emailAddressInput: "",
|
emailAddressInput: "",
|
||||||
|
@ -351,7 +351,7 @@ function initApp() {
|
||||||
},
|
},
|
||||||
playSound (soundName) {
|
playSound (soundName) {
|
||||||
const audioBuffer = this[soundName + 'Sound'];
|
const audioBuffer = this[soundName + 'Sound'];
|
||||||
if (!audioBuffer || this.audioContext.state === 'suspended') return;
|
if (!audioBuffer || !this.audioContext || this.audioContext.state === 'suspended') return;
|
||||||
const source = this.audioContext.createBufferSource();
|
const source = this.audioContext.createBufferSource();
|
||||||
source.buffer = audioBuffer;
|
source.buffer = audioBuffer;
|
||||||
source.connect(this.audioContext.destination);
|
source.connect(this.audioContext.destination);
|
||||||
|
@ -375,6 +375,7 @@ function initApp() {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async prepareSound (url) {
|
async prepareSound (url) {
|
||||||
|
if (!this.audioContext) return;
|
||||||
const response = await fetch(url)
|
const response = await fetch(url)
|
||||||
if (!response.ok) return console.error(`Could not load payment sound, HTTP error ${response.status}`);
|
if (!response.ok) return console.error(`Could not load payment sound, HTTP error ${response.status}`);
|
||||||
const arrayBuffer = await response.arrayBuffer();
|
const arrayBuffer = await response.arrayBuffer();
|
||||||
|
|
Loading…
Add table
Reference in a new issue