Untitled

 avatar
unknown
plain_text
2 years ago
1.3 kB
5
Indexable
_playSong = async(musicUrl:any, musicImage:any,musicName:any, band_name:any, artistName:any ) => {
  // const token = await StorageProvider.get('USER_TOKEN')
  // console.log(musicUrl, "music deatils", token)

  this.setState({songDetails:{
    songName: musicName,
    artistName: artistName,
    songImageUrl: musicImage,
    songMediaUrl: musicUrl,
    bandName:band_name,
    liked: 'liked',
    spotify_post_id:'223' 
  }})
  
  if (this.context.contextId !== this.state.indexId) {

    this.context.playData(false)
    this.context.contextIdData(this.state.indexId)
    this.context.songData(this.state.songDetails)
    SoundPlayer.playUrl(musicUrl)


  } else {
    if (this.context.contextId === this.state.indexId) {
      if (this.context.isplay) {


        this.context.playData(false)
        this.context.contextIdData(this.state.indexId)
        this.context.songData(this.state.songDetails)
        SoundPlayer.playUrl(musicUrl)
      } else {

        this.context.playData(true)
        this.context.contextIdData(this.state.indexId)
        this.context.songData(this.state.songDetails)
        SoundPlayer.pause()
      }
    }
    else {
      this.context.playData(true)
      this.context.contextIdData(this.state.indexId)
      this.context.songData(this.state.songDetails)
      SoundPlayer.pause()
    }

  }
}
Editor is loading...