Post

Replies

Boosts

Views

Activity

Reply to ApplicationMusicPlayer plays only song from user defined playlists
Thanks for your response By user defined playlists, I mean playlist created by de user. The issue if with catalog playlists When a user adds a catalog playlist, and I'm get all the songs from that playlist, I can't play them with a startingAt position I'm new with swift that is way I wanted to know if it is my fault Below is the code I used to fetch all songs from a playlist     private func buildRequest(urlString: String) throws -> URLRequest {         //setting up ure for use         let requestUrl =  URL(string: urlString)!         //settingup request accept only json         var request = URLRequest(url: requestUrl)         request.addValue("application/json", forHTTPHeaderField: "Accept")         request.addValue("application/json", forHTTPHeaderField: "Content-Type")         return request     }     func getTracks(playlistID: MusicItemID) async -> MusicItemCollection<Song>? {         do{             if try await self.isAuthenticated() {                 let request = try self.buildRequest(urlString: "https://api.music.apple.com/v1/me/library/playlists/" + playlistID.rawValue + "/tracks")                 let response =  try await MusicDataRequest(urlRequest: urlRequest).response()                 if response != nil {                     let decoder = try self.decoder.decode(MusicItemCollection<Song>.self, from: response!.data)                     return decoder                 }             }         } catch {             print("Error info: \(error)")         }         return nil     } code-block Best regards
Topic: Media Technologies SubTopic: General Tags:
Aug ’21