fix: Add base_url to the audio notification file (#4116)

This commit is contained in:
Nithin David Thomas 2022-03-10 20:40:47 +05:30 committed by GitHub
parent 647efa12e7
commit 3c3b6f90c7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 9 additions and 4 deletions

View file

@ -4,7 +4,7 @@ import { IFrameHelper } from 'widget/helpers/utils';
import { showBadgeOnFavicon } from './faviconHelper';
export const initOnEvents = ['click', 'touchstart', 'keypress'];
export const getAlertAudio = async () => {
export const getAlertAudio = async (baseUrl = '') => {
const audioCtx = new (window.AudioContext || window.webkitAudioContext)();
const playsound = audioBuffer => {
window.playAudioAlert = () => {
@ -17,7 +17,8 @@ export const getAlertAudio = async () => {
};
try {
const audioRequest = new Request('/dashboard/audios/ding.mp3');
const resourceUrl = `${baseUrl}/dashboard/audios/ding.mp3`;
const audioRequest = new Request(resourceUrl);
fetch(audioRequest)
.then(response => response.arrayBuffer())