mpmediaplayercontroller

MPMusicPlayerController.applicationQueuePlayer bugs in iOS 13.4

你离开我真会死。 提交于 2020-05-16 03:10:07
问题 I submitted Feedback about this in Feedback Assistant already, but figured I'd post here too -- as of iOS 13.4, I have noticed various bugs in the MediaPlayer framework, specifically with the applicationQueuePlayer and applicationMusicPlayer. The first is that on app launch when it initializes, it now throws this error: [SDKPlayback] applicationQueuePlayer _establishConnectionIfNeeded timeout [ping did not pong] That error is followed by this one, when prepareToPlay() is called: Error Domain

iOS: MPMusicPlayerControllerPlaybackStateDidChangeNotification called multiple times on certain devices

℡╲_俬逩灬. 提交于 2020-01-13 12:08:12
问题 I have an application that plays back music. I'm using the following code to listen to playback state changes from the MPMusicPlayerController to update the UI. More precisely I toggle the look of the play button between play and pause. NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; [notificationCenter addObserver: self selector: @selector (handle_NowPlayingItemChanged:) name: MPMusicPlayerControllerNowPlayingItemDidChangeNotification object: self.musicPlayer

iOS: MPMusicPlayerControllerPlaybackStateDidChangeNotification called multiple times on certain devices

徘徊边缘 提交于 2020-01-13 12:08:09
问题 I have an application that plays back music. I'm using the following code to listen to playback state changes from the MPMusicPlayerController to update the UI. More precisely I toggle the look of the play button between play and pause. NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; [notificationCenter addObserver: self selector: @selector (handle_NowPlayingItemChanged:) name: MPMusicPlayerControllerNowPlayingItemDidChangeNotification object: self.musicPlayer

AVFoundation play consecutive video fragments

你说的曾经没有我的故事 提交于 2020-01-03 03:12:40
问题 I am working on an iOS app that involves fetching video fragments that are part of a stream from a web server and playing them consecutively inside the app. After some research, I decided to use an AVQueuePlayer. Every time I fetch an MP4 file from the server and store it in an NSData object, I create an AVPlayerItem and append it to the queue. Also, I listen to the AVPlayerItemDidPlayToEndTimeNotification notification where I advance to next item. The issue I am facing is an annoying small

Playing Video From UITableView

旧时模样 提交于 2019-12-22 10:15:33
问题 My main goal is to be able to click on a table view item and load a video. The table view is populated with the contents of the documents directory and I have been able to do this successfully and add the filename to the cell's label, I have done this with the following code: void)viewDidLoad { [super viewDidLoad]; NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; // Get documents folder

Music info showing in Command Center but not Lock Screen

落花浮王杯 提交于 2019-12-22 09:31:31
问题 Using Swift 4+, iOS 11+, Xcode 10+ I've built a music player using MPMediaPlayer and I can interact with it from the Command Center, however I would like to be able to also see it on the Lock Screen. To be honest, I'm a bit confused as to why it's showing/working in the Command Center as I have not written any code to do this. Nevertheless, I would also like it to show in the Lock Screen. This is what I have done so far: 1) I'm using the applicationMusicPlayer and made certain something is

MPMoviePlayerPlaybackDidFinishNotification being called again in iPhone 4.3 simulator when setting contentURL

邮差的信 提交于 2019-12-21 04:59:19
问题 NOTE: See the updates at the bottom. I have an application to play videos one by one from a list. So, to test this functionality, I created a simple application with only one view controller. I referenced this blog before implementing this view controller. The view controller is named TNViewController and its implementation is as follows: #import <UIKit/UIKit.h> #import <MediaPlayer/MediaPlayer.h> @interface TNViewController : UIViewController { @private NSMutableArray *_videoArray; int

Quitting app causes error “Message from debugger: Terminated due to signal 9”

末鹿安然 提交于 2019-12-17 11:28:30
问题 I'm writing a basic music player app but having some problems when it comes to handling the app state transitions. I'm using Swift 3 and MPMusicPlayerController.systemMusicPlayer() The goal is this: 1) Keep music playing when user taps the Home button and app enters bg (works) 2) Stop the player ( myMP.stop() ) if the user the quits the app (works sometimes, throws error other times) I traced the flows using print statements based on possible actions and got this: Flow 2 is what I would

Observing currentPlaybackTime and showing an overlay at intervals

瘦欲@ 提交于 2019-12-12 06:45:46
问题 I’m making a video that shows overlays at certain intervals of a video. I’ve managed to get the video to play. Now my objective is to watch/observe the currentPlaybackTime value and pause the video when it hits 2 seconds. After some research found that currentPlaybackTime does not support KOV. So I need to implement this solution but I have no idea where to put the code - I’m very new to Objective C. I keep trying to put it in the ViewController (My only view) but the way its written hints to

MPMusicPlayerController buffering / preloading

孤街浪徒 提交于 2019-12-11 10:08:17
问题 Is there a way to make MPMusicPlayerController buffer content before I call -play? Or does it do this by default when you set a queue? AVAudioPlayer has the -prepareToPlay method and I've heard that AVQueuePlayer starts buffering the next item automatically, but does MPMusicPlayerController have the same behaviour? 回答1: The answer to this question is in the iOS 6 beta docs, if anyone is wondering. Can't say much more because of NDA. EDIT: As requested, since the NDA has been lifted, here's