avplayer

Why aren't my videos showing in cells in my scroll view with AVPlayer

↘锁芯ラ 提交于 2020-01-16 08:27:13
问题 I know my code isn't efficient as of yet, I just want it to work really before I optimise it. Basically I have a function FeaturedPostsManager.shared.getFeaturedPosts to get videos from my server and store it in the app's cache and store the local url to the video. Which in my code I do it twice for two different videos, so I have two urls that go to two different videos. I then add them urls in my custom data array for my scroll view to unwrap for each cell and add it's respective video to

AVPlayerViewController not loading remote URL

£可爱£侵袭症+ 提交于 2020-01-16 05:18:08
问题 I'm trying to play a remote MP4 video in an AVPlayerViewController : self.vcVideo = [[AVPlayerViewController alloc] init]; self.vcVideo.player = [AVPlayer playerWithURL:[NSURL URLWithString:videoURL]]; [self presentViewController:self.vcVideo animated:YES completion:^{ [self.vcVideo.player play]; }]; The view controller is presented but the play button is disabled: This is on iOS 9. 回答1: In iOS9 security policy is changed. In your log you should see something about the security. I believe

AVPlayerItemDidPlayToEndTimeNotification not called

亡梦爱人 提交于 2020-01-15 12:57:50
问题 I have a video on a screen that must be played with an infinity loop. So I wrote : self.player = [AVPlayer playerWithPlayerItem:avItem]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playerItemDidReachEnd:) name:AVPlayerItemDidPlayToEndTimeNotification object:[_player currentItem]]; [_player play]; And I fallback method is : - (void)playerItemDidReachEnd:(NSNotification *)notification { [_player.currentItem seekToTime:kCMTimeZero]; [_player play]; } It works well

AVPlayerItemDidPlayToEndTimeNotification not called

时光毁灭记忆、已成空白 提交于 2020-01-15 12:56:30
问题 I have a video on a screen that must be played with an infinity loop. So I wrote : self.player = [AVPlayer playerWithPlayerItem:avItem]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playerItemDidReachEnd:) name:AVPlayerItemDidPlayToEndTimeNotification object:[_player currentItem]]; [_player play]; And I fallback method is : - (void)playerItemDidReachEnd:(NSNotification *)notification { [_player.currentItem seekToTime:kCMTimeZero]; [_player play]; } It works well

AVPlayer not going to the next song when it is in background mode

爷,独闯天下 提交于 2020-01-15 11:24:29
问题 I am useing AVPlayer to play setof songs from urls. I can play songs in background mode too. But the problem is in background mode the next song is not playing. It excecute the code and but [player play]; method is not working. But If play 1 song it plays to the end though it goes to the background mode. Please help me Thanks 回答1: You should use AVQueuePlayer instead. This is working fine for me. 回答2: Well, you probably have this figured out by now, but for anyone else who might come across

AVPlayer not going to the next song when it is in background mode

蹲街弑〆低调 提交于 2020-01-15 11:22:42
问题 I am useing AVPlayer to play setof songs from urls. I can play songs in background mode too. But the problem is in background mode the next song is not playing. It excecute the code and but [player play]; method is not working. But If play 1 song it plays to the end though it goes to the background mode. Please help me Thanks 回答1: You should use AVQueuePlayer instead. This is working fine for me. 回答2: Well, you probably have this figured out by now, but for anyone else who might come across

AVPlayer not going to the next song when it is in background mode

天大地大妈咪最大 提交于 2020-01-15 11:22:06
问题 I am useing AVPlayer to play setof songs from urls. I can play songs in background mode too. But the problem is in background mode the next song is not playing. It excecute the code and but [player play]; method is not working. But If play 1 song it plays to the end though it goes to the background mode. Please help me Thanks 回答1: You should use AVQueuePlayer instead. This is working fine for me. 回答2: Well, you probably have this figured out by now, but for anyone else who might come across

Is it possible to change the background color of AVPlayer? If yes, how?

狂风中的少年 提交于 2020-01-15 05:13:25
问题 I wish to change the default background color from black to a color that i desire. Possibly to a color which contrasts the video (which is black most of the time). I have added this piece of code in my viewWillAppear() function: let playerLayer = AVPlayerLayer(player: player) playerLayer.backgroundColor = UIColor.blueColor().CGColor 回答1: The black color of the background is the backgroundColor of the AVPlayerView ‐ Controller’s view, which you are free to change. For example: let av =

Alternate audio tracks with HTTP Live Streaming

半世苍凉 提交于 2020-01-14 17:14:46
问题 I'm generating a list of available audio tracks when an HLS stream is ready to play. I can access the available audio tracks just fine, but I'm having difficulty extracting the correct 'Title' for each track. I'm using Apple's test stream which has two audio tracks. I extract the tracks with this... availableAudioTrackList = [[NSMutableArray alloc] init]; AVMediaSelectionGroup *audioTracks = [player.currentItem.asset mediaSelectionGroupForMediaCharacteristic:AVMediaCharacteristicAudible]; for

Alternate audio tracks with HTTP Live Streaming

雨燕双飞 提交于 2020-01-14 17:11:09
问题 I'm generating a list of available audio tracks when an HLS stream is ready to play. I can access the available audio tracks just fine, but I'm having difficulty extracting the correct 'Title' for each track. I'm using Apple's test stream which has two audio tracks. I extract the tracks with this... availableAudioTrackList = [[NSMutableArray alloc] init]; AVMediaSelectionGroup *audioTracks = [player.currentItem.asset mediaSelectionGroupForMediaCharacteristic:AVMediaCharacteristicAudible]; for