how to play .opus audio file in android?

I'm developing an app for Recognize speech using google cloud speech APi and recording audio simultaneously. git link I tried to play recorded .opus audio file getting IOException W/System.err: java.io.IOException: setDataSource failed.

Any idea?? Thanks!!


I don't know about that specific error, but the Supported Media Formats page says Opus is only supported in Android 5.0+, and then only in the matroska container.

Make sure you're testing on newer Android, and you may need to demux manually to feed raw packets to the decoder.

If you need Opus support everywhere you can include the C library in your app and call it directly over JNI.


A user on the android stack exchange mentioned being able to play opus files when they have a .ogg extension in newer versions of Android.

Rename your .opus files to .ogg.

链接地址: http://www.djcxy.com/p/31148.html

上一篇: 在Java中的Mqtt客户端SSL例子

下一篇: 如何在android中播放.opus音频文件?