简体   繁体   English

在 React Native 中点击图标播放音频剪辑

[英]Play Audio clip onclick of icon in React Native

[https://i.stack.imgur.com/cNFqa.png][1] [https://i.stack.imgur.com/cNFqa.png][1]

Hi I am trying to make it such that a audio recording would play when my user clicks on the speaker icon in the picture shown above.嗨,我正在尝试让它在我的用户单击上图中的扬声器图标时播放录音。 Would appreciate any help or prompt for me to go towards the correct direction as all I have found on google so far is react native sound players which come with a whole set of play pause and volume buttons which I do not need since the audio clip I have is probably just 2 seconds long which is a simple pronunciation of the number they have selected感谢任何帮助或提示让我朝着正确的方向前进,因为到目前为止我在谷歌上找到的只是反应原生声音播放器,这些播放器带有一整套播放暂停和音量按钮,因为音频剪辑我不需要have 可能只有 2 秒长,这是他们选择的数字的简单发音

You have to use any sound player library to do so.你必须使用任何声音播放器库来做到这一点。

See: https://www.npmjs.com/package/react-native-sound-player请参阅: https : //www.npmjs.com/package/react-native-sound-player

You can use this library to play audio either local file or from url您可以使用此库从本地文件或从 url 播放音频

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

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