avplayerlayer

AVPlayer blank video: playing sound but no video

北城余情 提交于 2019-12-07 22:57:11
问题 This question has the same problem, but the solutions didn't work. The AVPlayer sometimes plays a blank video: there is sound but no video. While blank videos were played, we printed the frame and status of the player. The frame was non-zero and was correctly set. The status was also readyToPlay . The play function is also invoked on the main thread. In other words, the frame for the player layer is valid, and the player is also ready to play. Yet no video appears, even though sound does. The

AVPlayer's video and audio become out of sync after pausing and then resuming video

南笙酒味 提交于 2019-12-07 02:16:52
问题 I'm using AVPlayer to play videos in my app. Video playback always works perfectly, except for when you pause/resume the video. If the user presses the pause button, and then resumes the video, sometimes the audio will be ahead of the video. The video resumes at the correct location, but the audio is ahead. It's as if when you press pause, the audio keeps running. When they press the pause button, all I am doing is calling the pause method of the AVPlayer , and I have also tried setting it's

AVPlayerLayer get Image to UIImageView Buffer

不想你离开。 提交于 2019-12-06 23:57:50
问题 i try to [playerLayer renderInContext:UIGraphicsGetCurrentContext()]; it will display black background. so i get current player item as thump image continuously it is not look like video play just still images continuously flow. so any other option to do? 回答1: Try this Code for setup Reader //setUp Reader AVURLAsset * asset = [AVURLAsset URLAssetWithURL:urlvalue options:nil]; [asset loadValuesAsynchronouslyForKeys:[NSArray arrayWithObject:@"tracks"] completionHandler: ^{ dispatch_async

AVPlayer blank video: playing sound but no video

余生长醉 提交于 2019-12-06 04:27:31
This question has the same problem, but the solutions didn't work. The AVPlayer sometimes plays a blank video: there is sound but no video. While blank videos were played, we printed the frame and status of the player. The frame was non-zero and was correctly set. The status was also readyToPlay . The play function is also invoked on the main thread. In other words, the frame for the player layer is valid, and the player is also ready to play. Yet no video appears, even though sound does. The issue seems to be a timing one. If we wait 5-10 seconds before playing the video, the video works fine

Saving video with overlay of GIF image

 ̄綄美尐妖づ 提交于 2019-12-05 15:10:38
I am working on an application in which I record a video. When recording finished I put a GIF image on it with use of Library . My code for playing video and putting gif image as an overlay self.avPlayer = [AVPlayer playerWithURL:self.urlstring]; self.avPlayer.actionAtItemEnd = AVPlayerActionAtItemEndNone; AVPlayerLayer *videoLayer = [AVPlayerLayer playerLayerWithPlayer:self.avPlayer]; videoLayer.frame = self.preview_view.bounds; videoLayer.videoGravity = AVLayerVideoGravityResizeAspectFill; [self.preview_view.layer addSublayer:videoLayer]; NSURL *url = [[NSBundle mainBundle] URLForResource:@

iOS AVPlayer slow down

蓝咒 提交于 2019-12-05 08:07:12
问题 I am using AVPlayer to play online video in my project. The Video is playing well. Now I want to reduce /increase the fps of the video . Below is my code that I am using: self.asset = [AVAsset assetWithURL:self.videoUrl]; // the video player self.player = [AVPlayer playerWithURL:self.videoUrl]; self.player.actionAtItemEnd = AVPlayerActionAtItemEndNone; self.playerLayer = [AVPlayerLayer playerLayerWithPlayer:self.player]; self.playerLayer.videoGravity = AVLayerVideoGravityResizeAspectFill; [

AVPlayer's video and audio become out of sync after pausing and then resuming video

北城余情 提交于 2019-12-05 07:46:56
I'm using AVPlayer to play videos in my app. Video playback always works perfectly, except for when you pause/resume the video. If the user presses the pause button, and then resumes the video, sometimes the audio will be ahead of the video. The video resumes at the correct location, but the audio is ahead. It's as if when you press pause, the audio keeps running. When they press the pause button, all I am doing is calling the pause method of the AVPlayer , and I have also tried setting it's rate property to 0.0 which is supposed to be the exact same thing according to the documentation. I

AVPlayerLayer get Image to UIImageView Buffer

强颜欢笑 提交于 2019-12-05 03:53:30
i try to [playerLayer renderInContext:UIGraphicsGetCurrentContext()]; it will display black background. so i get current player item as thump image continuously it is not look like video play just still images continuously flow. so any other option to do? Try this Code for setup Reader //setUp Reader AVURLAsset * asset = [AVURLAsset URLAssetWithURL:urlvalue options:nil]; [asset loadValuesAsynchronouslyForKeys:[NSArray arrayWithObject:@"tracks"] completionHandler: ^{ dispatch_async(dispatch_get_main_queue(), ^{ AVAssetTrack * videoTrack = nil; NSArray * tracks = [asset tracksWithMediaType

How to get video frame of the AVPlayer?

微笑、不失礼 提交于 2019-12-04 19:26:51
问题 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

AVPlayerLayer shows black screen but sound is working

混江龙づ霸主 提交于 2019-12-04 04:41:34
问题 Im trying to display a local recorded video in a AVPlayerLayer which works sometimes . I can hear the audio from the recorded video but can't see the video. Sometimes both video and audio is working, sometimes only audio. I've tried both with a AVPlayerLayer and AVPlayerViewController but the same issue occurs in both cases. So it's not because of the frames being wrong. Example code AVPlayerViewController : let player = AVPlayer(url: url) let playerController = AVPlayerViewController()