Yo! DJ Professor K here!!!
I’ve got a web development question I was wondering if anyone could answer. I run a Jet Set Radio fan website http://jetsetradio.live and if ya take a peek you’ll see it will play audio tracks back to back. However, when someone is running the site on mobile and locks the screen the current song will finish playing but the next track won’t load.
Is there any way to keep the audio playing and load the next track?
BTW, you totally rock Kirupa! I used to be a Flash dev and basically quit scripting all together when Flash died. I read an article by you saying that ya just have to move on. That users don’t really care what stuff is programmed in as long as it works. It gave me the inspiration to get into HTML5 and after some time I feel like I’m finally back up to par as if I was working in Flash! You’ve been a mega inspiration!!!
I really wish there was a way to keep the audio going, but I don’t think there is. I’ve had this exact same problem when I try to listen to songs on YouTube while falling asleep. I just don’t think the functionality is there or allowed. Yeah, it’s rough. (For me, the big problem is that the screen stays on and bright when I’d rather be sleeping.)
That’s really awesome! I bet if we bug @kirupa enough he’ll come in here and agree that it’s awesome.
I know there is a method to prevent the device from locking (by basically forcing a reload on an interval and then stopping it before it actually reloads). However I was really hoping to keep it going when the screen was off.
There’s a small tidbit I noticed that I was hoping to take advantage of…
Basically, when you are listening to a track and you lock your phone the track itself will keep playing until it ends. Before it does though, the ‘static’ sound (separate track) will play. I have the ‘static’ sound pre-loaded and that seems to play just fine after the track and then the device stops the audio. I haven’t tested all options but I was thinking maybe there was a way to take advantage of what’s happening though I don’t fully understand it completely. Maybe by loading a track while a track is playing to have it prepared? I guess I’ll do more testing but if anyone comes up with anything please let me know!
Hi DJProfessorK!!! Like Krilnon mentions, I am not sure if there is a way to avoid this. This link mentions some workarounds for the autoplay being ignored: http://matt-harrison.com/perfect-web-audio-on-ios-devices-with-the-web-audio-api/ Have you seen that link before?
Also, I’m glad to see that you have made the transition from Flash to HTML!