简体   繁体   English

是否有一个好的React Native模块用于播放/流音频?

[英]Is there a good React Native module for playing/streaming audios?

I'm new to react native and building an audio streaming app. 我是新来的响应本机并构建音频流应用程序的人。 I found quite a few react native wrappers for native modules for playing audio files https://js.coach/react-native/react-native-ios-audio?search=audio But none of them seem sufficient. 我发现相当多的本机模块对本机模块进行了响应本机包装,以播放音频文件https://js.coach/react-native/react-native-ios-audio?search=audio但它们似乎都不足够。 I'm looking for a module that would 我正在寻找一个将

  1. allow playing in the background and handle interruptions 允许在后台播放并处理中断
  2. have play-speed control 具有播放速度控制
  3. allow both streaming and local file playing 允许流和本地文件播放

Does such a module exist? 是否存在这样的模块? Any tips would be much appreciated. 任何提示将不胜感激。 Thanks! 谢谢!

If your intention is to use the features you mentioned in a cross-platform (android/ios) app, then you do have some options, but there isn't a single module that will cover each of those bases. 如果您打算使用跨平台(android / ios)应用程序中提到的功能,那么您确实有一些选择,但是没有一个模块可以覆盖所有这些基础。

Right now, I'm using a few different modules to accomplish similar functionality to what you're looking for: 现在,我正在使用一些不同的模块来实现与您正在寻找的功能相似的功能:

  • react-native-audio-streaming to stream audio from a remote URL. react-native-audio-streaming以流式传输来自远程URL的音频。

  • react-native-sound to play local audio files. react-native-sound播放本地音频文件。

  • react-native-audio-streamer to stream audio from a remote URL on Android, since it uses ExoPlayer , instead of the AACDecoder used by react-native-audio-streaming . react-native-audio-streamer可以从Android上的远程URL流式传输音频,因为它使用ExoPlayer而不是react-native-audio-streaming所使用的AACDecoder

Support for loading sound over the network was recently added to react-native-sound for iOS, and someone has mentioned the possibility of implementing it on Android as well. 最近在iOS的react-native-sound增加了对通过网络加载声音的支持,有人提到了也可以在Android上实现它的可能性。 If this happens, then it may be the best choice for your use case. 如果发生这种情况,那么这可能是您的用例的最佳选择。

I've included the current react-native-sound feature set below. 我已经在下面包含了当前的react-native-sound功能集。 Hope this helps! 希望这可以帮助!

反应本机声音特征

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

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