0

我被雇来使用树莓派在我为高中实习工作的公司的大厅里创建一种“大厅信息亭”。启动时,树莓派会显示 3 个项目;一个不断循环播放的演示视频,总结了公司的目标和服务、天气和新闻栏。

为此,我决定使用本地托管的 apache2 网站,该网站将在启动时以 kiosk 模式打开。为了提供新闻和天气,我使用了网站小部件;分别来自momentaryreview.com和weatherwidget.io,视频是使用html5标签提供的,源是存储在pi上的.mp4文件。为了不断更新新闻和天气,我将网站设置为在每次演示结束时刷新,以免中断循环。我也有一些 CSS 代码来隐藏滚动条。最后,我设置了一个 cronjob 来每天午夜重新启动 pi。

此设置运行良好,除了每隔一两个小时,网站会随机崩溃,显示典型的“糟糕!我们无法访问此网页”错误。错误日志中没有出现任何内容,访问日志中也没有出现异常;此外,当您刷新页面时,一切都会恢复正常。不过,当然,我不能让售货亭每隔几个小时就需要刷新一次。它必须在没有任何干预的情况下运行一整天。什么可能导致这些崩溃?

提前感谢您的帮助!

这是我的代码:

<html >

<!--CSS block to set design parameters for the website -->
<style type="text/css">
.WebContainer{
    width:100%;
    min-width:1850px;
    height:100%;
    min-height:1075px;

} 
html {
  min-width: 100%;
  min-height: 100%;

}
<!-- sets website dimensions to 1920x1080p;-->
body {
  width: 1920px;
  height: 1080px;
  background-color: #FFF;

}

<!-- makes scrollbar invisible -->
::-webkit-scrollbar { 
    display: none; 
}
</style>


<!--Displays "Welcome to (Company) on top of page & sets background color -->
<body>
<h1 style="text-align:center; font-family:sans-serif;">Welcome to (Company)</h1>
<body style="background-color: skyblue;"></body>

</body>


<!--takes weather information from weatherwidget.io and displays it on the website -->
<a class="weatherwidget-io" 
href="https://forecast7.com/en/35d79n78d78/(location)/?unit=us" 
data-label_1="LOCATION" 
data-label_2="WEATHER" 
data-theme="original" 
>LOCATION WEATHER</a> 
<script>
!function(d,s,id)
{
    var js,fjs=d.getElementsByTagName(s)[0];
    if(!d.getElementById(id))
        {
        js=d.createElement(s);js.id=id;
        js.src='https://weatherwidget.io/js/widget.min.js';
        fjs.parentNode.insertBefore(js,fjs);
        }
}
        (document,'script','weatherwidget-io-js');
</script>


<!-- takes news from the momentaryreview news widget-->
<iframe 
style="background-color: #ffffff;" 
src="https://momentaryreview.com/widget"
name="News_widget" 
class="iframe"
width="20%" 
height="875" 
frameborder="1" 
marginwidth="0" 
marginheight="0"
scrolling="no"
></iframe>


<!-- displays the powerpoint on the website as an mp4; edit these to make the video display normally on smaller screens -->
<video width="1500" height="875" autoplay muted loop> 
<source src="IntroPresentationFinal.mp4" type="video/mp4"> 
</video>


<!-- refreshes the page every loop of the presentation, which is 143 seconds long long --> 
<meta   
http-equiv="refresh" 
content = "142"
>

<body>


</body>

</html>
4

0 回答 0