首页 \ 问答 \ 如何检查视频或音频文件格式是否可以在iphone中以编程方式播放?(How to check whether a video or audio file format is playable in iPhone programmatically?)

如何检查视频或音频文件格式是否可以在iphone中以编程方式播放?(How to check whether a video or audio file format is playable in iPhone programmatically?)

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

如何在开始播放前检查文件是否受iPhone支持,我正在使用MPMoviePlayerController播放文件。


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

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


原文:https://stackoverflow.com/questions/4920197
更新时间:2023-10-09 11:10

最满意答案

创建字符串的副本并对其进行修改,然后将其设置回来(如果这是您需要的)。

std::string newid = some_reader->Key();
int start_index = newid.find("something");
newid.erase(start_index, 3);

some_reader->SetKey(newid); // if required and possible

除非你知道你在做什么,为什么要这样做并考虑了所有其他选择,否则应该避免其他路线......在这种情况下,你首先不需要问这个问题。


Create a copy of the string and modify that, then set it back (if that's what you need).

std::string newid = some_reader->Key();
int start_index = newid.find("something");
newid.erase(start_index, 3);

some_reader->SetKey(newid); // if required and possible

Other routes shall be avoided unless you know what you're doing, why you're doing it and have considered all other options ... in which case you would never need to ask this question in the first place.

相关问答

更多
  • 如果你想在main()反转str2 ,你需要将一个足够大的缓冲区传递给reverse_const来保存反向字符串,或者你需要在reverse_const动态分配存储空间(一个局部变量长度数组赢了' t)): #include ... void reverse_const (const char **str_const) { int c_size = strlen (*str_const); char *str = calloc (c_size + 1, sizeof * ...
  • 创建字符串的副本并对其进行修改,然后将其设置回来(如果这是您需要的)。 std::string newid = some_reader->Key(); int start_index = newid.find("something"); newid.erase(start_index, 3); some_reader->SetKey(newid); // if required and possible 除非你知道你在做什么,为什么要这样做并考虑了所有其他选择,否则应该避免其他路线......在这种情况 ...
  • 情况1:您正在使用静态投射来消除常量。 您违反了为该方法定义的合同。 情况2:你没有改变(这是const)的内容,而是分配包含const void指针的变量a。 对于实际的影响:对于情况1),如果a没有真正指向一个变量,那么你可以在脚下开枪。 建议:只有在你知道自己在做什么的情况下才能抛弃常量。 Case 1: You are using a static cast to cast away the constness. You are violating the contract that was def ...
  • 一个有效的简单反例: void foo(const int *a) { // Pointer-to-const here int *p = const_cast(a); *p = 2; } int main() { int a = 1; // But underlying object is not const foo(&a); } A simple counterexample which is ...
  • 当参数按值传递时,它是可以修改的,并且可以省略复制它。 例如,实现赋值运算符的规范方式如下所示: T& T::operator= (T value) { value.swap(*this); return *this; } 乍一看,它可能看起来效率低下,因为T正在被复制。 但是,无论如何它都会被复制,即如果需要复制,将会创建一种方法: T& T::operator= (T const& value) { T(value).swap(*this); // has to do a co ...
  • 在doSomething中使用const引用来返回rvalue是否安全? 是的,这很好。 该语言有一个特定的子句,可以保证如果绑定对rvalue的引用,则会创建一个临时值 ,并将生命周期延长到创建引用的作用域的末尾。 doSomething2是否创建了返回的右值的副本,是否允许编译器在这里进行右值优化? 在这两种情况下,成本都是相同的,因为编译器会执行RVO(返回值优化) doSomething和doSomething2之间有什么区别,哪一个是可以忍受的? 主要区别在于,在一种情况下,您为真实对象指定名称, ...
  • C不支持引用或通过引用传递。 你应该使用指针代替并通过地址传递。 按值传递对于基本类型是有效的,但对结构进行浅层复制。 在C ++中,为了提高效率,通过引用传递对象会很有意义。 在定义复制构造函数时,它可以节省大量复制和调用构造函数/析构函数。 对于大型数据对象(例如std::list ),传递值是不切实际的,因为传递时会复制列表。 在这里你绝对应该通过引用传递。 C does not support references or passing by reference. You should use po ...
  • 引用C ++ 11,8.3.2 / 1: ...除非通过使用typedef(7.1.3)或模板类型参数(14.3)引入cv限定符,否则Cv限定引用的格式不正确,在这种情况下,cv限定符将被忽略。 ... Quoting C++11, 8.3.2/1: ... Cv-qualified references are ill-formed except when the cv-qualifiers are introduced through the use of a typedef (7.1.3) or of ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)