AVP 播放器状态?

发布于 2024-10-26 05:15:10 字数 338 浏览 3 评论 0原文

因此,我无法阅读如何使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

め七分饶幸 2024-11-02 05:15:10

@Patrick您不能使用 AVPlayerStatus 对象,因为它不是类或结构(或联合)。它是一个枚举器。我们用它来检查 switch 中的条件(如果我们正在创建它)。上述@Amorya建议的方法是如何使用AVPlayerStatus

希望这对您有意义。

检查文档。

http://developer.apple.com/ library/ios/#documentation/AVFoundation/Reference/AVPlayer_Class/Reference/Reference.html

编辑:

您正在寻找的是这样的东西。我认为这不会起作用,或者可能会起作用。但你会得到基本的想法。

[yourActivityIndicator startAnimation];
while(yourAVPlayer.status == AVPlayerStatusUnknown) {}
[yourActivityIndicator stopAnimation];

或者,如果您只是使用 GCD 调用自定义队列中的最后 2 行,它会显示您正在寻找的内容。

像这样的东西,(不确定这是否是确切的语法)

[yourActivityIndicator startAnimation];

dispatch_queue(^{
       while(yourAVPlayer.status == AVPlayerStatusUnknown) {}
       [yourActivityIndicator stopAnimation];
 });

@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 use AVPlayerStatus.

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.

[yourActivityIndicator startAnimation];
while(yourAVPlayer.status == AVPlayerStatusUnknown) {}
[yourActivityIndicator stopAnimation];

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 )

[yourActivityIndicator startAnimation];

dispatch_queue(^{
       while(yourAVPlayer.status == AVPlayerStatusUnknown) {}
       [yourActivityIndicator stopAnimation];
 });
心房的律动 2024-11-02 05:15:10

您不需要自己创建该属性:它是 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) {}. Substitute yourAVPlayer with an object of class AVPlayer.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文