Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Display now playing information in Command Center
import UIKit
import MediaPlayer
class ViewController: UIViewController {
override func viewDidLoad() {
func setupNowPlayingInfo() {
let image = UIImage(named: "artwork")!
let mediaArtwork = MPMediaItemArtwork(boundsSize: image.size) { (size: CGSize) -> UIImage in
return image
let nowPlayingInfo: [String: Any] = [
MPMediaItemPropertyArtist: "",
MPMediaItemPropertyTitle: "Live Streaming Example",
MPMediaItemPropertyArtwork: mediaArtwork,
MPNowPlayingInfoPropertyIsLiveStream: true
MPNowPlayingInfoCenter.default().nowPlayingInfo = nowPlayingInfo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment