I have a flatlist showing videos. I want that when a video goes out of the view it should be paused. I am maintaining the pause state in each of the Posts component.
class Posts extends React.PureComponent {
constructor() {
super()
this.state = {
pause: true,
}
return(){
<Video
pause={this.state.pause}
//other props
/>
}
}
Run Code Online (Sandbox Code Playgroud)
I am using react-native-video.
我已经尝试使用onViewableItemsChangedof的道具,Flatlist但是它不会改变状态。
我试过了。但这似乎对我不起作用。
我应该如何进行?
我正在尝试在 React Native 中实现一些功能:我有一个在 React Native 视频组件中显示的视频网址,我如何提供一个按钮来在移动设备中下载相同的视频,但它不应该出现在图库中。另外,如果视频是私有的,则可以在哪里传递标题以及如何传递?
有没有在React-Native-Web中播放视频的解决方案
React-Native-Web:https ://github.com/necolas/react-native-web
React-Native-视频:https://github.com/react-native-community/react-native-video
我正在为 Android 构建一个 React-Native 应用程序,在尝试使用 React-Native-Video 播放不同的视频时收到错误。错误说:
[errorException] => com.google.android.exoplayer2.mediacodec.MediaCodecRenderer$DecoderInitializationException: Decoder init failed: OMX.amlogic.avc.decoder.awesome, Format(1, null, null, video/avc, null, -1, null, [3840, 2160, -1.0], [-1, -1])
[errorString] => Unable to instantiate decoder OMX.amlogic.avc.decoder.awesome
Run Code Online (Sandbox Code Playgroud)
我发现这个建议改变解码器,但在JS中这似乎是不可能的。有什么办法可以做到这一点吗?或者您会推荐另一个本机视频播放器吗?
我想在我的应用程序中使用react-native-video。但是,我所做的不起作用:
我使用创建了一个新项目expo init Project1
然后我安装了react-native-video:npm install --save react-native-video
我当时用的是这个:react-native link react-native-video
我目前只有 App.js :
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import Video from 'react-native-video';
export default function App() {
return (
<View style={styles.container}>
<Video source={{uri: './small.mp4'}} // Can be a URL or a local file.
ref={(ref) => {
this.player = ref
}} // Store reference
o.nBuffer={this.onBuffer} // Callback when remote video is buffering
onError={this.videoError} // Callback when video cannot be loaded …Run Code Online (Sandbox Code Playgroud) 我一直在尝试从包含多个视频和图像的滑块播放单个视频。我使用和尝试的内容如下。 1. react-native-video, 2. react-native-snap-carousel
如何暂停和播放水平轮播中包裹的视频以及垂直 FlatList Feeds 中的视频
这是我的旋转木马:
<View style={styles.sliderImgView}>
<Carousel
ref={(c) => { this._carousel = c; }}
data={chordData.images}
firstItem={0}
autoplay={autoPlay}
layout={layout}
loop={loop}
renderItem={this._renderItem}
onSnapToItem={(ind) => this.setState({ activeSlide: ind })}
loopClonesPerSide={bannersDataLength}
sliderWidth={SCREEN_WIDTH}
itemWidth={SCREEN_WIDTH} />
</View>
Run Code Online (Sandbox Code Playgroud)
我的 _renderItem 在这里:
if (item.mediaType === "image") {
return (
<View style={[styles.sliderImgView, GlobalStyles.ajCenter]} key={index}>
<Image source={{ uri: item.imgUrl }} resizeMode={"cover"} style={[styles.sliderImageStyle]} />
</View>
)
} else {
return (
<View style={[styles.sliderImgView, GlobalStyles.ajCenter]} key={index}>
<Video
source={{ uri: item.imgUrl }} // Can be a URL …Run Code Online (Sandbox Code Playgroud) javascript react-native react-native-snap-carousel react-native-video
我正在使用反应本机视频
它有一个名为的道具poster,运行良好。但我的要求是从视频中获取缩略图(视频的第一帧)。如果我不使用poster(接受网址),那么它会显示空白屏幕。
知道如何使用视频的第一帧作为缩略图吗?
谢谢你!!!
所以我并行使用react-native-video和react-native-track-player,通常两者都工作正常,但是要使用视频播放器的一些额外功能,例如缓冲,我必须使用Exo播放器,但是手动使用exo播放器正在制作react-native-track 播放器崩溃得很好,我试图得到答案,发现它是由于两个库使用的 exo 播放器版本冲突而发生的。谁能帮忙
谢谢
reactjs react-native react-native-video react-native-track-player
我正在尝试开发VideoFeed屏幕,用户可以在其中一一查看视频的数量。
我使用 flatlist 来渲染视频并使用react-native-video库来播放视频。
在android中我曾经用来ExoPlayer播放视频。
我使用 HLS(.m3u8) url 来播放视频,但加载时间不是太多,但当我与 TikTok 或 Facebook Story 相比时,他们的视频加载速度太快了。
如何在我的应用程序中快速加载视频。
我正在使用这个 bufferconfig 来获得最小的视频缓冲区,但没有任何帮助我。
const bufferConfig = {
minBufferMs: 100,
maxBufferMs: 200,
bufferForPlaybackMs: 100,
bufferForPlaybackAfterRebufferMs: 100
};
Run Code Online (Sandbox Code Playgroud)
过去几天我一直被困在这一点上。
请任何人帮助我。