PlateletLucoa / anime-radiostation

A radio web application playing J-pop tunes, based on LISTEN.moe
0 stars 0 forks source link

Performance issues? #6

Open PlateletLucoa opened 6 years ago

PlateletLucoa commented 6 years ago

After testing my application on multiple devices I found that it sometimes slows down a bit on my smartphones (especially older ones like OnePlus One). I suspect it’s because of my playerHeartbeat() function that controls playback and progressbar calculation that runs every 50 ms regardless of whether or not the player’s actually playing music. Or maybe it could be because of something else, I admit my code’s very sloppy. In hindsight there’s so many thing I could’ve written more efficiently.

PlateletLucoa commented 6 years ago

UPDATE: After testing a bit I can confirm that,

  1. Chrome on Android definitely has performance issues. Even when the music player update is lowered to 250ms (4x slower) it lags after a couple of songs have played, most notable is that song + artist name in tandem with the progress bar falls behind considerably and if you put your phone in sleep mode the music stops playing. Reloading the page seems to fix the problems but that's not something I'd want listeners to do. The application should be able to run (in the background or not) smoothly regardless of how long it has been playing.

  2. On Safari iOS, song + artist name updates fall behind after a few songs have played. It fixes itself if you pause/unpause or reload the page. I suspect this is because the fallback stream is not in sync with the Vorbis stream, of which the radio uses. Since I can't calculate the song length progress accurately using the fallback stream there's not much I can do atm, but if I come up with something I'll try it.

Can't say anything about Firefox and Edge atm, they work to a certain extent but until I've gotten them to run as smoothly as on Chrome it's not fair to pass a verdict yet. I did find a couple of other issues that I'll discuss seperately from here.

Chrome on desktop runs the best. It desyncs every once in a while but that's about it.