Page 1 of 1

Background music on a homepage

Posted: Mon Jul 22, 2019 5:11 pm
by papakota
Hello everybody!
I want to have a background music played on my site's homepage. Preferably without the controls. So that the music would start playing on its own (ie, without user's interaction). I tried different things, but all in vain so far. Tried to insert an audio HTML5 code into Joomla's Custom HTML module. Also tried an extension from K2 AllVideos. I heard that Firefox "doesn't like" mp3 format? So I also have the same audio file in .ogg (just in case). And another thing. I read online somewhere that browsers don't allow sites to play music without it being started by sites' visitors, ie without them pushing "PLAY" button first? Like there's some special JS code that helps to overcome that obsticle in a way that the code triggers the player to start playing music. I've got K2 component on my site, so these aren't the regular Joomla articles, but K2 "items". Don't know if that makes any difference in this regard... Also I'm aware that there's an option of inserting directly an audio HTML5 code into body of index.php file of current Joomla template. Though I'm not sure how to do that?
Thanks in advance!

Re: Background music on a homepage

Posted: Mon Jul 22, 2019 6:41 pm
by papakota
UPDATE.
Well, I'd found some nice Joomla plugin, which I inserted into K2 item (article). And it's supposed to autoplay, but it doesn't. 'cos Firefox by default blocks autoplaying. So should I use the JS code to bypass that browser restriction? If yes, then how exactly?

Re: Background music on a homepage

Posted: Mon Jul 22, 2019 7:55 pm
by bruno28
Hello papakota

Why do you want to do that.It is not a good practice and will disturb most of your visitors. It is better to let users activate the sound themselves.

But if you want that way, did you search in the jed : https://extensions.joomla.org/tags/audi ... s-gallery/

Bruno

Re: Background music on a homepage

Posted: Mon Jul 22, 2019 8:34 pm
by papakota
Seems that even JS code won't help. But maybe if someone know the way to bypass this issue please do let me know!
bruno28, we won't get into an argument whether it's worth to autoplay. That's MY site and I'm the boss there :-)
As per your link to JED with different music player... Like I said, the limitation is in the browser, so changing a player probably won't help...

Re: Background music on a homepage

Posted: Tue Jul 23, 2019 5:03 am
by bruno28
Hello papakota

Sorry for the comment of yesterday, I was just trying to help :(

You are right, this is YOUR site and you are the boss in it :) ;)

I don't know JS code so I can't help you in this but I am sure someone else will help you

Have a good day

Bruno

Re: Background music on a homepage

Posted: Tue Jul 23, 2019 5:09 am
by bruno28
I found this :

joomla.stackexchange.com/questions/24957/background-music-on-a-homepage

forums.tomsguide.com/faq/how-can-i-add-background-music-on-my-homepage.345268/

It may help you

Bruno

Re: Background music on a homepage

Posted: Tue Jul 23, 2019 9:21 am
by AMurray
Well the user can easily mute their speakers ;) - but one reason (and a courtesy really) to let users decide to play background music on a website, and not have it forced on them, is they may already be listening to music of their own choice.

So as you have found, browsers these days can prevent such auto-playing, and even if you have Javascript to override that behaviour, one can always block that Javascript in their browser options and you're back where you started.