goldfire / howler.js

Javascript audio library for the modern web.

Home Page:https://howlerjs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Howler not working in background for iphone

AashirBhusal opened this issue · comments

The Problem

My problem is with my website's audio not running in background for iphone and ios but i have seen all other website getting widget in homescreen and also running in background even if i leave safari. Everything is working fine in android and playing in background and in windows as well even if tab is inactive the audio keeps playing.

I want to know how to implement background play for audio even if i leave safari on iphone, like a widget appear on homscreen as safari running in background. I am using howler for the player, any body have any idea how can this be done?.

This code might look a bot different but under the hood its using howler

replace useSound with howler

my howler config as follows

const [play, { pause, sound, duration }] = useSound(
songUrl,
{
volume: volume,
html5: true,
onplay: () => setIsPlaying(true),
onend: () => {
setIsPlaying(false);
onPlayNext();
},
onpause: () => setIsPlaying(false),
format: ['mp3']
}
);

Reproducible Example

n/a

Reproduction Steps

n/a

Possible Solution

No response

Context

No response

Howler.js Version

v2.2.4

Affected Browser(s)/Versiuon(s)

Iphone