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
track
The SpotifyKit track to play.
position
The position, in seconds, from which to begin playback. The default value is
0
, playing the track from the beginning.handler
The callback handler for the request, providing an error identifying if and why the request failed, or
nil
if 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
album
The SpotifyKit album to play.
index
The index of the track within the album to begin playing. The default value is
0
, beginning with the first track in the album.position
The position, in seconds, from which to begin playback of the given track. The default value is
0
, playing the track from the beginning.handler
The callback handler for the request, providing an error identifying if and why the request failed, or
nil
if 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
playlist
The SpotifyKit playlist to play.
index
The index of the track within the playlist to begin playing. The default value is
0
, beginning with the first track in the playlist.position
The position, in seconds, from which to begin playback of the given track. The default value is
0
, playing the track from the beginning.handler
The callback handler for the request, providing an error identifying if and why the request failed, or
nil
if the request was successful.
-
Queues a Spotify track.
Declaration
Swift
public func queue<T: Track>(_ track: T, completion handler: @escaping SKErrorHandler)
Parameters
track
The SpotifyKit track to add to the playback queue.
handler
The callback handler for the request, providing an error identifying if and why the request failed, or
nil
if the request was successful.