tvOS nowPlayingInfo not showing - SOLVED
Posted: 01 Oct 2021 07:53
trying to display played media info on the apple tv "Notification Center" area:
![Image](https://www.imore.com/sites/imore.com/files/styles/large_wm_blw/public/field/image/2019/09/apple-tv-multiple-users.jpg)
using the nowPlayingInfo dictionary (i am using SwiftUI), but any working code sample would do, this is a sample code i found, but it's not working for me:
(seen on: https://docplayer.net/61615774-Now-play ... -tvos.html)
i tried yo put this code in the "playerTimeChanged" callback and in the player "onAppear" none of it worked
any ideas?
![Image](https://www.imore.com/sites/imore.com/files/styles/large_wm_blw/public/field/image/2019/09/apple-tv-multiple-users.jpg)
using the nowPlayingInfo dictionary (i am using SwiftUI), but any working code sample would do, this is a sample code i found, but it's not working for me:
Code: Select all
let center = MPNowPlayingInfoCenter.default()
center.nowPlayingInfo = [
MPMediaItemPropertyTitle: "Mastering UIKit on tvOS",
MPMediaItemPropertyArtist: "Apple",
MPMediaItemPropertyAlbumTitle: "WWDC 2016",
MPMediaItemPropertyMediaType: MPNowPlayingInfoMediaType.video.rawValue,
MPNowPlayingPlaybackState: MediaState
MPNowPlayingInfoPropertyElapsedPlaybackTime: 0.0,
MPMediaItemPropertyPlaybackDuration: 3300.0
]
i tried yo put this code in the "playerTimeChanged" callback and in the player "onAppear" none of it worked
any ideas?