avplayeritem

AVPlayer stalling on large video files using resource loader delegate

青春壹個敷衍的年華 提交于 2019-12-17 17:46:07
问题 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.

An AVPlayerItem can occupy only one position in a player's queue at a time?

旧城冷巷雨未停 提交于 2019-12-13 08:29:36
问题 I have seen many questions on this and none have had a solution. I am getting: An AVPlayerItem can occupy only one position in a player's queue at a time In the console after quickly taping a view button which should have one of two states: Successfully preloaded video only a videoURL which will then be loaded in another VC. Why is this happening and how can I fix it? This is my code which handels this in the transitioned to VC: if numberMedia == 0 { if selectedPost!.interimMedia[numberMedia]

AVPlayerViewController play/pause issue in iOS

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-13 07:37:44
问题 I am working on the iOS application. This application base on the NEWS media. I am playing the small video of highlighted News. I am facing a stranger problem with AVPlayerViewController . When i play the video everything is fine. When i go to offline the buffer video play perfect & after the play buffer video, the video stops but the progress bar(Slider) continuously in play state while the video has been stopped. For more clearance please watch this GIF image : Please visit this link for

forwardPlaybackEndTime does not work

痞子三分冷 提交于 2019-12-13 04:51:04
问题 AVPlayerItem has this property forwardPlaybackEndTime The value indicated the time at which playback should end when the playback rate is positive (see AVPlayer’s rate property). The default value is kCMTimeInvalid, which indicates that no end time for forward playback is specified. In this case, the effective end time for forward playback is the item’s duration. But I don't know why it does not work. I tried to set it in AVPlayerItemStatusReadyToPlay , duration available callback, ... but it

“CIImage initWithCVPixelBuffer:options:” failed because its pixel format p422 is not supported in iOS 10

喜欢而已 提交于 2019-12-12 13:15:42
问题 In ios10 , I want to get video capture, but get an error "[CIImage initWithCVPixelBuffer:options:] failed because its pixel format p422 is not supported." My code is this: func previewImage(handle: (image: UIImage?) -> Void) { dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), { () -> Void in dispatch_async(dispatch_get_main_queue(), { () -> Void in guard let time = self.player?.currentTime() else { return } guard let pixelBuffer = self.output?

addPeriodicTimeObserver is not called every millisecond?

半城伤御伤魂 提交于 2019-12-11 15:49:05
问题 I know that player.currentItem.currentTime().seconds returns the current time in seconds of the audio file that is being played. Can I add a callback function on player to be called every millisecond? For example for second 1, this callBack function should be called 1000 times. The problem is that using addPeriodicTimeObserver the callBack function is called only 1 time per second, rather than 1000 times per second. Why do I need this? 1. I am extracting the beat count of a Salsa song

Why does observer for status change of AVAsset not work?

馋奶兔 提交于 2019-12-11 07:37:11
问题 I implemented the following code from Apple. It is meant to observe for a change in the status of a playerItem. The problem is that for some reason it does not work. The observe function does not run when ready. All relevant code is below: func preloadVideo(media: Media) { //setup code, and then: media.playerItem1!.addObserver(self, forKeyPath: #keyPath(AVPlayerItem.status), options: [.old, .new], context: &playerItemContext) } Observe method: private var playerItemContext = 0 override func

iOS: bug in AVPlayerItem when receiving `304 Not Modified` response

只谈情不闲聊 提交于 2019-12-10 21:50:47
问题 This is a very weird bug. I have a tableView with each cell using an AVPlayer to stream a video from a remote server (think a Vine-like timeline). So when I scroll, the cells that get reused reconfigure their player with the new video. The problem is: if I scroll back and forth very fast, getting the same video in and out of the screen, the request sent by the AVPlayer eventually changes, to include the HTTP Headers If-None-Match and If-Modified-Since , which are not there the rest of the

AVPlayerItemDidPlayToEndTimeNotification only works if forced

♀尐吖头ヾ 提交于 2019-12-10 11:56:20
问题 I been searching everywhere and I still can't find a solution to this problem. I have a AVQueuePlayer for a radio app that I am making. It has about 20 AVPlayerItems queued at a time. I added the AVPlayerItemDidPlayToEndTimeNotification observer to each one of those items. The notification gets fired and executes the code to remove key observers for metadata and status so it doesn't crash and advances to next item in the queue. However it doesn't want to play. There is no error, the status is

AVPlayer Not Loading Media In Background

早过忘川 提交于 2019-12-07 23:45:06
问题 When running in the background, my implementation of the AVPlayer is unable to play audio (e.g. podcast) that is downloaded, but is able to play songs that are stored locally. Failure to play in the background is only when the phone is disconnected from my computer. If my phone is direct connected to my computer/debugger, any media that is local or is downloaded plays without a problem. In the foreground, there is also no problem playing either media type. Here is my implementation: AVPlayer