[英]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.我正在开发一个使用谷歌云语音 API 识别语音并同时录制音频的应用程序。 git link I tried to play recorded.opus audio file getting IOException
W/System.err: java.io.IOException: setDataSource failed.
我尝试播放recorded.opus音频文件时出现 IOException
W/System.err: java.io.IOException: setDataSource failed.
Any idea??任何的想法?? Thanks!!
谢谢!!
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. Android堆栈交换机上的用户提到, 当他们在较新版本的Android中具有.ogg扩展名时 ,能够播放opus文件 。
Rename your .opus files to .ogg. 将.opus文件重命名为.ogg。
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. 我不知道该特定错误,但支持的媒体格式页面表示Opus仅在Android 5.0+中受支持,然后仅在matroska容器中受支持。
Make sure you're testing on newer Android, and you may need to demux manually to feed raw packets to the decoder. 确保您在较新的Android上进行测试,并且您可能需要手动进行解复用以将原始数据包提供给解码器。
If you need Opus support everywhere you can include the C library in your app and call it directly over JNI. 如果您在任何地方都需要Opus支持,则可以在应用程序中包含C库,并通过JNI直接调用它。
Android 10 and newer can play ".opus" files as such. Android 10 及更新版本可以播放“.opus”文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.