avplayerlayer

AVPlayerLayer isn't showing AVPlayer video?

ⅰ亾dé卋堺 提交于 2021-02-08 14:53:08
问题 What's the trick to getting AVPlayer video content to show up in one's view? We are using the following AVPlayer code but nothing is appearing on screen. We know the video is there because we were able to show it using an MPMoviePlayerController. Here is the code we are using: AVAsset *asset = [AVAsset assetWithURL:videoTempURL]; AVPlayerItem *item = [[AVPlayerItem alloc] initWithAsset:asset]; AVPlayer *player = [[AVPlayer alloc] initWithPlayerItem:item]; player.actionAtItemEnd =

Change AVPlayer Orientation- Swift

不羁岁月 提交于 2021-01-28 07:29:54
问题 I have looked at multiple ways to change the orientation (rotate 90degrees) of an AVPlayer/AVPlayerLayer. The most common way I found was to do this: playerLayer.setAffineTransform(CGAffineTransform(rotationAngle: CGFloat.pi / 2)) This what it looks like when I do that (on aspectfill): As you can see, this doesn't work for me and I think it's because of the changes in xcode and swift over the years. How would you rotate the AVPlayerlayer 90degrees now? Thanks in advance! Code used for

Rotate video 90 degrees in AVPlayerViewController - possible?

落爺英雄遲暮 提交于 2021-01-27 20:58:24
问题 I cannot figure out how to rotate the video 90 degrees in AVPlayerViewController , anyone have any ideas as to how to do this? I'm unsure how to access the AVPlayerLayer as you normally would. 回答1: Try with this code, using AffineTransform we rotate the view but we need also adjust the frame EDITED UIView.animate(withDuration: 0.5) { self.avPlayerViewController?.view.transform = CGAffineTransform(rotationAngle: CGFloat((90 * Double.pi)/180)) self.avPlayerViewController?.view.frame = CGRect(x:

Video playback issues only on iOS 13 with AVPlayerViewController and AVPlayer when using HLS video

删除回忆录丶 提交于 2020-05-25 17:01:32
问题 I have an app that plays back videos. It's compatible with iOS 11, 12 and iOS 13. On iOS 11 and 12, video playback works properly as expected using either AVPlayerViewController or even just AVPlayerLayer . However, on iOS 13 I started getting reports that suddenly video wasn't loading (or would only load audio, or only the first frame) for quite a few users when they updated iOS. I had a really hard time replicating it, but some mentioned it occurred mostly with poor network connections, and

Video playback issues only on iOS 13 with AVPlayerViewController and AVPlayer when using HLS video

痞子三分冷 提交于 2020-05-25 16:57:18
问题 I have an app that plays back videos. It's compatible with iOS 11, 12 and iOS 13. On iOS 11 and 12, video playback works properly as expected using either AVPlayerViewController or even just AVPlayerLayer . However, on iOS 13 I started getting reports that suddenly video wasn't loading (or would only load audio, or only the first frame) for quite a few users when they updated iOS. I had a really hard time replicating it, but some mentioned it occurred mostly with poor network connections, and

AVPlayerLayer not playing video but the audio is good

核能气质少年 提交于 2020-01-16 10:13:04
问题 I have somewhat of a confusing problem. I declared these variables in my class: var audioPlayer = AVPlayer() var videoPlayer = AVPlayer() var videoLayer = AVPlayerLayer() I have these codes for adding the container of the videoPlayer: let aspectHeight = view.frame.width * 9/16 let viewFrame = CGRect(x: 5, y: 0, width: view.frame.width - 10, height: aspectHeight) let layerFrame = CGRect(x: 0, y: 0, width: view.frame.width - 10, height: aspectHeight) videoPlayerContainerView.frame = viewFrame

AVPlayerLayer not playing video but the audio is good

大憨熊 提交于 2020-01-16 10:11:39
问题 I have somewhat of a confusing problem. I declared these variables in my class: var audioPlayer = AVPlayer() var videoPlayer = AVPlayer() var videoLayer = AVPlayerLayer() I have these codes for adding the container of the videoPlayer: let aspectHeight = view.frame.width * 9/16 let viewFrame = CGRect(x: 5, y: 0, width: view.frame.width - 10, height: aspectHeight) let layerFrame = CGRect(x: 0, y: 0, width: view.frame.width - 10, height: aspectHeight) videoPlayerContainerView.frame = viewFrame

AVPlayer fails with AVPlayerItemStatusFailed (OSStatus error -12983)

ぃ、小莉子 提交于 2020-01-01 08:43:13
问题 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

AVPlayer fails with AVPlayerItemStatusFailed (OSStatus error -12983)

随声附和 提交于 2020-01-01 08:40:06
问题 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

iOS: taking screenshot presenting video ipad

北慕城南 提交于 2019-12-25 06:47:25
问题 I'm trying to take screenshot playing video but the screenshot always is showing blank. This is my code: UIGraphicsBeginImageContext(self.view.bounds.size); [self.view.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); NSData *data = UIImageJPEGRepresentation(viewImage, 1.0); NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsPath