简体   繁体   English

我可以检测某些手机是否无法播放某些音频文件吗?

[英]Can I detect if some mobile was not able to play some audio file?

I've noticed that some mobile phones are not able to play some video files. 我注意到有些手机无法播放某些视频文件。 Sometimes it's .wav extension, and sometimes some other. 有时是.wav扩展名,有时是其他。

In such cases the app does not crash and no error is generated, but the audio file just silently does not get played. 在这种情况下,该应用程序不会崩溃并且不会生成任何错误,但是音频文件只是默默地不会播放。

How to detect such situations? 如何发现这种情况? Why is this happening on the first place? 为什么这首先发生?

PS. PS。 I need to detect this in Java code - programmatically 我需要在Java代码中以编程方式检测到这一点

Android Supported Media Formats read the document, it tells which kind of media files are supported by the android. Android支持的媒体格式阅读该文档,它告诉Android支持哪种媒体文件。

For crashing problem please put your code in try...catch block like below, 对于崩溃问题,请将您的代码放入try ... catch块中,如下所示,

try
{
      // Code to play media file.
}
catch ( Exception e )
{
      // Display a Toast message, "File format doesn't support"
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM