feat: add milo as now playing album artwork
This commit is contained in:
23
InfinifiIOS/Assets.xcassets/Milo0.imageset/Contents.json
vendored
Normal file
23
InfinifiIOS/Assets.xcassets/Milo0.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"filename" : "Milo0.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "1x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "Milo0@2x.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "2x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "Milo0@3x.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "3x"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
BIN
InfinifiIOS/Assets.xcassets/Milo0.imageset/Milo0.png
vendored
Normal file
BIN
InfinifiIOS/Assets.xcassets/Milo0.imageset/Milo0.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
BIN
InfinifiIOS/Assets.xcassets/Milo0.imageset/Milo0@2x.png
vendored
Normal file
BIN
InfinifiIOS/Assets.xcassets/Milo0.imageset/Milo0@2x.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.0 KiB |
BIN
InfinifiIOS/Assets.xcassets/Milo0.imageset/Milo0@3x.png
vendored
Normal file
BIN
InfinifiIOS/Assets.xcassets/Milo0.imageset/Milo0@3x.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.0 KiB |
@@ -18,6 +18,8 @@ class PlaybackManager: ObservableObject {
|
|||||||
private var fadeOutTimer: Timer?
|
private var fadeOutTimer: Timer?
|
||||||
private var scheduledFadeOutTimer: Timer?
|
private var scheduledFadeOutTimer: Timer?
|
||||||
|
|
||||||
|
private var miloArtwork = UIImage(named: "Milo0")
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
Task { try await initialize() }
|
Task { try await initialize() }
|
||||||
}
|
}
|
||||||
@@ -31,10 +33,18 @@ class PlaybackManager: ObservableObject {
|
|||||||
|
|
||||||
NotificationCenter.default.addObserver(self, selector: #selector(onAudioInterrupted), name: AVAudioSession.interruptionNotification, object: audioSession)
|
NotificationCenter.default.addObserver(self, selector: #selector(onAudioInterrupted), name: AVAudioSession.interruptionNotification, object: audioSession)
|
||||||
|
|
||||||
MPNowPlayingInfoCenter.default().nowPlayingInfo = [
|
var nowPlayInfo: [String: Any] = [
|
||||||
MPMediaItemPropertyTitle: "infinite lo-fi music",
|
MPMediaItemPropertyTitle: "infinite lo-fi music",
|
||||||
MPMediaItemPropertyArtist: "infinifi"
|
MPMediaItemPropertyArtist: "infinifi",
|
||||||
|
MPNowPlayingInfoPropertyIsLiveStream: true,
|
||||||
]
|
]
|
||||||
|
if let milo = miloArtwork {
|
||||||
|
nowPlayInfo[MPMediaItemPropertyArtwork] = MPMediaItemArtwork(boundsSize: milo.size) { _ in
|
||||||
|
milo
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MPNowPlayingInfoCenter.default().nowPlayingInfo = nowPlayInfo
|
||||||
|
|
||||||
let cmdCenter = MPRemoteCommandCenter.shared()
|
let cmdCenter = MPRemoteCommandCenter.shared()
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user