简体   繁体   English

如何在android中播放.opus音频文件?

[英]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.

相关问题 如何在 firebase-messaging-sw.js 中播放音频/声音 - How to play audio/sound in firebase-messaging-sw.js 如何将通过 webrtc kinesis stream 接收到的 OPUS 文件中的数据解码为 PCM 格式? - How to decode the data from OPUS files received though the webrtc kinesis stream into PCM format? 如何使用 react-native 和 expo 将 m4a 音频文件上传到 Firebase 存储? - How does one upload an m4a audio file to Firebase Storage using react-native and expo? 使用 Play 将文件上传到 GAE! 框架 - Uploading a file to GAE with Play! Framework Android 没有谷歌播放服务的推送通知 - Android Push notification without google play services 如何在 android Java 中获取文件名和扩展名 - How to get file name and extension in android Java 使用 Twilio 无服务器 SDK 提供音频文件 - Serve audio file using Twilio serverless SDK Android 应用程序检查播放完整性不起作用 - Android app check play Integrity not work 如何在没有前台服务/警报管理器的情况下通过 Push Notif 在 Android 上播放警报声音,而不管设备已锁定或应用程序已被杀死? - How to play an alarm sound on Android via Push Notif regardless of Device locked or App killed without Foreground Service/Alarm Manager? 从 Firebase 上传应用到 Google Play Android - Upload App From Firebase App Distribution to Google Play Android
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM