I created a background music that automatically plays when the page loads but sometimes it can't play and gives me an error like this "Uncaught (in promise) DOMException: play() failed because the user didn't interact with the document first. https://goo.gl/xX8pDD" How to fix it? this site always plays background music without error, I don't know how they do it , example : https://techvr360.com/demo/hongduc_v5/vi_tour/index.html

How to fix : play() failed because the user didn't interact with the document first?
-
-
That site is not playing any sound either if you don't interact with the pano.
I would put something in a mousedown event.
something like (untested)
Code<events name="ondownevent" ondown="playbackgroundsound()" /> <action name="playbackgroundsound" > playsound(bgsound, "sound.mp3"); </action name>
I'm not a fan of playing sound in the backgroudn tho. If a site does that, my response is to close it.
I believe it is more common / user friendly to ask to enable background sound and start playing if the answer is yes.gr,
Kristof -
That site is not playing any sound either if you don't interact with the pano.
I would put something in a mousedown event.
something like (untested)
I'm not a fan of playing sound in the backgroudn tho. If a site does that, my response is to close it.
I believe it is more common / user friendly to ask to enable background sound and start playing if the answer is yes.gr,
KristofThank you very much for your help. Let me try it , Hope it work
-
I'm not a fan of playing sound in the backgroudn tho. If a site does that, my response is to close it.
I believe it is more common / user friendly to ask to enable background sound and start playing if the answer is yes.Same here. It should be. Probibited by all browsers. Don't do that music s**t please!
Participate now!
Don’t have an account yet? Register yourself now and be a part of our community!