本文整理匯總了Golang中github.com/fabiofalci/sconsify/sconsify.Track.RetryLoading方法的典型用法代碼示例。如果您正苦於以下問題:Golang Track.RetryLoading方法的具體用法?Golang Track.RetryLoading怎麽用?Golang Track.RetryLoading使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/fabiofalci/sconsify/sconsify.Track
的用法示例。
在下文中一共展示了Track.RetryLoading方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: play
func (spotify *Spotify) play(trackUri *sconsify.Track) {
link, err := spotify.session.ParseLink(trackUri.URI)
if err != nil {
return
}
track, err := link.Track()
if err != nil {
return
}
if trackUri.IsPartial() {
trackUri = sconsify.ToSconsifyTrack(track)
}
if !spotify.isTrackAvailable(track) {
if trackUri.IsFromWebApi() {
retry := trackUri.RetryLoading()
if retry < 4 {
go func() {
time.Sleep(100 * time.Millisecond)
spotify.events.Play(trackUri)
}()
return
}
}
spotify.events.TrackNotAvailable(trackUri)
return
}
player := spotify.session.Player()
if err := player.Load(track); err != nil {
return
}
player.Play()
spotify.events.TrackPlaying(trackUri)
spotify.currentTrack = trackUri
spotify.paused = false
return
}