【问题标题】:How to Record Audio and Video using React Native App (Without Expo)如何使用 React Native App 录制音频和视频(没有 Expo)
【发布时间】:2019-03-20 09:08:18
【问题描述】:

有没有办法在 React Native 中创建 App,可用于录制音频和视频并使用 App 在 Android 和 iOS 设备上保存相同的文件?

请帮助我,因为我被困住了。 谢谢。

【问题讨论】:

  • 有很多库可以做到这一点,但如果您提供有关该问题的一些具体信息将会很有帮助。

标签: react-native react-native-video


【解决方案1】:

我猜你可以使用 React Native 社区维护的 3 个库。 react-native-camera(用于录制视频) react-native-video(用于播放视频) react-native-audio-toolkit(用于录制和播放音频)

录制音频

    import {
      Recorder,
    } from 'react-native-audio-toolkit';

    // function to start recorder
    this.recorder = new Recorder(‘filename.mp4’).record();

要录制视频并播放,medium 中有一篇非常好的博文

https://medium.com/react-native-training/uploading-videos-from-react-native-c79f520b9ae1

更多示例,请查看每个库的 github 页面中的示例

https://github.com/react-native-community/react-native-camera

https://github.com/react-native-community/react-native-video

https://github.com/react-native-community/react-native-audio-toolkit

【讨论】:

    猜你喜欢
    • 2022-08-10
    • 1970-01-01
    • 1970-01-01
    • 2021-09-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-06-11
    • 2019-12-21
    相关资源
    最近更新 更多