ToneDen / Player

A pure JS customizable audio player for SoundCloud.
toneden.io/player
MIT License
529 stars 77 forks source link

Skip track not working on iOS #43

Closed benghuckle closed 7 years ago

benghuckle commented 9 years ago

No problems with Safari on the Mac but I'm having issues skipping on iOS. It just stops on loadedmetadata and doesn't go any further.

[Debug] New track index: 1 (toneden.js, line 30354) [Log] has next (toneden.js, line 21798) [Log] track_1927999431430410353770: loadstart (toneden.js, line 5300) [Log] track_1927999431430410353770: suspend (toneden.js, line 5300) [Log] track_1927999431430410353770: loadedmetadata (toneden.js, line 5300)

elsbree commented 9 years ago

This may be related to #35. TL;DR is that iOS doesn't allow us to start loading audio without some user input. We may not be handling the press on the 'skip' button in a way that causes mobile Safari to load the next track. If you press play after hitting the skip button, does it work?

benghuckle commented 9 years ago

Not sure, here's my output. I can force it to play after a few tries.

Loading Script

SoundManager 2: No Flash detected. Trying HTML5-only mode. toneden.js:5298 toneden.js:5298SoundManager 2 HTML5 support: mp3 = true, mp4 = true, ogg = false (and no flash support), opus = false (and no flash support), wav = true toneden.js:5300SoundManager 2: Ready. toneden.js:21798SOUNDMANAGER2 ready!! toneden.js:30354[ Object , Object , Object ] toneden.js:21798changeTrack toneden.js:21798setSound toneden.js:5298soundManager.createSound(): track_1962878371430472415304 (https://api.soundcloud.com/tracks/196287837/stream?consumer_key=6f85bdf51b0a19b7ab2df7b969233901&ts=1430472416) toneden.js:5296track_1962878371430472415304: Merged options: Object toneden.js:5300track_1962878371430472415304: Using HTML5 toneden.js:5300track_1962878371430472415304: Using HTML5 Audio for eqData and waveform toneden.js:5300track_1962878371430472415304: load (https://api.soundcloud.com/tracks/196287837/stream?consumer_key=6f85bdf51b0a19b7ab2df7b969233901&ts=1430472416) toneden.js:5300track_1962878371430472415304: Using HTML5 Audio for eqData and waveform toneden.js:5300track_1962878371430472415304: load (https://api.soundcloud.com/tracks/196287837/stream?consumer_key=6f85bdf51b0a19b7ab2df7b969233901&ts=1430472416) toneden.js:5298soundManager.load(): current URL already assigned. toneden.js:30354New track index: 0 toneden.js:5300track_1962878371430472415304: abort toneden.js:5300track_1962878371430472415304: loadstart toneden.js:5300track_1962878371430472415304: suspend toneden.js:5300track_1962878371430472415304: loadedmetadata

Pressing the play button for the first song which works fine

[Log] track_1962878371430472415304: togglePause() (toneden.js, line 5300) [Log] track_1962878371430472415304: Using HTML5 Audio for eqData and waveform (toneden.js, line 5300) [Log] track_1962878371430472415304: load (https://api.soundcloud.com/tracks/196287837/stream?consumer_key=6f85bdf51b0a19b7ab2df7b969233901&ts=1430472416) (toneden.js, line 5300) [Log] soundManager.load(): current URL already assigned. (toneden.js, line 5298) [Log] track_1962878371430472415304: play(): Loading - attempting to play... (toneden.js, line 5300) [Log] track.onplay (toneden.js, line 21798) [Log] track_1962878371430472415304: Using HTML5 Audio for eqData and waveform (toneden.js, line 5300) [Log] track_1962878371430472415304: load (https://api.soundcloud.com/tracks/196287837/stream?consumer_key=6f85bdf51b0a19b7ab2df7b969233901&ts=1430472416) (toneden.js, line 5300) [Log] soundManager.load(): current URL already assigned. (toneden.js, line 5298) [Log] track_1962878371430472415304: waiting (toneden.js, line 5300) [Log] track_1962878371430472415304: loadeddata (toneden.js, line 5300) [Log] track_1962878371430472415304: canplay (toneden.js, line 5300) [Log] track_1962878371430472415304: playing (toneden.js, line 5300) [Log] track_1962878371430472415304: togglePause() (toneden.js, line 5300) [Log] track_1962878371430472415304: pause() (toneden.js, line 5300) [Log] track_1962878371430472415304: Using HTML5 Audio for eqData and waveform (toneden.js, line 5300) [Log] track_1962878371430472415304: load (https://api.soundcloud.com/tracks/196287837/stream?consumer_key=6f85bdf51b0a19b7ab2df7b969233901&ts=1430472416) (toneden.js, line 5300) [Log] soundManager.load(): current URL already assigned. (toneden.js, line 5298) [Log] track_1962878371430472415304: canplaythrough (toneden.js, line 5300) [Log] track_1962878371430472415304: onload() (toneden.js, line 5298) [Log] onload (toneden.js, line 21798) [Log] track.onready!!! (toneden.js, line 21798) [Log] track_1962878371430472415304: togglePause() (toneden.js, line 5300) [Log] track_1962878371430472415304: resume() (toneden.js, line 5300) [Log] track_1962878371430472415304: Using HTML5 Audio for eqData and waveform (toneden.js, line 5300) [Log] track_1962878371430472415304: load (https://api.soundcloud.com/tracks/196287837/stream?consumer_key=6f85bdf51b0a19b7ab2df7b969233901&ts=1430472416) (toneden.js, line 5300) [Log] soundManager.load(): current URL already assigned. (toneden.js, line 5298) [Log] onload (toneden.js, line 21798) [Log] track.onready!!! (toneden.js, line 21798) [Log] track_1962878371430472415304: suspend (toneden.js, line 5300) [Log] track_1962878371430472415304: playing (toneden.js, line 5300)

So the track is playing and I press the skip button, the track name loads but no audio

[Log] next (toneden.js, line 21798) [Log] true (toneden.js, line 21798) [Log] changeTrack (toneden.js, line 21798) [Log] track_1962878371430472415304: Destruct (toneden.js, line 5300) [Log] track_1962878371430472415304: stop() (toneden.js, line 5300) [Log] track_1962878371430472415304: unload() (toneden.js, line 5300) [Log] setSound (toneden.js, line 21798) [Log] soundManager.createSound(): track_1927999431430472415304 (https://api.soundcloud.com/tracks/192799943/stream?consumer_key=6f85bdf51b0a19b7ab2df7b969233901&ts=1430472593) (toneden.js, line 5298) [Log] track_1927999431430472415304: Merged options: (toneden.js, line 5296) Object

[Log] track_1927999431430472415304: Using HTML5 (toneden.js, line 5300) [Log] track_1927999431430472415304: Using HTML5 Audio for eqData and waveform (toneden.js, line 5300) [Log] track_1927999431430472415304: load (https://api.soundcloud.com/tracks/192799943/stream?consumer_key=6f85bdf51b0a19b7ab2df7b969233901&ts=1430472593) (toneden.js, line 5300) [Log] track_1927999431430472415304: Using HTML5 Audio for eqData and waveform (toneden.js, line 5300) [Log] track_1927999431430472415304: load (https://api.soundcloud.com/tracks/192799943/stream?consumer_key=6f85bdf51b0a19b7ab2df7b969233901&ts=1430472593) (toneden.js, line 5300) [Log] soundManager.load(): current URL already assigned. (toneden.js, line 5298) [Debug] New track index: 1 (toneden.js, line 30354) [Log] has next (toneden.js, line 21798) [Log] track_1927999431430472415304: loadstart (toneden.js, line 5300) [Log] track_1927999431430472415304: suspend (toneden.js, line 5300) [Log] track_1927999431430472415304: loadedmetadata (toneden.js, line 5300)

I then hit the play button to try and force it with no luck just the loading spinner

[Log] track_1927999431430472415304: togglePause() (toneden.js, line 5300) [Log] track_1927999431430472415304: Using HTML5 Audio for eqData and waveform (toneden.js, line 5300) [Log] track_1927999431430472415304: load (https://api.soundcloud.com/tracks/192799943/stream?consumer_key=6f85bdf51b0a19b7ab2df7b969233901&ts=1430472593) (toneden.js, line 5300) [Log] soundManager.load(): current URL already assigned. (toneden.js, line 5298) [Log] track_1927999431430472415304: play(): Loading - attempting to play... (toneden.js, line 5300) [Log] track.onplay (toneden.js, line 21798) [Log] track_1927999431430472415304: Using HTML5 Audio for eqData and waveform (toneden.js, line 5300) [Log] track_1927999431430472415304: load (https://api.soundcloud.com/tracks/192799943/stream?consumer_key=6f85bdf51b0a19b7ab2df7b969233901&ts=1430472593) (toneden.js, line 5300) [Log] soundManager.load(): current URL already assigned. (toneden.js, line 5298) [Log] track_1927999431430472415304: waiting (toneden.js, line 5300) [Log] track_1927999431430472415304: loadeddata (toneden.js, line 5300) [Log] track_1927999431430472415304: canplay (toneden.js, line 5300) [Log] track_1927999431430472415304: playing (toneden.js, line 5300) [Log] track_1927999431430472415304: togglePause() (toneden.js, line 5300) [Log] track_1927999431430472415304: pause() (toneden.js, line 5300) [Log] track_1927999431430472415304: Using HTML5 Audio for eqData and waveform (toneden.js, line 5300) [Log] track_1927999431430472415304: load (https://api.soundcloud.com/tracks/192799943/stream?consumer_key=6f85bdf51b0a19b7ab2df7b969233901&ts=1430472593) (toneden.js, line 5300) [Log] soundManager.load(): current URL already assigned. (toneden.js, line 5298) [Log] track_1927999431430472415304: stalled (toneden.js, line 5300) [Log] track_1927999431430472415304: canplaythrough (toneden.js, line 5300) [Log] track_1927999431430472415304: onload() (toneden.js, line 5298) [Log] onload (toneden.js, line 21798) [Log] track.onready!!! (toneden.js, line 21798) [Log] play (toneden.js, line 21798) [Log] track_1927999431430472415304: Using HTML5 Audio for eqData and waveform (toneden.js, line 5300) [Log] track_1927999431430472415304: load (https://api.soundcloud.com/tracks/192799943/stream?consumer_key=6f85bdf51b0a19b7ab2df7b969233901&ts=1430472593) (toneden.js, line 5300) [Log] soundManager.load(): current URL already assigned. (toneden.js, line 5298) [Log] onload (toneden.js, line 21798) [Log] track.onready!!! (toneden.js, line 21798) [Log] track_1927999431430472415304: play() (toneden.js, line 5300) [Log] track_1927999431430472415304: play(): Resuming from paused state (toneden.js, line 5298) [Log] track_1927999431430472415304: resume() (toneden.js, line 5300) [Log] track_1927999431430472415304: Using HTML5 Audio for eqData and waveform (toneden.js, line 5300) [Log] track_1927999431430472415304: load (https://api.soundcloud.com/tracks/192799943/stream?consumer_key=6f85bdf51b0a19b7ab2df7b969233901&ts=1430472593) (toneden.js, line 5300) [Log] soundManager.load(): current URL already assigned. (toneden.js, line 5298) [Log] onload (toneden.js, line 21798) [Log] track.onready!!! (toneden.js, line 21798) [Debug] Playing. (toneden.js, line 30354) [Log] track_1927999431430472415304: playing (toneden.js, line 5300) [Log] track_1927999431430472415304: togglePause() (toneden.js, line 5300) [Log] track_1927999431430472415304: pause() (toneden.js, line 5300) [Log] track_1927999431430472415304: Using HTML5 Audio for eqData and waveform (toneden.js, line 5300) [Log] track_1927999431430472415304: load (https://api.soundcloud.com/tracks/192799943/stream?consumer_key=6f85bdf51b0a19b7ab2df7b969233901&ts=1430472593) (toneden.js, line 5300) [Log] soundManager.load(): current URL already assigned. (toneden.js, line 5298) [Log] onload (toneden.js, line 21798) [Log] track.onready!!! (toneden.js, line 21798) [Log] track_1927999431430472415304: canplaythrough (toneden.js, line 5300) [Log] track_1927999431430472415304: suspend (toneden.js, line 5300) [Log] track_1927999431430472415304: canplaythrough (toneden.js, line 5300)

I hit the play button again and it finally played

[Log] track_1927999431430472415304: togglePause() (toneden.js, line 5300) [Log] track_1927999431430472415304: resume() (toneden.js, line 5300) [Log] track_1927999431430472415304: Using HTML5 Audio for eqData and waveform (toneden.js, line 5300) [Log] track_1927999431430472415304: load (https://api.soundcloud.com/tracks/192799943/stream?consumer_key=6f85bdf51b0a19b7ab2df7b969233901&ts=1430472593) (toneden.js, line 5300) [Log] soundManager.load(): current URL already assigned. (toneden.js, line 5298) [Log] onload (toneden.js, line 21798) [Log] track.onready!!! (toneden.js, line 21798) [Log] track_1927999431430472415304: playing (toneden.js, line 5300)

elsbree commented 7 years ago

Note: I'm closing every issue on this repo with this message.

I apologize for not being in contact earlier. We recently received notice from SoundCloud that they're shutting down their external streaming API for business reasons that I won't speculate about.

Every user of a custom SoundCloud player, ours included, will need to switch to their embedded player in order to stream songs from SoundCloud.

It's disappointing that we have to be the ones to break this news to developers, and I'm sorry for the inconvenience it's caused the users of our player. I'll leave this repo up and add this message to the top of the README so that others become aware of the situation.