I'm making a music playing page, where I use SoundManager 2 for AngularJs.
I'm using a remote API to get a song URL to play. I enhanced an angular-soundmanager2 click event handler :
element.bind('click', function () {
if (angular.isFunction(scope.loadFunction)) {
scope.loadFunction(scope.song, function () {
$log.debug('adding song to playlist');
addToPlaylist(scope.song.playDetails);
})
} else {
$log.debug('adding song to playlist');
addToPlaylist(scope.song);
}
});
Where I added a part, that calls scope.loadFunction(song,callback)
and after this function loads a song URL it calls a callback to give the control back to angular-soundmanager2.
The problem is that on chrome for android I get an error :
Failed to execute 'play' on 'HTMLMediaElement': API can only be initiated by a user gesture.
it doesn't happen if a song has a URL from the beginning and async loading isn't used.
Are there any workarounds for it?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…