mirror of
https://github.com/yangbvv/yangbvv.github.io.git
synced 2025-12-17 15:25:21 +08:00
Add files via upload
This commit is contained in:
1
player/hls.min.js
vendored
Normal file
1
player/hls.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
26
player/index.html
Normal file
26
player/index.html
Normal file
@@ -0,0 +1,26 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>M3U8 Player</title>
|
||||
<script src="hls.min.js"></script>
|
||||
<style>
|
||||
body{
|
||||
background-color:black;
|
||||
}
|
||||
#video{
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
right: 0px;
|
||||
bottom: 0px;
|
||||
left: 0px;
|
||||
margin: auto;
|
||||
max-height: 100%;
|
||||
max-width: 100%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<video id="video" style="width: 100%; height: 100%;" controls autoplay></video>
|
||||
<script src="player.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
12
player/player.js
Normal file
12
player/player.js
Normal file
@@ -0,0 +1,12 @@
|
||||
var video = document.getElementById('video');
|
||||
var vurl = location.search.split('vurl=')[1];
|
||||
var videoSrc = vurl;
|
||||
// 检查浏览器是否支持hls
|
||||
if (video.canPlayType('application/vnd.apple.mpegurl')) {
|
||||
video.src = videoSrc;
|
||||
// 如不支持则调用hls.min.js
|
||||
} else if (Hls.isSupported()) {
|
||||
var hls = new Hls();
|
||||
hls.loadSource(videoSrc);
|
||||
hls.attachMedia(video);
|
||||
}
|
||||
Reference in New Issue
Block a user