added webkitAudioContext fallback

This commit is contained in:
Djkáťo 2023-08-09 18:06:12 +02:00
parent a5df675913
commit 25c786c412

View file

@ -363,7 +363,7 @@ export class MusicPlayerBuilder {
constructor(private audio_element: HTMLAudioElement) { constructor(private audio_element: HTMLAudioElement) {
if (audio_element === undefined) throw Error("audio_element was undefined") if (audio_element === undefined) throw Error("audio_element was undefined")
// ↓ For old browsers // ↓ For old browsers
const AudioContext = window.AudioContext; const AudioContext = window.AudioContext || window.webkitAudioContext;
this.#audio_context = new AudioContext() this.#audio_context = new AudioContext()
this.#track = this.#audio_context.createMediaElementSource(audio_element) this.#track = this.#audio_context.createMediaElementSource(audio_element)
this.#gain = this.#audio_context.createGain() this.#gain = this.#audio_context.createGain()