react-native-video - 视频停顿然后继续播放

发布于 2025-01-09 08:17:26 字数 1338 浏览 2 评论 0原文

我目前在我的应用程序中使用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 技术交流群。

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文