avplayerlayer

AVPlayer fails with AVPlayerItemStatusFailed (OSStatus error -12983)

时光总嘲笑我的痴心妄想 提交于 2019-12-04 02:18:20
Sometimes AVPlayer fails with AVPlayerItemStatusFailed and after that failure occurred, AVPlayer continues to failed with AVPlayerItemStatusFailed . I tried to clear the AVPlayer instance and create new one, but I cannot achieve AVPlayerItemStatusFailed failure to solve. Also removingFromSuperview UIView with AVPlayer instance and initializing new item with AVPlayer does not solve the problem. So I figured that out AVPlayer couldn't been cleared completely. Is there anybody suggest anything to try for clearing the AVPlayer completely and make it works after failure? Error log: Error Domain

Disable Audio (and interruption) with MPMoviePlayerController using Swift

久未见 提交于 2019-12-03 14:52:52
问题 At the moment, this is how I'm playing a video on the subview of my UIViewController: override func viewDidAppear(animated: Bool) { let filePath = NSBundle.mainBundle().pathForResource("musicvideo", ofType: "mp4") self.moviePlayerController.contentURL = NSURL.fileURLWithPath(filePath) self.moviePlayerController.play() self.moviePlayerController.repeatMode = .One self.moviePlayerController.view.frame = self.view.bounds self.moviePlayerController.scalingMode = .AspectFill self

How to get video frame of the AVPlayer?

落花浮王杯 提交于 2019-12-03 12:35:32
I have PlayerView class for displaying AVPlayer's playback. Code from documentation . #import <UIKit/UIKit.h> #import <AVFoundation/AVFoundation.h> @interface PlayerView : UIView @property (nonatomic) AVPlayer *player; @end @implementation PlayerView + (Class)layerClass { return [AVPlayerLayer class]; } - (AVPlayer*)player { return [(AVPlayerLayer *)[self layer] player]; } - (void)setPlayer:(AVPlayer *)player { [(AVPlayerLayer *)[self layer] setPlayer:player]; } @end I set up my AVPlayer (contains video asset with size 320x240) in this PlayerView (with frame.size.width = 100, frame.size.height

Disable Audio (and interruption) with MPMoviePlayerController using Swift

拥有回忆 提交于 2019-12-03 03:45:06
At the moment, this is how I'm playing a video on the subview of my UIViewController: override func viewDidAppear(animated: Bool) { let filePath = NSBundle.mainBundle().pathForResource("musicvideo", ofType: "mp4") self.moviePlayerController.contentURL = NSURL.fileURLWithPath(filePath) self.moviePlayerController.play() self.moviePlayerController.repeatMode = .One self.moviePlayerController.view.frame = self.view.bounds self.moviePlayerController.scalingMode = .AspectFill self.moviePlayerController.controlStyle = .None self.moviePlayerController.allowsAirPlay = false self.view.addSubview(self

Play video in the collection view cell like the videos playing in the Facebook app Timeline

寵の児 提交于 2019-12-02 02:22:29
问题 I want to play video in the collection view cell,the requirement is like the instagram timeline and playing video is like playing videos in the facebook time line, for this I used UICollectionViewCell in witch I have some images no videos now I am images from gallery,I am taking the image using camera and I am recording the video,every time I will have any one out from the above and the out put i have add to the time line. For example, we take 3vc 1st vc is having collection view with some

AVPlayer Video Blank but Hear Sound

感情迁移 提交于 2019-12-01 15:06:12
I'm switching from MPMoviePlayerController to AVPlayer as I need finer grained control over video swapping. The .mov file I was playing with MPMoviePlayerController played fine, but after switching to AVPlayer I hear the audio from the video, but the video just shows the view background that I added the AVPlayerLayer to. Here's how I'm initializing the AVPlayer . self.player = [[AVPlayer alloc] initWithURL:video]; AVPlayerLayer* playerLayer = [AVPlayerLayer playerLayerWithPlayer:self.player]; playerLayer.frame = self.playerContainer.bounds; [self.playerContainer.layer addSublayer:playerLayer];

AVPlayer Video Blank but Hear Sound

旧城冷巷雨未停 提交于 2019-12-01 13:58:51
问题 I'm switching from MPMoviePlayerController to AVPlayer as I need finer grained control over video swapping. The .mov file I was playing with MPMoviePlayerController played fine, but after switching to AVPlayer I hear the audio from the video, but the video just shows the view background that I added the AVPlayerLayer to. Here's how I'm initializing the AVPlayer . self.player = [[AVPlayer alloc] initWithURL:video]; AVPlayerLayer* playerLayer = [AVPlayerLayer playerLayerWithPlayer:self.player];

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

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