AVP 播放器状态?
因此,我无法阅读如何使用 AVPlayerStatus
属性,
我已将 @property(nonatomic, readonly) AVPlayerStatus *status;
正如文档告诉我的那样,但是似乎无法找出我如何使用
AVPlayerStatusUnknows
..
我想在类似的事情中使用它,
while(AVPlayerStatusUnknows)
{
//DO SOMETHING
}
有人可以在这里帮助我吗?
谢谢
So I'm having trouble reading how I should use the AVPlayerStatus
property
I have made the @property(nonatomic, readonly) AVPlayerStatus *status;
as the documentation tells me, but cant seem to find out how i use the
AVPlayerStatusUnknows
..
I wanna use it in something like this
while(AVPlayerStatusUnknows)
{
//DO SOMETHING
}
can anyone help me here ?
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
@Patrick您不能使用
AVPlayerStatus
对象,因为它不是类或结构(或联合)。它是一个枚举器。我们用它来检查 switch 中的条件(如果我们正在创建它)。上述@Amorya建议的方法是如何使用AVPlayerStatus
。希望这对您有意义。
检查文档。
http://developer.apple.com/ library/ios/#documentation/AVFoundation/Reference/AVPlayer_Class/Reference/Reference.html
编辑:
您正在寻找的是这样的东西。我认为这不会起作用,或者可能会起作用。但你会得到基本的想法。
或者,如果您只是使用 GCD 调用自定义队列中的最后 2 行,它会显示您正在寻找的内容。
像这样的东西,(不确定这是否是确切的语法)
@Patrick you cannot use the
AVPlayerStatus
objects because its not a class or a structure (or Union). Its an enumerator. we use it for checking a condition where in switch mostly (if we are creating it). The above method suggested by @Amorya is how to useAVPlayerStatus
.Hope this is making sense to you.
Check the documentation.
http://developer.apple.com/library/ios/#documentation/AVFoundation/Reference/AVPlayer_Class/Reference/Reference.html
Edit:
what you are looking for is something like this. I don't think that this will work or it might. but you will get the basic idea.
or if you just call the last 2 lines in a custom queue using GCD it will show you what you are looking for.
something like this, (not sure if this the exact syntax )
您不需要自己创建该属性:它是 AVPlayer 对象上的属性。
您应该能够执行
while (yourAVPlayer.status == AVPlayerStatusUnknown) {}
操作。将yourAVPlayer
替换为 AVPlayer 类的对象。You don't need to make that property yourself: it's a property on an AVPlayer object.
You should be able to do
while (yourAVPlayer.status == AVPlayerStatusUnknown) {}
. SubstituteyourAVPlayer
with an object of class AVPlayer.