1

I am new in TVOS please help me out with this type of warning. for iOS it is working fine but for TVOS it is giving warning like "'timedMetadata' was deprecated in tvOS 13.0: Use AVPlayerItemMetadataOutput to obtain timed metadata"

 else if keyPath == "timedMetadata" {
            let data: AVPlayerItem = object as! AVPlayerItem
            if let metadata = data.timedMetadata {
                for item in metadata  {
                    if item.key?.description == "publisher" {
                        var tempID = 0
                        var type = ""
                        if let streamURL = item.value as? String {
                            let queryItems = URLComponents(string: streamURL)?.queryItemsDictionary
                            type = queryItems?["type"] as? String ?? ""
                            tempID = Int(queryItems?["plId"] as? String ?? "0") ?? 0
                            print("----------MetaURL----------")
                            print(streamURL)
                            let playout = Playout()
                            let song = Song()
                            let program = Program()
                            playout.type = type
                            if  type == PlayoutTypes.music {
                                var songName = queryItems?["songUrlTitle"] as? String ?? ""
                                var artistName = queryItems?["artistUrlTitle"] as? String ?? ""
                                songName = songName.replacingOccurrences(of: "-", with: " ")
                                artistName = artistName.replacingOccurrences(of: "-", with: " ")
                                song.songTitle = songName.localizedCapitalized
                                song.artistName = artistName.localizedCapitalized

                            }
}  }}}
byaruhaf
  • 4,128
  • 2
  • 32
  • 50
  • Check out https://stackoverflow.com/questions/57510280/timedmetadata-deprecated-another-method-updated – byaruhaf Jan 22 '20 at 11:57

0 Answers0