+ 1

Audio causes lagg

Hi! I have finally been able to get audio playing as I want! However every time audio is played, the game laggs a little bit. I load all the audio upon starting the game. Anyone know how to get rid of this lagg? Here is the code: https://code.sololearn.com/WkIPQwthB6K9/?ref=app To remove flap audio (and lagg), comment out line 177 “flapp();” Thanks! Joakim

3rd Nov 2018, 10:38 PM
Joakim Nyland
Joakim Nyland - avatar
11 Respostas
+ 1
I managed to fix it!! HTML5 Audio is very bad for my purpose. There is actually a part in ThreeJS that is made for playing audio like this. This removed all the lagg! See code for how it is implemented😄
4th Nov 2018, 3:45 PM
Joakim Nyland
Joakim Nyland - avatar
+ 4
iphone 6s+ no lag here. Just an amazing code👍
4th Nov 2018, 1:51 AM
xpnvdo
xpnvdo - avatar
+ 3
It doesn’t lag on my iPad. Strange!
3rd Nov 2018, 10:58 PM
Rowsej
Rowsej - avatar
+ 3
xp nvdo Sweet! Thanks a lot 😊
4th Nov 2018, 8:19 AM
Joakim Nyland
Joakim Nyland - avatar
+ 3
saantonandre Hey man! You are good with sounds and stuff, do you have any idea?đŸ€”
4th Nov 2018, 9:18 AM
Joakim Nyland
Joakim Nyland - avatar
+ 3
Joakim Nyland just tried this on my devices, on my samsung tab the sound only plays on the first tap then every other tap gives this error and plays no sound. uncaught (in promise)DataCloneError: Cannot decode detached ArrayBuffer Line:37297. ios works great still. sounds all play with no lag, and no error.
4th Nov 2018, 7:25 PM
xpnvdo
xpnvdo - avatar
+ 3
Wonderful!
4th Nov 2018, 8:25 PM
Rowsej
Rowsej - avatar
+ 2
More information: I have an fps of about 58, but when “flap” audio plays, fps drops by 10-26 which causes the tiny lagg.. No one knows anything about this?
4th Nov 2018, 8:38 AM
Joakim Nyland
Joakim Nyland - avatar
+ 2
Ahmed Mokhles Thanks a lot!😄😄
4th Nov 2018, 11:39 PM
Joakim Nyland
Joakim Nyland - avatar
+ 1
Rowsej I guess iPads are a lot faster. Thanks for checking! Can someone else check on an iPhone if it laggs a little?
3rd Nov 2018, 11:10 PM
Joakim Nyland
Joakim Nyland - avatar
+ 1
xp nvdo Thanks for the feedback! I will look into it!
4th Nov 2018, 7:36 PM
Joakim Nyland
Joakim Nyland - avatar