Question

Soundcloud Widget API need to .play() twice on mobile to play song

  • 24 August 2019
  • 0 replies
  • 57 views

Hi there,
I am developing an application using the Soundcloud Widget API which can be viewed at https://www.thedailybanger.com

I am having issues firing off a Widget Api .play() event on mobile. On desktop, when I play a song it immediately starts playing and has no issues. However, on mobile devices, I have to play, pause, then play again in order for the song to begin playing.

Is this an issue with mobile devices and the Widget API? Does anyone have any insight as to why this is happening? Below is the code that is fired when the IFrame has successfully loaded a song.

code:
ameLoaded () {
this.player.bind(SC.Widget.Events.READY, () => {
this.player.getCurrentSound((song) => {
this.song = song;
this.$store.commit('setSongLoaded', true);
this.$store.commit('setSongMetadata', song);
this.player.play();
});

this.player.bind(SC.Widget.Events.PLAY_PROGRESS, (progress) => {
this.$store.commit('setCurrentProgress', progress.currentPosition);
this.$store.commit('setRelativePosition', progress.relativePosition);
});

this.player.bind(SC.Widget.Events.FINISH, () => {
console.log("Song finished");
})
});

0 replies

Be the first to reply!

Reply