voronianski / soundcloud-audio.js

:musical_note: SoundCloud tracks and playlists with HTML5 Audio API
http://caniuse.com/#feat=audio
284 stars 46 forks source link

iOS - Play next track while device is locked #31

Open alexweinstein opened 5 years ago

alexweinstein commented 5 years ago

Not sure if this is new behavior or I just never paid attention.

I'm using the latest soundcloud-audio.js version (1.4.0) on an iPhone X with the most recent OS. If a user chooses a track it will play normally. When the song is completed, the next track in a list is played. However, when the device is locked or has gone to sleep, it simply stops at the end of the selected track.

Here's what I'm using:

function playTrack(track-identifier-example){
    global.currentSoundObject.play({
            streamUrl: track-identifier-example_stream_url
    });

    global.currentSoundObject.on('ended', function() {
        playTrack(next-track-identifier-example);
    });
}

Anyone else seeing this behavior? Should I be triggering the next track in a different way or is this a bug?

voronianski commented 5 years ago

Hi @alexweinstein, thanks for letting me know, I will check if it's a bug in the lib or OS related 👍