Tag: mpmusicplayercontroller

所有tableView单元格显示相同的艺术作品图像的播放列表

我有一个tableView显示用户的音乐库播放列表的列表。 我用来得到这个列表的代码是: @implementation playlistsViewController { NSArray *playlists; MPMediaQuery *playlistsQuery; } – (void)viewDidLoad { self.title = @"Playlists"; playlistsQuery = [MPMediaQuery playlistsQuery]; playlists = [playlistsQuery collections]; } #pragma mark – Table view data source – (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [playlists count]; } – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { …. // Configure the cell… MPMediaItem *rowItem […]

从nsbundle播放mp3

build立 我把一个mp3放到我的软件包中进行testing,我将它们下载到文档目录中。 但是现在我要解决这个问题了。 我find了几个教程,但没有什么我需要的。 下面绝对是一对夫妇的解决scheme的组合,可能不是最好的方法。 问题 我如何从我的包中拉出一首歌曲,并在应用程序内播放? //Create an instance of MPMusicPlayerController MPMusicPlayerController* myPlayer = [MPMusicPlayerController applicationMusicPlayer]; //Read the song off the bundle. NSString *filePath = [[NSBundle mainBundle] pathForResource:@"LittleMoments" ofType:@"mp3"]; NSData *myData = [NSData dataWithContentsOfFile:filePath]; if (myData) { //This wont work for me because i don't want to query songs from the iPod, i want […]

我需要知道如何获得关于哪个播放器正在stream式传输的信息(player,spotify,napster …)

我可以得到当前正在播放的歌曲的信息(艺术家,专辑,标题): let t = MPMusicPlayerController().nowPlayingItem?.title 当从iOS音乐播放器播放音乐时,它工作正常。 但是,当stream媒体来自其他来源(Spotify,Napster,Youtube,Tuneinradio等)时,我无法获取信息。 我怎样才能得到这个信息的任何应用程序?

iOS10.3.x无法在MPMusicPlayer上为Apple音乐曲目设置nowPlayingItem

我有一个发布的应用程序,刚刚开始有麻烦设置MPMusicPlayer for Apple音乐轨道上的nowPlayingItem。 此代码按照设备上iTunes曲目的预期方式工作,但如果媒体项集是Apple音乐曲目,用户的Apple音乐库中的随机曲目(而不是当前播放列表中)最终会播放。 我怀疑iOS10.3.x中的某些内容已经发生了变化,或者苹果电脑公司正在酝酿。 任何人都有我如何解决这个问题的想法? 基本代码是: MPMusicPlayerController *musicPlayer; [musicPlayer stop]; NSLog(@"*** trying to set nowplayingitem to %@", [UIAppDelegate.activeTrack.mediaitem valueForProperty:MPMediaItemPropertyTitle]); musicPlayer.nowPlayingItem = UIAppDelegate.activeTrack.mediaitem ; NSLog(@"nowplaying item is:%@", musicPlayer.nowPlayingItem.title); [musicPlayer play]; if (![musicPlayer.nowPlayingItem.title isEqualToString:UIAppDelegate.activeTrack.name]){ NSLog(@">>>>>>> now playing does not equal current track so return and scratch head"); return; } 2017-04-14 09:43:14.535079-0400 MyFitnessDJ [720:241825] ***试图设置nowplayingitem责怪2017-04-14 09:43:14.761134-0400 MyFitnessDJ […]

如何在音乐播放器中设置音乐播放滑块

我创造了一个音乐播放器与我的app.i前和下一个function,我想impliment歌曲播放滑块。 这个怎么做?

与currentPlaybackTime和MPMusicPlayerController和iOS 7.1的问题。

在iOS 7.1中使用MPMusicPlayerController设置currentPlaybackTime时遇到问题。 我曾经能够简单地做到以下几点: MPMusicPlayerController *iPodController = [MPMusicPlayerController applicationMusicPlayer]; iPodController.currentPlaybackTime = 30.0; [iPodController play]; 音乐播放器将会寻找30秒的时间和播放。 从iOS 7.1开始,情况并非如此。 如果我做到以下几点: [iPodController play]; iPodController.currentPlaybackTime = 30.0; 那么它“可能”会跳30秒。 非常不一致。 这用于所有以前的iOS版本。 只是想知道如果有人有工作。 谢谢!

MPMusicPlayerController是否改变了iOS 5?

我有一个应用程序,在iOS 4.3中正常工作,升级到iOS 5后,它的行为以另一种方式。 在iOS 4.3上执行这些行后,mp.playbackState被设置为MPMusicPlaybackStatePaused,但是在iOS 5中,它仍然被设置为MPMusicPlaybackStatePlaying。 MPMusicPlayerController *mp = [MPMusicPlayerController applicationMusicPlayer]; if(mp.playbackState == MPMusicPlaybackStatePlaying) [mp pause]; 我假设playbackState没有在同一个事件循环内更新,可以吗?

如何录制video并同时播放audio(快速教程)

那么您想要录制video并同时播放用户库中的 音乐吗? 再看一眼。 以下是答案。

locking屏幕iPod控件无法使用Spotify音乐播放器

我将Spotify播放器添加到使用MPMusicPlayerController播放音乐的应用程序中。 当Spotify正在播放音乐并且屏幕被locking时,当用户在locking的屏幕上按下这些button时,远程控制事件不会被播放/暂停以及FFW / RWD接收。 如果从MPMusicPlayerController播放音乐,则可以根据以下代码接收遥控事件: -(void) ViewDidLoad { … [[UIApplication sharedApplication] beginReceivingRemoteControlEvents]; [self becomeFirstResponder]; … } 和 – (BOOL) canBecomeFirstResponder { return YES; } – (void) remoteControlReceivedWithEvent: (UIEvent*) event { // see [event subtype] for details if (event.type == UIEventTypeRemoteControl) { // We may be receiving an event from the lockscreen switch (event.subtype) { case […]

beginReceivingRemoteControlEvents不触发Apple Music的事件

我从我的应用程序播放苹果音乐,苹果音乐播放器的代码是 – -(void) submitAppleMusicTrackWithProductID: (NSString *) productID // productID in US is the last numbers after i= in the share URL from Apple Music { [SKCloudServiceController requestAuthorization:^(SKCloudServiceAuthorizationStatus status) { NSLog(@"status is %ld", (long)status); SKCloudServiceController *cloudServiceController; cloudServiceController = [[SKCloudServiceController alloc] init]; [cloudServiceController requestCapabilitiesWithCompletionHandler:^(SKCloudServiceCapability capabilities, NSError * _Nullable error) { NSLog(@"%lu %@", (unsigned long)capabilities, error); if (capabilities […]