Problem with sound effects in SoloLearn | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 1

Problem with sound effects in SoloLearn

I think SoloLearn doesn't allow audio to be played if the play method isn't triggered by some kind of user interaction, because of that so sound effects in my game will throw errors. I was thinking about making all audio play when the user enters the game and make it so they all loop with 0 volume, and then make it so that when they are supposed to be played I do not use the audio.play method and just change their volume and currentPosition instead, do you think that would be a good idea? Would a lot of audio being played simultaneously with zero volume effect the performance?

16th May 2021, 7:44 PM
Karak10
Karak10 - avatar
1 ответ
+ 11
This is a browser issue, not SoloLearn. As you said, it requires user interaction. So, you can make a start popup which asks a user whether audio should be turned on or not. And when you get a positive answer, you can play your audio.
21st May 2021, 5:40 AM
Igor Makarsky
Igor Makarsky - avatar