Page 1 of 1
background music
Posted: Mon Jan 03, 2022 9:17 pm
by SergeFog
is it possible to insert a background music at the entrance to the site and which would continue even if we change the page?
Re: background music
Posted: Mon Jan 03, 2022 10:42 pm
by BaconFries
Thi has been asked by others before
is it possible to insert a background music at the entrance to the site and which would continue even if we change the page?
Multi part answer. No not by just inserting any of the audio objects or extensions available. Once you leave the page the music stops. One or two ways is to have the player to continue is insert in a iframe or by scripting using ajax. Note if the audio is set to auto play then the browser will disable it so you will need to use a play/pause/stop button to give the user full control to listen or not.
Re: background music
Posted: Tue Jan 04, 2022 7:26 am
by Joe_120
SergeFog wrote: ↑Mon Jan 03, 2022 9:17 pm
is it possible to insert a background music at the entrance to the site and which would continue even if we change the page?
In the majority of cases autoplay will be blocked by browsers, or the users browser settings.
From Mozilla.org: ".... playback of any media that includes audio is generally blocked if the playback is programmatically initiated in a tab which has not yet had any user interaction. Browsers may additionally choose to block under other circumstances."
The simplest way is to give the user the same option as radio stations and others do, which is to provide a button that opens the audio in a new small window with controls. That way even after leaving your site, if the window is not closed it will still play!!