好清纯的女大学生
<style type="text/css">.video-playlist-container {
max-width: 800px;
margin: 15px auto;
font-family: "Microsoft YaHei", sans-serif;
background: #1a1a1a;
border-radius: 10px;
overflow: hidden;
box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}
.video-main {
position: relative;
background: #000;
}
.video-main video {
width: 100%;
display: block;
max-height: 500px;
}
.video-info-bar {
background: linear-gradient(to bottom, rgba(0,0,0,0.7), transparent);
color: #fff;
padding: 15px;
position: absolute;
top: 0;
left: 0;
right: 0;
z-index: 10;
}
.video-title {
font-size: 16px;
font-weight: bold;
margin-bottom: 5px;
}
.video-index {
font-size: 12px;
opacity: 0.8;
}
.video-controls-bar {
display: flex;
justify-content: space-between;
align-items: center;
padding: 10px 15px;
background: #222;
color: #fff;
}
.control-group {
display: flex;
gap: 10px;
align-items: center;
}
.ctrl-btn {
background: #444;
border: none;
color: #fff;
padding: 6px 12px;
border-radius: 4px;
cursor: pointer;
font-size: 12px;
}
.ctrl-btn:hover { background: #666; }
.ctrl-btn.active { background: #e74c3c; }
.playlist {
max-height: 280px;
overflow-y: auto;
background: #1a1a1a;
}
.playlist-item {
display: flex;
align-items: center;
padding: 12px 15px;
border-bottom: 1px solid #333;
cursor: pointer;
transition: all 0.2s;
color: #ccc;
}
.playlist-item:hover { background: #2a2a2a; }
.playlist-item.playing {
background: linear-gradient(90deg, #c0392b 0%, #e74c3c 100%);
color: #fff;
}
.playlist-item.played { opacity: 0.6; }
.item-index {
width: 28px;
height: 28px;
border-radius: 50%;
background: #333;
display: flex;
align-items: center;
justify-content: center;
font-size: 12px;
margin-right: 12px;
flex-shrink: 0;
}
.playlist-item.playing .item-index {
background: #fff;
color: #e74c3c;
}
.item-info { flex: 1; }
.item-title {
font-size: 14px;
margin-bottom: 3px;
}
.item-duration {
font-size: 11px;
opacity: 0.7;
}
.playing-indicator {
margin-left: 10px;
font-size: 12px;
}
.playlist::-webkit-scrollbar { width: 6px; }
.playlist::-webkit-scrollbar-track { background: #1a1a1a; }
.playlist::-webkit-scrollbar-thumb { background: #555; border-radius: 3px; }
@media (max-width: 600px) {
.video-title { font-size: 14px; }
.playlist-item { padding: 10px; }
}
</style>
<div class="video-playlist-container">
<div class="video-main">
<div class="video-info-bar">
<div class="video-title" id="videoTitle">视频标题</div>
<div class="video-index" id="videoIndex">第 1 集 / 共 N 集</div>
</div>
<video id="mainVideo" controls preload="metadata" playsinline webkit-playsinline>
您的浏览器不支持HTML5视频播放,请升级浏览器。
</video>
</div>
<div class="video-controls-bar">
<div class="control-group">
<button class="ctrl-btn" onclick="prevVideo()">⏮ 上一集</button>
<button class="ctrl-btn" onclick="nextVideo()">下一集 ⏭</button>
</div>
<div class="control-group">
<button class="ctrl-btn active" id="autoPlayBtn" onclick="toggleAutoPlay()">🔁 连播: 开</button>
<button class="ctrl-btn" id="loopBtn" onclick="toggleLoop()">🔂 循环: 关</button>
</div>
</div>
<div class="playlist" id="playlist"></div>
</div>
<script type="text/javascript">
// ======== 视频列表配置(替换为你自己的视频地址)========
var videoList = [
{
title: "第01集",
url: "https://hefollo.com/%E6%8A%96%E9%9F%B3/%E7%AB%96%E5%B1%8F/7158425210843188511.mp4",
duration: ""
},
{
title: "第02集",
url: "https://hefollo.com/%E6%8A%96%E9%9F%B3/%E7%AB%96%E5%B1%8F/7245109137271524664.mp4",
duration: ""
},
{
title: "第03集",
url: "https://hefollo.com/%E6%8A%96%E9%9F%B3/%E7%AB%96%E5%B1%8F/7241797730757037352.mp4",
duration: ""
},
{
title: "第04集",
url: "https://hefollo.com/%E6%8A%96%E9%9F%B3/%E7%AB%96%E5%B1%8F/7383272360176061731.mp4",
duration: ""
},
{
title: "第05集",
url: "https://hefollo.com/%E6%8A%96%E9%9F%B3/%E7%AB%96%E5%B1%8F/7387295145672183052.mp4",
duration: ""
},
{
title: "第06集",
url: "https://hefollo.com/%E6%8A%96%E9%9F%B3/%E7%AB%96%E5%B1%8F/7459335878687689999.mp4",
duration: ""
}
// 按此格式继续添加更多视频即可
];
// ========================================================
var currentIndex = 0;
var autoPlayNext = true;
var loopAll = false;
var video = document.getElementById('mainVideo');
var playlistEl = document.getElementById('playlist');
function initPlaylist() {
playlistEl.innerHTML = '';
for (var i = 0; i < videoList.length; i++) {
var item = document.createElement('div');
item.className = 'playlist-item' + (i === 0 ? ' playing' : '');
item.setAttribute('data-index', i);
item.innerHTML =
'<div class="item-index">' + (i + 1) + '</div>' +
'<div class="item-info">' +
'<div class="item-title">' + videoList.title + '</div>' +
'<div class="item-duration">' + (videoList.duration || '') + '</div>' +
'</div>' +
'<div class="playing-indicator">' + (i === 0 ? '▶ 播放中' : '') + '</div>';
item.onclick = (function(idx) {
return function() { playVideo(idx); };
})(i);
playlistEl.appendChild(item);
}
}
function playVideo(index) {
if (index < 0) index = loopAll ? videoList.length - 1 : 0;
if (index >= videoList.length) index = loopAll ? 0 : videoList.length - 1;
currentIndex = index;
var item = videoList;
video.src = item.url;
video.load();
video.play().catch(function(e) {});
document.getElementById('videoTitle').textContent = item.title;
document.getElementById('videoIndex').textContent = '第 ' + (index + 1) + ' 集 / 共 ' + videoList.length + ' 集';
var items = playlistEl.querySelectorAll('.playlist-item');
for (var i = 0; i < items.length; i++) {
items.className = 'playlist-item';
var indicator = items.querySelector('.playing-indicator');
indicator.textContent = '';
if (i < index) items.className += ' played';
if (i === index) {
items.className += ' playing';
indicator.textContent = '▶ 播放中';
}
}
}
function nextVideo() {
if (currentIndex < videoList.length - 1) playVideo(currentIndex + 1);
else if (loopAll) playVideo(0);
}
function prevVideo() {
if (currentIndex > 0) playVideo(currentIndex - 1);
else if (loopAll) playVideo(videoList.length - 1);
}
function toggleAutoPlay() {
autoPlayNext = !autoPlayNext;
var btn = document.getElementById('autoPlayBtn');
btn.textContent = autoPlayNext ? '🔁 连播: 开' : '🔁 连播: 关';
btn.className = 'ctrl-btn' + (autoPlayNext ? ' active' : '');
}
function toggleLoop() {
loopAll = !loopAll;
var btn = document.getElementById('loopBtn');
btn.textContent = loopAll ? '🔂 循环: 开' : '🔂 循环: 关';
btn.className = 'ctrl-btn' + (loopAll ? ' active' : '');
}
video.addEventListener('ended', function() {
if (autoPlayNext) {
if (currentIndex < videoList.length - 1) nextVideo();
else if (loopAll) playVideo(0);
}
});
initPlaylist();
playVideo(0);
</script>
页:
[1]