Update zsy.php

pull/18/head
居桉 2020-02-27 00:16:48 +08:00 committed by GitHub
parent 930e11e4f9
commit 774e6aa6da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 48 additions and 20 deletions

View File

@ -10,15 +10,15 @@
<link rel="icon" href="<?php echo $_SERVER['base_disk_path'];?>favicon.ico" type="image/x-icon" /> <link rel="icon" href="<?php echo $_SERVER['base_disk_path'];?>favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="<?php echo $_SERVER['base_disk_path'];?>favicon.ico" type="image/x-icon" /> <link rel="shortcut icon" href="<?php echo $_SERVER['base_disk_path'];?>favicon.ico" type="image/x-icon" />
<style type="text/css"> <style type="text/css">
body:before{ body:before{
top: 0; top: 0;
left: 0; left: 0;
right: 0; right: 0;
bottom: 0; bottom: 0;
z-index: -1; z-index: -1;
content: ""; content: "";
position: fixed; position: fixed;
background: url(http://api.btstu.cn/sjbz/zsy.php) center/cover; background: url(http://api.btstu.cn/sjbz/zsy.php) center/cover;
} }
a { a {
color:#FFFFFF; color:#FFFFFF;
@ -793,16 +793,44 @@ a:hover {
); );
} }
function createDplayers(videos) { function createDplayers(videos) {
for (i = 0; i < videos.length; i++) { var url = '<?php echo str_replace('%2523', '%23', str_replace('%26amp%3B','&amp;',spurlencode(path_format($_SERVER['base_path'] . '/' . $path), '/'))); ?>' , subtitle = url.replace(/\.[^\.]+?(\?|$)/,'.vtt$1');
console.log(videos[i]); var dp = new DPlayer({
new DPlayer({ container: document.getElementById('video-a0'),
container: document.getElementById('video-a' + i), autoplay: false,
screenshot: true, screenshot: true,
video: { hotkey: true,
url: videos[i] volume: 1,
} preload: 'auto',
}); mutex: true,
} video:{
url: url,
},
subtitle: {
url: subtitle,
fontSize: '25px',
bottom: '7%',
},
});
// 防止出现401 token过期
dp.on('error', function () {
console.log('获取资源错误,开始重新加载!');
let last = dp.video.currentTime;
dp.video.src = url;
dp.video.load();
dp.video.currentTime = last;
dp.play();
});
// 如果是播放状态 & 没有播放完 每25分钟重载视频防止卡死
setInterval(function () {
if (!dp.video.paused && !dp.video.ended) {
console.log('开始重新加载!');
let last = dp.video.currentTime;
dp.video.src = url;
dp.video.load();
dp.video.currentTime = last;
dp.play();
}
}, 1000 * 60 * 25)
} }
addVideos(['<?php echo $DPvideo;?>']); addVideos(['<?php echo $DPvideo;?>']);
<?php } <?php }
@ -1387,4 +1415,4 @@ a:hover {
<?php } ?> <?php } ?>
</script> </script>
<script src="//unpkg.zhimg.com/ionicons@4.4.4/dist/ionicons.js"></script> <script src="//unpkg.zhimg.com/ionicons@4.4.4/dist/ionicons.js"></script>
</html> </html>