OnBuffer 事件未在反应本机视频播放器中调用

发布于 2025-01-19 13:22:10 字数 508 浏览 4 评论 0原文

我正在使用 react-native-video 库。

我在 android/settings.gradle 中添加了以下行以使用 exoplayer,如其文档中所述。

include ':react-native-video'
project(':react-native-video').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-video/android-exoplayer')

我的

"react-native": "0.68.0",
"react-native-video": "^5.2.0",

视频播放器显示绿色搜索栏,并且其 onBuffer 事件不会触发。如何确认我是否在 React Native 中使用 exoplayer ?

I am using react-native-video library.

I have added following line in android/settings.gradle to use exoplayer as mentioned in its docs.

include ':react-native-video'
project(':react-native-video').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-video/android-exoplayer')

And I have

"react-native": "0.68.0",
"react-native-video": "^5.2.0",

The video player shows green seek bar and its onBuffer event does not fire. How do I confirm if I am using exoplayer or not in react native ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

离旧人 2025-01-26 13:22:10

我自己解决了问题。

android/settings.gradle 中的设置对我不起作用。因此,我在项目的根文件夹中添加了 react-native.config.js ,并添加了以下行:

module.exports = {
  dependencies: {
    'react-native-video': {
      platforms: {
        android: {
          sourceDir: '../node_modules/react-native-video/android-exoplayer',
        },
      },
    },
  },
};

注意:Seek Bar上的绿色轨道球表示它是旧媒体播放器。白色轨道球表示它是系政区。

I fixed the issue on my own.

The settings in android/settings.gradle did not work for me. So I added react-native.config.js in root folder of the project and added following lines:

module.exports = {
  dependencies: {
    'react-native-video': {
      platforms: {
        android: {
          sourceDir: '../node_modules/react-native-video/android-exoplayer',
        },
      },
    },
  },
};

Note: Green track ball on seek bar means it's old media player. White track ball means it's exoplayer.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文