Spaces:
Paused

Download / PlyrPlayer.html
LiveSportmm's picture
Update PlyrPlayer.html
b5dd35f verified
Raw History Blame Contribute Delete
5.18 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Plyr Player (M3U8 & FLV Support)</title>
<!-- Libraries -->
<script src="https://cdn.jsdelivr.net/npm/flv.js/dist/flv.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
<!-- Plyr Player CSS & JS -->
<link rel="stylesheet" href="https://cdn.plyr.io/3.7.8/plyr.css" />
<script src="https://cdn.plyr.io/3.7.8/plyr.js"></script>
<style>
body { margin: 0; padding: 0; background-color: #111; font-family: sans-serif; }
/* Player Container Styling */
.player-wrapper {
width: 100%;
height: 60vh; /* Player height */
background: #000;
display: flex;
justify-content: center;
align-items: center;
}
/* Adjust Plyr full height to fit wrapper */
.plyr {
width: 100%;
height: 100%;
}
/* Button Container */
.button-container {
display: flex;
flex-direction: column;
align-items: center;
gap: 15px;
padding: 20px;
}
/* Color Running Button Styling */
.running-btn {
width: 90%;
max-width: 400px;
padding: 12px;
border: none;
border-radius: 8px;
color: white;
font-size: 16px;
font-weight: bold;
text-decoration: none;
text-align: center;
cursor: pointer;
/* Gradient Animation */
background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
background-size: 400% 400%;
animation: gradientBG 5s ease infinite;
box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}
@keyframes gradientBG {
0% { background-position: 0% 50%; }
50% { background-position: 100% 50%; }
100% { background-position: 0% 50%; }
}
.running-btn:active {
transform: scale(0.98);
}
</style>
</head>
<body>
<!-- Video Player Wrapper -->
<div class="player-wrapper">
<video id="player" playsinline controls></video>
</div>
<!-- Buttons -->
<div class="button-container">
<a href="https://t.me/S4MMTV/2794?single" class="running-btn" target="_blank">
For More Watching
</a>
<a href="https://m-sport-download.static.hf.space/" class="running-btn" target="_blank">
Download APK Now
</a>
</div>
<script>
const urlParams = new URLSearchParams(window.location.search);
const streamUrl = urlParams.get('url');
const videoElement = document.getElementById('player');
// Common Plyr Options
const plyrOptions = {
controls: [
'play-large', 'play', 'progress', 'current-time',
'mute', 'volume', 'settings', 'pip', 'fullscreen'
],
settings: ['quality', 'speed']
};
if (streamUrl) {
const isM3u8 = streamUrl.toLowerCase().includes('.m3u8');
if (isM3u8) {
// ---- M3U8 (HLS) Playback Logic ----
if (Hls.isSupported()) {
const hls = new Hls();
hls.loadSource(streamUrl);
hls.attachMediaElement(videoElement);
// Initialize Plyr
const player = new Plyr(videoElement, plyrOptions);
}
// Native HLS support for Safari
else if (videoElement.canPlayType('application/vnd.apple.mpegurl')) {
videoElement.src = streamUrl;
const player = new Plyr(videoElement, plyrOptions);
} else {
document.querySelector('.player-wrapper').innerHTML = '<h3 style="color:white; text-align:center;">HLS (M3U8) is not supported on this browser.</h3>';
}
} else {
// ---- FLV Playback Logic (Fallback) ----
if (flvjs.isSupported()) {
const flvPlayer = flvjs.createPlayer({
type: 'flv',
url: streamUrl,
isLive: true,
});
flvPlayer.attachMediaElement(videoElement);
flvPlayer.load();
// Initialize Plyr
const player = new Plyr(videoElement, plyrOptions);
} else {
document.querySelector('.player-wrapper').innerHTML = '<h3 style="color:white; text-align:center;">FLV Format is not supported on this browser.</h3>';
}
}
} else {
document.querySelector('.player-wrapper').innerHTML = '<h3 style="color:white; text-align:center;">Please add ?url= link in address bar</h3>';
}
</script>
</body>
</html>