soundcloud / soundcloud-custom-player

The SoundCloud custom javascript based player
http://soundcloud.com
707 stars 231 forks source link

Next track skips in Chrome & mobile Safari #25

Closed NativePaul closed 12 years ago

NativePaul commented 12 years ago

I'm having a bit of a nightmare with a bug that I can't solve.

In Chrome for Windows and Safari whenever I try to play a set straight through it skips every second song. So at the end of track 1 it jumps to track 3 then track 5 etc.

To make sure it wasn't my code I uploaded the example source code and I get the same issue in the bottom player: http://wmuk-apache.co.uk/soundcloudtest/examples/sc-player-standard.html

IE and Firefox play the full set just fine.

I haven't edited a single line of code in the above example, I just uploaded the package that I got off github.

This is a disaster for a project I'm working on - any ideas to help me solve it?

NativePaul commented 12 years ago

Looking at the console the log records "track finished get the next one" twice in a row. I added a current time variable to it and the log is written 45 milliseconds apart.

track finished get the next one Time:1324543461897 sc-player.js:45 track finished get the next one Time:1324543461942 sc-player.js:45

Any ideas why Webkit browsers are running the onSkip function twice at the end of each track?

NativePaul commented 12 years ago

I found a solution that seems to work by commenting out line 112 // if (obj.currentTime === obj.duration) { callbacks.onEnd(); }

It seems that Safari and Chrome were firing that as well as the onSkip function.

I haven't done extensive testing, but I can't see any damage done by removing that line.

mataspetrikas commented 12 years ago

fixed in https://github.com/soundcloud/soundcloud-custom-player/commit/f653d4fd3dfb6263d792f493eb3b2325995fb623