简体   繁体   English

AVPlayer无法在iPhone 5s 64bit iOS 7.0.3上运行

[英]AVPlayer not working on iPhone 5s 64bit iOS 7.0.3

I'm trying to figure out an issue that only appears on the iPhone5s having to do with an AVPlayer playing a video. 我试图找出一个仅在iPhone5上出现的与AVPlayer播放视频有关的问题。 The issue is that a movie will play on all devices I have tested so far except for the 5s 64bit model. 问题是,影片将在到目前为止我测试过的所有设备上播放,除了5s 64位型号。

My theory is that it is tied to being 64bit but I haven't been able to tie it to anything. 我的理论是,它与64位绑定,但我无法将其绑定到任何东西。 I found another stackoverflow post relating a similar issue with the fix being tied to using autolayout. 我发现了另一个stackoverflow帖子,该帖子将类似的问题与使用自动布局的解决方法相关联。 However, I am not using autolayout. 但是,我没有使用自动布局。

This code has been working great until the 5s: 直到5s为止,这段代码一直有效:

-(void)viewWillAppear:(BOOL)animated
{
    self.player = [[AVPlayer alloc] initWithURL:[NSURL URLWithString:@"http://www.somemovieurlhere.mp4"]];
    AVPlayerLayer *playerLayer = [AVPlayerLayer playerLayerWithPlayer:self.player];
    playerLayer.frame = self.view.bounds;
    playerLayer.backgroundColor = [UIColor orangeColor].CGColor;
    [self.view.layer addSublayer:playerLayer];

    [self.player play];
}

I know the layer is added, because if you set the background color it shows up in the view, but no movie ever plays. 我知道该图层已添加,因为如果您设置背景色,它将在视图中显示,但从未播放过电影。 In my project I can tell the movie is playing by logging out the "currentTime" property like so: 在我的项目中,可以通过注销“ currentTime”属性来告知电影正在播放,如下所示:

float time = CMTimeGetSeconds([player currentTime]);

Here is an image of the movie from an iphone4s and what I see in an iphone5s. 这是来自iphone4s的电影图像以及我在iphone5s中看到的图像。 I have also tested this with an original iphone5 and it works fine. 我也用原始的iphone5进行了测试,效果很好。

iphone4s iPhone 5S

Any ideas as to what might be causing this? 关于什么可能导致此的任何想法? Thanks in advance for any help. 在此先感谢您的帮助。

It looks like Apple's latest update 7.0.4 fixed this issue. 看来苹果最新的更新7.0.4解决了这个问题。 Their update just came out today. 他们的更新今天才发布。

Thanks! 谢谢!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM