STKAudioPlayer https soundcloud不会流式传输

时间:2017-03-04 04:01:36

标签: ios swift3 soundcloud

我使用以下代码运行基于Soundcloud的URL音频文件。

https://api.soundcloud.com/tracks/<Track Name>/stream?client_id=<my Client id>

var podcastPlayer =  STKAudioPlayer.init()
podcastPlayer.delegate = self
podcastPlayer.play(urlString)

它没有超过缓冲状态

func audioPlayer(_ audioPlayer: STKAudioPlayer, stateChanged state: STKAudioPlayerState, previousState: STKAudioPlayerState) {
        if( state == .playing){
            JDStatusBarNotification.dismiss()
            updateRemoteNotificationDisplay()
        }else if(state == .buffering) {
            JDStatusBarNotification.show(withStatus: "Buffering!..Please Wait!", styleName: JDStatusBarStyleRed)
            JDStatusBarNotification.showActivityIndicator(true, indicatorStyle: .gray)
        }else if(state == .stopped) {
            JDStatusBarNotification.dismiss()
        }
        NotificationCenter.default.post(name: Notification.Name(rawValue: NLConstants.NOTIF_PODCAST_UPDATE_UI), object: nil)
    }

0 个答案:

没有答案