Ios AVSynchronizedLayer动画适用于本地文件,但不适用于流媒体
我有一个使用AVSynchronizedLayer的本地视频文件的动画。现在,当我用流链接(相同文件的)替换本地文件时,动画完全停止工作。我不知道是什么原因导致了这一点,已经尝试了多次,它在本地文件上完全可以正常工作,但在流媒体时不行。有什么想法吗 编辑: 在这里,我将AVSynchronized层添加到播放动画的自定义视图中。动画的代码是:Ios AVSynchronizedLayer动画适用于本地文件,但不适用于流媒体,ios,video-streaming,avplayer,avplayerlayer,Ios,Video Streaming,Avplayer,Avplayerlayer,我有一个使用AVSynchronizedLayer的本地视频文件的动画。现在,当我用流链接(相同文件的)替换本地文件时,动画完全停止工作。我不知道是什么原因导致了这一点,已经尝试了多次,它在本地文件上完全可以正常工作,但在流媒体时不行。有什么想法吗 编辑: 在这里,我将AVSynchronized层添加到播放动画的自定义视图中。动画的代码是: CAKeyframeAnimation *anim = [CAKeyframeAnimation animationWithKeyPath:@"trans
CAKeyframeAnimation *anim = [CAKeyframeAnimation animationWithKeyPath:@"transform"];
anim.beginTime = AVCoreAnimationBeginTimeAtZero;
anim.duration = self.videoDuration;
anim.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
anim.removedOnCompletion = NO;
anim.fillMode = kCAFillModeForwards;
anim.values = [self.transforms objectAtIndex:adNumber];
UIImageView* imageView = [self.adViews objectAtIndex:adNumber];
[imageView.layer addAnimation:anim forKey:@"transformAnimation"];
imageView.hidden = NO;
检查self.videoDuration值,我在播放视频时遇到了相同的问题-持续时间始终为0。希望这能有所帮助。问题出在创建图层时。一旦我解决了这个问题(即在视频播放器准备好播放后创建层/动画),事情就开始按预期工作。请向我们展示您的代码。已添加。如果需要更多的细节,一定要告诉我。为了得到一些赏金,没有必要发表评论。。不被欣赏。
CAKeyframeAnimation *anim = [CAKeyframeAnimation animationWithKeyPath:@"transform"];
anim.beginTime = AVCoreAnimationBeginTimeAtZero;
anim.duration = self.videoDuration;
anim.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
anim.removedOnCompletion = NO;
anim.fillMode = kCAFillModeForwards;
anim.values = [self.transforms objectAtIndex:adNumber];
UIImageView* imageView = [self.adViews objectAtIndex:adNumber];
[imageView.layer addAnimation:anim forKey:@"transformAnimation"];
imageView.hidden = NO;