react-native-video - 视频停顿然后继续播放
我目前在我的应用程序中使用react-native-video。我们将 m3u8 流 url 传递给视频播放器。流确实播放,但是两秒后 onStall 事件被触发。然后在 2-5 秒内触发 onResume 事件并恢复流,尽管现在落后了 2-5 秒。
我的视频的实现方式如下:
<Video
key={index}
ref={this.vPlayer}
source={{uri: item.uri}}
poster={item.poster}
posterResizeMode="cover"
style={styles.mediaPlayer}
onError={(error) => {
console.log(error);
}}
onPlaybackStalled={() => {
console.log("Stalled");
}}
onBuffer={(data) => {
console.log("Buffer", data);
}}
onVideoBuffer={() => {
console.log("Video Buffer");
}}
onPlaybackResume={() => {
console.log("Resume");
}}
muted={this.state.auctionMuted}
playInBackground={false}
resizeMode="cover"
controls={true}
paused={false}
/>
在获取我记录的各种事件的控制台日志的混合中。通常是:
Stalled
Resume
但我有时也会得到,错误似乎每 1 秒帧发生一次:
Stalled
{"error": {"extra": 0, "what": -2147483648}}
{"error": {"extra": 0, "what": -38}}
{"error": {"extra": 0, "what": -38}}
{"error": {"extra": 0, "what": -38}}
{"error": {"extra": 0, "what": -38}}
{"error": {"extra": 0, "what": -38}}
{"error": {"extra": 0, "what": -38}}
{"error": {"extra": 0, "what": -38}}
这个问题似乎只发生在 Android 上,iOS 应用程序流正常。
有什么建议吗?
干杯,
I am currently using react-native-video in my app. We are passing a m3u8 stream url to the video player. The stream does play, however after two seconds the onStall event is fired. Within 2-5 seconds the onResume event is then fired and the stream resumes ,although now 2-5 seconds behind.
My video is implemented as follows:
<Video
key={index}
ref={this.vPlayer}
source={{uri: item.uri}}
poster={item.poster}
posterResizeMode="cover"
style={styles.mediaPlayer}
onError={(error) => {
console.log(error);
}}
onPlaybackStalled={() => {
console.log("Stalled");
}}
onBuffer={(data) => {
console.log("Buffer", data);
}}
onVideoBuffer={() => {
console.log("Video Buffer");
}}
onPlaybackResume={() => {
console.log("Resume");
}}
muted={this.state.auctionMuted}
playInBackground={false}
resizeMode="cover"
controls={true}
paused={false}
/>
In the get a mixture of console logs from the various events I have being logged. The usual is:
Stalled
Resume
But I also sometimes get, where the errors seem to be occurring each 1 second frame:
Stalled
{"error": {"extra": 0, "what": -2147483648}}
{"error": {"extra": 0, "what": -38}}
{"error": {"extra": 0, "what": -38}}
{"error": {"extra": 0, "what": -38}}
{"error": {"extra": 0, "what": -38}}
{"error": {"extra": 0, "what": -38}}
{"error": {"extra": 0, "what": -38}}
{"error": {"extra": 0, "what": -38}}
This issue seems to only happen on Android, the iOS App streams fine.
Any suggestions?
Cheers,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论