【发布时间】:2017-08-31 07:24:10
【问题描述】:
在我的应用中,我们使用 AVPlayer 播放音频文件。在 iOS 11 Beta 版本中,音频播放正常,但播放器不可见。它只是显示黑色背景。 谁能帮我解决这个问题?
_avpvc = [[AVPlayerViewController alloc] init];
AVPlayerItem *aPlayerItem = [[AVPlayerItem alloc] initWithURL:url];
_avpvc.player = [[AVPlayer alloc] initWithPlayerItem:aPlayerItem];
_avpvc.player = [AVPlayer playerWithURL:url];
[self.view addSubview:self.avpvc.view];
self.avpvc.view.frame = self.audioPlayerView.bounds;
self.avpvc.view.autoresizingMask =
UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
[self.audioPlayerView addSubview:self.avpvc.view];
[self.avpvc didMoveToParentViewController:self];
[_avpvc.player play];
【问题讨论】:
-
请找到以下网址,但代码在除 iOS 11 之外的所有其他版本中都可以正常工作 dpaste.com/3YCSZSS
-
你的网址是什么。
-
你可以在这里添加你的代码
-
你用的网址是什么
-
大家好,感谢您的帮助我修复了它。问题是因为我们必须增加视图的大小,因为 iOS 11 为 AVplayer 设计了新的布局。现在它工作正常
标签: ios objective-c avplayer ios11