如何检查视频或音频文件格式是否为iPhone编程可玩的? [英] how to check whether a video or audio file format is playable in iphone programatically?

查看:98
本文介绍了如何检查视频或音频文件格式是否为iPhone编程可玩的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有存储在服务器的一些音频和视频文件。我需要打他们,但我知道DONOT通过iPhone支持播放存储在服务器上的文件,

I have some audio and video files stored in a server. I need to play them, but I donot know the files stored in server supported by iphone to play,

如何检查文件是否被IPhone开始玩之前,我使用的MPMoviePlayerController播放文件的支持。

How can I check whether the file is supported by IPhone before start playing, I am using MPMoviePlayerController to play the files.

推荐答案

打在他们之前,它无法确定。当文件的格式不正确传递给它的电影播放器​​会抛出错误。
对于这一点,首先你必须遵守的noticiation: MPMoviePlayerLoadStateDidChangeNotification 如下:

Before playing them, its not possible to identify. Movie player will throw error when incorrect format of file is passed to it. For that, first you have to observe for noticiation: MPMoviePlayerLoadStateDidChangeNotification as following:

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlayerLoadStateChanged:) name:MPMoviePlayerLoadStateDidChangeNotification object:nil];

当你抓住此通知,检查大负荷状态。如果它是LoadState的MPMovieLoadStateUnknown,那么你可以说,虽然播放电影/声音有些出错。

When you catch this notification, check for players load state. If its loadState is "MPMovieLoadStateUnknown", then you can say that some error occured while playing the movie/audio.

这篇关于如何检查视频或音频文件格式是否为iPhone编程可玩的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆