feat: complte media store

This commit is contained in:
Rogee
2024-12-06 15:06:15 +08:00
parent 43bde1e62a
commit 7d446b46c2
10 changed files with 199 additions and 226 deletions

View File

@@ -0,0 +1,46 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
<style>
#videoPlayer {
width: 400px;
height: 300px;
}
</style>
</head>
<body>
<video id="videoPlayer" controls></video>
<script>
// Initialize Hls.js
if (Hls.isSupported()) {
var hls = new Hls();
hls.loadSource('eed0fa530f95531f9fac2a962dfbc7ea/video/index.m3u8');
hls.attachMedia(document.getElementById('videoPlayer'));
hls.on(Hls.Events.MANIFEST_PARSED, function () {
document.getElementById('videoPlayer').play();
});
} else if (document.getElementById('videoPlayer').canPlayType('application/vnd.apple.mpegurl')) {
document.getElementById('videoPlayer').src = 'eed0fa530f95531f9fac2a962dfbc7ea/video/index.m3u8';
}
var isBought = false; // This should be set dynamically based on your application logic
var videoPlayer = document.getElementById('videoPlayer');
videoPlayer.addEventListener('ended', function () {
if (!isBought) {
alert('请购买观看全集。');
}
});
</script>
</body>
</html>