mirror of
https://code.videolan.org/videolan/vlc
synced 2024-10-07 03:56:28 +02:00
macosx: expose live status and artwork to the OS
This commit is contained in:
parent
9020b03dcc
commit
9b77a17198
@ -1,7 +1,7 @@
|
||||
/*****************************************************************************
|
||||
* VLCRemoteControlService.m: MacOS X interface module
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2017-2019 VLC authors and VideoLAN
|
||||
* Copyright (C) 2017-2021 VLC authors and VideoLAN
|
||||
*
|
||||
* Authors: Carola Nitz <nitz.carola # gmail.com>
|
||||
* Felix Paul Kühne <fkuehne # videolan.org>
|
||||
@ -157,7 +157,22 @@ static inline NSArray * RemoteCommandCenterCommandsToHandle()
|
||||
currentlyPlayingTrackInfo[MPMediaItemPropertyArtist] = inputItem.artist;
|
||||
currentlyPlayingTrackInfo[MPMediaItemPropertyAlbumTitle] = inputItem.albumName;
|
||||
currentlyPlayingTrackInfo[MPMediaItemPropertyAlbumTrackNumber] = @([inputItem.trackNumber intValue]);
|
||||
currentlyPlayingTrackInfo[MPMediaItemPropertyPlaybackDuration] = @(SEC_FROM_VLC_TICK(inputItem.duration));
|
||||
|
||||
vlc_tick_t duration = inputItem.duration;
|
||||
currentlyPlayingTrackInfo[MPMediaItemPropertyPlaybackDuration] = @(SEC_FROM_VLC_TICK(duration));
|
||||
currentlyPlayingTrackInfo[MPNowPlayingInfoPropertyIsLiveStream] = @(duration <= 0);
|
||||
|
||||
NSURL *artworkURL = inputItem.artworkURL;
|
||||
if (artworkURL) {
|
||||
NSImage *coverArtImage = [[NSImage alloc] initWithContentsOfURL:artworkURL];
|
||||
if (coverArtImage) {
|
||||
MPMediaItemArtwork *mpartwork = [[MPMediaItemArtwork alloc] initWithBoundsSize:coverArtImage.size
|
||||
requestHandler:^NSImage* _Nonnull(CGSize size) {
|
||||
return coverArtImage;
|
||||
}];
|
||||
currentlyPlayingTrackInfo[MPMediaItemPropertyArtwork] = mpartwork;
|
||||
}
|
||||
}
|
||||
|
||||
[MPNowPlayingInfoCenter defaultCenter].nowPlayingInfo = currentlyPlayingTrackInfo;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user