问题标签 [react-native-video]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
497 浏览

reactjs - 反应原生视频。如何卸载视频?

我使用 react-native-video 和 react-native-video-player 库。我的问题是下一个 - 如何卸载视频?我有一个视频列表(我要求拍摄所有视频,但一开始只显示 5 个,然后按“显示更多”按钮并加载 5 个视频,但如果我播放超过 8 个视频(播放和暂停)全部其他视频停止工作 - 我按下视频的播放控制,视频变为白色)。我有办法通过按“显示更多”来卸载以前的视频,还是有另一种方法可以避免此类问题?谢谢。

0 投票
0 回答
257 浏览

android - 无法在 android 设备中打开相机 - react-native

我正在尝试使用“react-native-nodemediaclient”实现实时视频流功能。并面临android设备中的问题。它在ios中正常工作。

使用 ignite 样板管理项目架构时无法在 android 设备中打开相机。它在ios中正常工作。当我使用简单的 react-native 创建时,它适用于 android 和 ios。

0 投票
1 回答
1123 浏览

react-native - 无法读取未定义的属性“寻求”

我正在尝试使用 react-native-video 组件,如下所示:

结果是:

ExceptionsManager.js:74 无法读取未定义的属性“寻求”

如果我将 onEnd 方法更改为以下内容,它将起作用:

我不想使用第二种方法,因为它弄乱了我的 xml 代码。我该如何解决第一种方法?

0 投票
3 回答
2918 浏览

ios - 域 = AVFoundationErrorDomain ,代码 = -11828

我正在使用来自 CloudFront 的流式传输 url。

示例 URL: https ://d14nt81hc5bide.cloudfront.net/qyYj1PcUkYg2ALDfzAdhZAmb

在 Android 上,它工作正常,但在 iOS 上它说: domain = AVFoundationErrorDomain , code = -11828

从苹果文档错误代码 11828 是 AVErrorFileFormatNotRecognized。无法打开该媒体,因为它不是可识别的格式。

有人可以建议如何解决此错误吗?

0 投票
0 回答
234 浏览

node.js - 反应原生视频在开始时需要太多时间来显示视频流(nodejs流)

我在后端使用 nodejs 视频流,前端是 React-native。nodejs 视频流对我有用,但它在视频播放器的开头加载时间太长,也没有显示加载。我正在使用 react-native-video 组件,并且正在调用 nodejs API 来获取流。

0 投票
0 回答
40 浏览

react-native - 当列表更新时,React Native Video 从暂停状态播放

我有一个视频播放器,其下方有一个视频缩略图列表,并且我正在调整分页以更新该列表。当新视频添加到我的状态并且视频暂停时,组件会重新渲染,并且由于默认设置了自动播放,因此视频会从暂停状态播放。

我尝试使用 shouldComponentUpdate 并手动尝试管理某些状态作为解决方法,但无济于事。

0 投票
0 回答
848 浏览

ios - 在平面列表中显示多个视频实例的问题

我在平面列表中显示视频时遇到了一些问题。这似乎是真实设备上的特定 iOS 问题,因为它在模拟器和 android 上运行良好。使用react-native-video和在错误日志中我得到AVFoundationErrorDomain错误代码11839。搜索了一段时间后,似乎真实设备一次可以显示多少个视频实例。

所以我在视频组件中出现黑屏,带有灰色的控件和一个划掉的播放按钮。结构是平面列表 -> 子 -> 视频。我尝试更改顺序并将视频组件提升一个级别,但同样的问题。flatlist 将一次呈现 10 个项目,并且可以包含图像或视频。

我已经尝试保存使用 onViewableItemsChanged 属性渲染的项目的键并将其保存,并且在 redux 中最多保存十个。然后我获取渲染视频组件的这个数组以仅渲染项目 id 所在的视频组件与 redux 中的数组相同。理论上,这应该只渲染最近查看或已查看的项目。

在此之前,视频根本没有加载,现在它们被渲染了一段时间,但是在渲染并播放了一对之后,问题又回来了。实际的组件总是被渲染(如果键/id 已经被保存并被提取到 redux)但是有一个黑屏

非常感谢任何对我的代码有其他解决方案或输入来帮助我解决此问题的人。

减速器:

行动:

使成为:

onViewableItemsChanged:

0 投票
1 回答
666 浏览

android - Android 依赖 'com.google.android.exoplayer:exoplayer' 对于编译(r2.1.0)和运行时(2.9.1)类路径有不同的版本

我在我的应用程序中使用了这两个模块(react-native-video & react-native-nyt-360-video):

包.json:

应用程序/build.gradle:

我需要将这两个模块放在一起,因为我的应用程序必须同时播放普通视频和 360 视频。

现在,当我运行项目(react-native run-android)时,我遇到了这个错误:

我该做什么?请帮我 。谢谢

0 投票
0 回答
1489 浏览

javascript - Partial download of mp4 file with rn-fetch-blob, react-native-video throwing unrecognized error

I'm trying to implement local video caching into my video-streaming application.

I'm using:

  • react-native-video for video playback
  • rn-fetch-blob for downloading files

I've managed to start the download at the beginning, replace the original URL with the local one and continue with the playback from my local file (it works as expected) - even with partial file (as long as I start from 0).

The main problem is seek function. If a user wants to start watching at e.g. 120s - download will still start at 0B. I've implemented Range header in the Fetch API looking something like this:

to overcome this problem. Now download starts at desired Bytes and downloads only desired part of the video file.

The download works normally but video playback throws Unrecognized media format error. Also tried adding some bytes for headers at the beginning (0-10000B) - to try and recognize the video file, no luck.

So I'm wondering if it's possible to implement partial video file download with rn-fetch-blob and be able to play the file back using react-native-video (not starting at the beginning of the file), later also add other pieces to the file (until the whole download is complete). How could I convince react-native-video that my partial download is indeed proper mp4 file?

UPDATE

I've messed around with HTTP GET headers for a while and actually got somewhere. Not a complete solution but might help someone:

^^ these are my test headers. Had to add two value to Range. The first one just downloads the first part of the file to get headers and to recognize the file type. The second one is from the "seek point" owards. Video now plays and file type is recognized.

0 投票
0 回答
353 浏览

android - 如何在运行时使用基于 android sdk 版本的库的可变版本?

根据https://www.npmjs.com/package/react-native-video/v/4.2.0上的描述,超过 26 的 SDK 不支持 react-native-video。

现在我想添加一个场景,如果 android 版本早于 26 ,那么它(app)加载兼容的 react-native-video 版本(3.2.1),否则将使用该库的最后一个版本