简体   繁体   English

Android-MEDIA ERROR UNKNOWN -1通常是什么意思

[英]Android - What does MEDIA ERROR UNKNOWN -1 ussually means

I'm developing an Audio Player (using the MediaPlayer) which works fine on mdpi, hdpi, tablets, but throws a error: MEDIA ERROR UNKNOWN -1 on Samsung Galaxy mini (ldpi). 我正在开发一个音频播放器(使用MediaPlayer),可以在mdpi,hdpi,平板电脑上正常工作,但是会引发错误:Samsung Galaxy mini(ldpi)上的MEDIA ERROR UNKNOWN -1。

What I noticed is that this error occurs for majority of songs, though there are 1, 2 songs that still plays on Galaxy Mini. 我注意到的是,尽管有1、2首歌曲仍在Galaxy Mini上播放,但大多数歌曲都会出现此错误。

Why does this error usually occurs? 为什么通常会发生此错误?

I managed to know what was the problem by passing the same URI that was causing the issue to the native Audio Player and let see how it will react. 通过将导致问题的相同URI传递给本机Audio Player,我设法知道了问题所在,然后看看它会如何反应。 The native audio player responded in a more user-friendly way, by saying that the file type is not supported. 本地音频播放器以更用户友好的方式响应,表示不支持文件类型。

So at least now I know the problem is not from my side. 所以至少现在我知道问题不在我身边。

private void startNativeAudioPlayer() {

        String path="http://..";

        Intent intent = new Intent();  
        intent.setAction(android.content.Intent.ACTION_VIEW);  
        intent.setDataAndType(Uri.parse(path), "audio/*");  
        startActivity(intent);
}

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

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