mpnowplayinginfocenter

Set MPNowPlayingInfoCenter duration from AVPlayer?

萝らか妹 提交于 2019-12-11 11:57:47
问题 I am trying to set MPNowPlayingInfoCenter, most of the key-value pairs work fine, but there is some kind of issue with playback time let mpic = MPNowPlayingInfoCenter.defaultCenter() mpic.nowPlayingInfo = [ MPMediaItemPropertyArtwork:albumArtWork, MPMediaItemPropertyTitle:titleString, MPMediaItemPropertyArtist:artistName, MPMediaItemPropertyPlaybackDuration:99, MPNowPlayingInfoPropertyElapsedPlaybackTime:String(stringInterpolationSegment:self.myPlayer.currentItem?.currentTime()),

Get meta data displayed in MPNowPlayingInfoCenter's nowPlayingInfo(lock screen and remote control)

浪子不回头ぞ 提交于 2019-12-11 03:46:05
问题 Thanks for noticing this question. I want to do something about music recommendation, and what I am doing now is leveraging MPNowPlayingInfoCenter 's nowPlayingInfo , like this: NSDictionary *metaData = [[MPNowPlayingInfoCenter defaultCenter] nowPlayingInfo]; NSString *songTitle = metaData[MPMediaItemPropertyTitle]; NSString *albumnTitle = metaData[MPMediaItemPropertyAlbumTitle]; NSString *artist = metaData[MPMediaItemPropertyArtist]; But it always returns nil when "Music" app is playing

MPNowPlayingInfoCenter doesn't update any information when after assigning to nowPlayingInfo

谁都会走 提交于 2019-12-10 13:30:44
问题 I'm making an iOS app using Swift 3 in which displaying information about the currently playing item on the lock screen and control center would be nice. Currently, I'm using the following code to attempt to insert this information into the nowPlayingInfo dictionary. I've also included reference to the VideoInfo class that is used in videoBeganPlaying(_:) . class VideoInfo { var channelName: String var title: String } // ... var videoInfoNowPlaying: VideoInfo? // ... @objc private func

Does google chromecast iOS SDK support lock screen controls?

自作多情 提交于 2019-12-10 08:04:37
问题 I've tried to implement lock screen controls for google Chromecast video streaming app with the latest GoogleCast framework for iOS (2.1.0). I've corrected the example Chromecast app - https://github.com/googlecast/CastVideos-ios Have added UIBackgroundModes row to the Info.plist Added MediaPlayer framework. And added the following code to ChromecastDeviceController.m #import <MediaPlayer/MPNowPlayingInfoCenter.h> #import <MediaPlayer/MPMediaItem.h> ....... - (BOOL)loadMedia:(NSURL *)url

How to tell the MPNowPlayingInfoCenter wether or not the music is playing or paused?

断了今生、忘了曾经 提交于 2019-12-06 20:18:43
问题 I can't seem to make iOS show the correct play / pause button in the remote audio controls. I do receive the remote control events and set all values of the nowPlayingInfo dictionary. Everything works fine and I even see a cover photo on the lock screen. Except the pause/play button. It always looks like pause even if my AVAudioPlayer is playing. It sends a pause event regardless of playback state. How can I notify iOS that AVAudioPlayer is paused and that it should now show a play button in

Does google chromecast iOS SDK support lock screen controls?

旧巷老猫 提交于 2019-12-05 12:03:46
I've tried to implement lock screen controls for google Chromecast video streaming app with the latest GoogleCast framework for iOS (2.1.0). I've corrected the example Chromecast app - https://github.com/googlecast/CastVideos-ios Have added UIBackgroundModes row to the Info.plist Added MediaPlayer framework. And added the following code to ChromecastDeviceController.m #import <MediaPlayer/MPNowPlayingInfoCenter.h> #import <MediaPlayer/MPMediaItem.h> ....... - (BOOL)loadMedia:(NSURL *)url thumbnailURL:(NSURL *)thumbnailURL title:(NSString *)title subtitle:(NSString *)subtitle mimeType:(NSString

How to tell the MPNowPlayingInfoCenter wether or not the music is playing or paused?

佐手、 提交于 2019-12-05 01:38:47
I can't seem to make iOS show the correct play / pause button in the remote audio controls. I do receive the remote control events and set all values of the nowPlayingInfo dictionary. Everything works fine and I even see a cover photo on the lock screen. Except the pause/play button. It always looks like pause even if my AVAudioPlayer is playing. It sends a pause event regardless of playback state. How can I notify iOS that AVAudioPlayer is paused and that it should now show a play button in the remote control buttons bar? Jan Pittner Make sure that you're setting the

MPNowPlayingInfoCenter nowPlayingInfo ignored for AVPlayer audio via AirPlay

故事扮演 提交于 2019-12-04 17:38:05
问题 I have implemented audio playback using AVPlayer, playing a remote mp3 url. I want to display the information about the currently playing audio using the MPNowPlayingInfoCenter nowPlayingInfo method. When I lock the screen, I do see the image and title I set, so I know that this method is registering the information in some way, but when I switch to AirPlay to an AppleTV, the display looks like a generic video output, with the progress bar at bottom, but elapsed time and duration correctly

Swift. Receive remote control events to work with MPNowPLayingInfoCenter

那年仲夏 提交于 2019-12-04 02:15:42
问题 As I understand, in order to show music player on lock screen, writing the following code is not enough. override func viewDidAppear(animated: Bool) { var mpic = MPNowPlayingInfoCenter.defaultCenter() mpic.nowPlayingInfo = [ MPMediaItemPropertyTitle:"This Is a Test", MPMediaItemPropertyArtist:"Matt Neuburg" ] } My app also should be able to receive remote control events So, how to do that in Swift? I found this from Apple Documentation, but it's for Objective-C. - (void)viewDidAppear:(BOOL

MPMediaItemArtwork init(image:) deprecated in iOS 10.0

十年热恋 提交于 2019-12-04 01:11:02
Apple has deprecated init(image:) method in MPMediaItemArtwork in iOS 10. What is the new alternative. the class shows interface shows method below to be available in the new OS version public init(boundsSize: CGSize, requestHandler: @escaping (CGSize) -> UIImage) Anyone know how to use it? Also question 2, part of the previous question: Does showing now playing metadata on the lock-screen and control-center using MPNowPlayingInfoCenter work in the simulator? Virasio You can use the following code: let image = UIImage(named: "logo")! let artwork = MPMediaItemArtwork.init(boundsSize: image.size