HTML 视频在 1 分 50 秒后停止播放

发布于 2025-01-10 14:45:48 字数 377 浏览 4 评论 0原文

我有一个时长 2 分 42 秒的视频。我已确认视频本身可以播放并且没有损坏。视频一直正常播放到 1.50 标记,然后突然停止。

<div class="video-container">
     <video controls preload>
        <source style="width: 100%; height:50%" src="splitscreen.mp4" type="video/mp4" />
     </video>
</div>

.video-container {
    width: 100%;
    height: 100%;
    position: relative;
}

I have a video that is 2 minutes and 42 seconds in length. I have confirmed the video itself plays through and is not corrupted. The video plays fine up until the 1.50 mark and then abruptly stops.

<div class="video-container">
     <video controls preload>
        <source style="width: 100%; height:50%" src="splitscreen.mp4" type="video/mp4" />
     </video>
</div>

.video-container {
    width: 100%;
    height: 100%;
    position: relative;
}

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

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

发布评论

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

评论(2

删除→记忆 2025-01-17 14:45:48

您可以尝试使用媒体片段,看看是否可以播放整个视频。

<source style="width: 100%; height:50%" src="splitscreen.mp4.webm#t=0:00:00,00:02:42" type="video/mp4" />

将媒体片段添加到媒体 URL,您可以指定要播放的确切部分。要添加媒体片段,请添加#t=[start_time][,end_time]。

You could try using Media Fragments and see if this allows the entire video to be played.

<source style="width: 100%; height:50%" src="splitscreen.mp4.webm#t=0:00:00,00:02:42" type="video/mp4" />

Adding a media fragment to the media URL, you can specify the exact portion you want to play. To add a media fragment, you add #t=[start_time][,end_time].

把时间冻结 2025-01-17 14:45:48

首先,通过 JS 确认视频的长度:

 <video id="myVideo" controls preload="auto">
        <source style="width: 100%; height:50%" src="splitscreen.mp4" type="video/mp4" />
 </video>

<script>
    var vid = document.getElementById("myVideo");
    alert("Video duration is : " + vid.duration);
</script>

我在这里所做的就是为您的视频提供一个 ID,声明一个保存 document.getElementById("myVideo") 的变量,然后使用.duration 并发出警报。如果您看到预期的视频长度:

我有一个时长 2 分 42 秒的视频。

那么我相信“controls preload”是您的错误,因为语法不正确(应该是 preload="auto"),请检查 此处 有关它的详细解释。

当然,如果警报中视频的长度确实显示为 1:50,则该视频已损坏。
祝你好运!

First, confirm the video's length through JS:

 <video id="myVideo" controls preload="auto">
        <source style="width: 100%; height:50%" src="splitscreen.mp4" type="video/mp4" />
 </video>

<script>
    var vid = document.getElementById("myVideo");
    alert("Video duration is : " + vid.duration);
</script>

all I'm doing here is giving your video a ID, declaring a variable which holds document.getElementById("myVideo"), then checking it's length by using the .duration and alerting it. If you see your expected video's length:

I have a video that is 2 minutes and 42 seconds in length.

Then I believe "controls preload" is your error here as the syntax is incorrect (should be preload="auto"), check here for great explanation about it.

Of-course if the video's length does show 1:50 in the alert, then the video is corrupted.
Best of luck!

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