avplayeritem

'An AVPlayerItem cannot be associated with more than one instance of AVPlayer'

守給你的承諾、 提交于 2019-12-02 05:12:02
问题 I know this question is all over Stack Overflow but still, most of them are old and not related with what I'm going to ask here. So I've got an array with AVPlayerItems and an AVQueuePlayer . At first I set the AVQueuePlayer to play the array items: func mediaPicker(mediaPicker: MPMediaPickerController!, didPickMediaItems mediaItemCollection: MPMediaItemCollection!) { mediaItems = mediaItemCollection.items for thisItem in mediaItems as [MPMediaItem] { var itemUrl = thisItem.valueForProperty

Add and remove observer from multiple AVPlayerItem on UITableViewCell

十年热恋 提交于 2019-12-01 12:02:34
问题 i am trying to make a table view that plays multiple videos with AVPlayer and AVPlayerItem and i needed to addObserver to each AVPlayerItem so i can keep track of playbackLikelyToKeepUp property what i tried and failed is adding the observer after setting the AVPlayerItem and removing it in the deinit of the UITableViewCell but since the cells never gets deallocated but gets dequeued so this won't work and i will get this error An instance 0x14eedebc0 of class AVPlayerItem was deallocated

Add and remove observer from multiple AVPlayerItem on UITableViewCell

本小妞迷上赌 提交于 2019-12-01 11:39:52
i am trying to make a table view that plays multiple videos with AVPlayer and AVPlayerItem and i needed to addObserver to each AVPlayerItem so i can keep track of playbackLikelyToKeepUp property what i tried and failed is adding the observer after setting the AVPlayerItem and removing it in the deinit of the UITableViewCell but since the cells never gets deallocated but gets dequeued so this won't work and i will get this error An instance 0x14eedebc0 of class AVPlayerItem was deallocated while key value observers were still registered with it. After searching I came up with this I should not

AVPlayer Stops Playing AES encrypted offline HLS Video in online mode

断了今生、忘了曾经 提交于 2019-12-01 11:29:19
问题 I have written a code to download HLS video and play it in offline mode. This code works fine for encoded video. Now I have a video which is AES encrypted and we are having custom encryption key for it. After downloading AES encrypted HLS video I am using below given code to supply key for decryption of video. - (BOOL)resourceLoader:(AVAssetResourceLoader *)resourceLoader shouldWaitForLoadingOfRequestedResource:(AVAssetResourceLoadingRequest *)loadingRequest { NSString *scheme =

AVPlayer does not fire playbackBufferEmpty but does not play either

前提是你 提交于 2019-12-01 04:26:10
I use AVPlayer to play an audio livestream via internet. I like to recover playback if it was paused for longer than 1 minute. I call player.rate = 1.0 to resume. However if the stream was paused for >1 minute it does not play any more. I need to recreate AVPlayerItem in this case to make it work again. So how can I catch this case, so I know the playback did not recover? I tried KVO on player.rate . It stays at 1.0 though. The player is not playing! I tried KVO on currentItem.playbackBufferEmpty . It is not called in this case though. currentItem.status does not switch to .Failed . It does

AVPlayer does not fire playbackBufferEmpty but does not play either

此生再无相见时 提交于 2019-12-01 01:22:30
问题 I use AVPlayer to play an audio livestream via internet. I like to recover playback if it was paused for longer than 1 minute. I call player.rate = 1.0 to resume. However if the stream was paused for >1 minute it does not play any more. I need to recreate AVPlayerItem in this case to make it work again. So how can I catch this case, so I know the playback did not recover? I tried KVO on player.rate . It stays at 1.0 though. The player is not playing! I tried KVO on currentItem

AVPlayerItemStatusFailed error when too many AVPlayer instances created

我是研究僧i 提交于 2019-11-30 22:36:53
I'm working on an iOS app which creates a feed of all the videos submitted by the pool of users, enabling users to browse and view the videos that others have created. As you can imagine, I need to be able to support an arbitrary number of videos in the feed. Currently, I am creating and retaining an AVPlayer instance for each video like so: //inside the init method of a UIView //create the AVPlayer and store it in a strong property NSString * urlString = @"aRemoteURL.mov"; NSURL * movURL = [NSURL URLWithString:urlString]; _videoPlayer = [[AVPlayer alloc]initWithURL:movURL]; //register

AVPlayerItemStatusFailed error when too many AVPlayer instances created

霸气de小男生 提交于 2019-11-30 17:07:02
问题 I'm working on an iOS app which creates a feed of all the videos submitted by the pool of users, enabling users to browse and view the videos that others have created. As you can imagine, I need to be able to support an arbitrary number of videos in the feed. Currently, I am creating and retaining an AVPlayer instance for each video like so: //inside the init method of a UIView //create the AVPlayer and store it in a strong property NSString * urlString = @"aRemoteURL.mov"; NSURL * movURL =

Better way to do skip to previous with AVQueuePlayer?

不羁岁月 提交于 2019-11-30 04:58:01
I am using an AVQueuePlayer in my app. I have a two swipe gestures to skip to next and skip to previous avplayeritems. Right now to do skip to next I am just calling advanceToNextItem on the avqueueplayer which works well. However the skip to previous I am removing all items and adding them back in with the previous video up front, this is really slow when skipping to previous multiple times. How can I make this faster just like calling advanceToNextItem ? My code looks like this: func skipToPrevious() { queuePlayer.removeAllItems() // move the previous playerItem to the front of the list then

AVPlayer stalling on large video files using resource loader delegate

血红的双手。 提交于 2019-11-28 05:04:58
I am using this approach to save the buffer data of the AVPlayer for video files. Found as the answer in this question Saving buffer data of AVPlayer . iPhone and iPad - iOS 8.1.3 I made the necessary changes to play video and it is working very nicely except when I try to play a very long video (11-12 minutes long and about 85mb in size) the video will stall roughly 4 minutes after the connection finishes loading. I get an event for playbackBufferEmpty and a player item stalled notification. This is the gist of the code viewController.m @property (nonatomic, strong) NSMutableData *videoData;