possan / webapi-player-example

An attempt at recreating the spotify player using only the Web API's
http://lab.possan.se/thirtify/
294 stars 100 forks source link

Make it work on Android phones #10

Closed JMPerez closed 10 years ago

JMPerez commented 10 years ago

On Android (and most probably the rest of mobile devices) audio can't be play from the Audio object unless it's a result of a direct user touch event. Similar to how popup blocking works. As a result, the phone doesn't play anything.

Even though it seems the user tapping a track should lead to playing that track as a direct action, the promise used in $http in API.getTrack() disconnects the callback from the user touch action.

A workaround is to start playing as the user taps, and change the src once we get the URL for the track.