【发布时间】:2021-08-19 14:02:41
【问题描述】:
所以我有一个 index.html 文件,它将存储在我计算机中的视频应用为全屏显示,而其他文本显示在它上面。但是 github 页面似乎不起作用:后台没有运行视频。然而,当我在 Atom 中运行它时,它按预期工作。此外,我已经使用 git LFS 跟踪视频并将其推送到我的 repo,如下图所示: Picture showing my repository.
这就是网站在本地的样子。 Website in local environment
这是在 github 页面上:Website hosted by github pages (picture)
仓库链接是:https://github.com/ecoist-ste/pw-version2/blob/master/index.html
并且github页面托管的网站链接是:https://ecoist-ste.github.io/pw-version2/
下面是 index.html 和 style.css 的一部分,使视频全屏显示。
.v-header{
height: 100vh;
display: flex;
align-items: center;
color:white;
}
.container{
max-width: 960px;
padding-left: 1rem;
padding-right: 1rem;
margin:auto;
text-align: center;
}
.fullscreen-video-wrap{
position: absolute;
top:0;
left:0;
width: 100%;
height: 100vh;
overflow: hidden;
}
.fullscreen-video-wrap video{
min-width: 100%;
min-height: 100%;
}
<header class="v-header container">
<div class="fullscreen-video-wrap">
<video src="background_video.mp4" autoplay muted loop>
</video>
</div>
<div class="header-overlay">
<div class="header-content container">
<h1 style="font-size:200px">...</h1>
<p style="font-size:100px">...</p>
<button onClick="document.getElementById('Start').scrollIntoView();" type="button" class="btn btn-outline-info" style="font-size:50px; color: pink; border-radius:60px">Learn More</button>
</div>
</header>
【问题讨论】:
-
如果它在本地工作并且在您将其上传到网站时不起作用,那么我们将无法仅通过查看代码来判断问题所在。
-
做一些debugging。使用浏览器中的开发人员工具。查看控制台:是否报告了任何错误?查看“网络”选项卡:是否发出了视频的 HTTP 请求?它得到回应了吗?状态码对吗?查看元素面板:
<video>出现了吗?它的尺寸是否正确(例如,可能有什么东西导致它渲染时看不到任何像素)? -
嗨昆汀,我刚刚在这两种情况下都添加了网站的图片。另外,我按照你的建议做了。在你给我的所有问题中,我注意到两个:1)控制台:“审核 navigator.userAgent、navigator.appVersion 和 navigator.platform 的使用情况”。 2) 视频的网络标签显示“请求没有可用的响应数据”。
-
哦,我不确定状态码。它是绿色的,颜色旁边的值为 206。
-
@Steve,看看我的回答是否对你有帮助。如果仍然失败,请告诉我们存储库链接(如果隐私是问题,您可以稍后在我们有机会检查后删除带有链接的评论)
标签: html css html5-video github-pages