SPTAudioStreamingController
class SPTAudioStreamingController : NSObject
-
Plays a Spotify track.
Declaration
Swift
public func play<T: Track>(_ track: T, from position: TimeInterval = 0, completion handler: @escaping SKErrorHandler)Parameters
trackThe SpotifyKit track to play.
positionThe position, in seconds, from which to begin playback. The default value is
0, playing the track from the beginning.handlerThe callback handler for the request, providing an error identifying if and why the request failed, or
nilif the request was successful. -
Plays a Spotify album.
Declaration
Swift
public func play<T: Album>(_ album: T, at index: Int = 0, from position: TimeInterval = 0, completion handler: @escaping SKErrorHandler)Parameters
albumThe SpotifyKit album to play.
indexThe index of the track within the album to begin playing. The default value is
0, beginning with the first track in the album.positionThe position, in seconds, from which to begin playback of the given track. The default value is
0, playing the track from the beginning.handlerThe callback handler for the request, providing an error identifying if and why the request failed, or
nilif the request was successful. -
Plays a Spotify playlist.
Declaration
Swift
public func play(_ playlist: SKPlaylist, at index: Int = 0, from position: TimeInterval = 0, completion handler: @escaping SKErrorHandler)Parameters
playlistThe SpotifyKit playlist to play.
indexThe index of the track within the playlist to begin playing. The default value is
0, beginning with the first track in the playlist.positionThe position, in seconds, from which to begin playback of the given track. The default value is
0, playing the track from the beginning.handlerThe callback handler for the request, providing an error identifying if and why the request failed, or
nilif the request was successful.
-
Queues a Spotify track.
Declaration
Swift
public func queue<T: Track>(_ track: T, completion handler: @escaping SKErrorHandler)Parameters
trackThe SpotifyKit track to add to the playback queue.
handlerThe callback handler for the request, providing an error identifying if and why the request failed, or
nilif the request was successful.
View on GitHub
SPTAudioStreamingController Extension Reference