杨帆 发表于 2025-3-31 08:08

趣说动物

本帖最后由 杨帆 于 2025-3-31 08:16 编辑 <br /><br /><style>
#papa{
      margin: 130px -340px;
        width: 1286px;
        height: 720px;
        background: auto;
        pointer-events: auto;
        overflow: hidden;
        position: relative;
        border: 1px solid rgba(36, 201, 219,.95);
      border-radius: 32px;z-index:1;       
}

#myPlayer {
        position: absolute;
}
.controls1{
        position: absolute;
        bottom:1px;
        left:42%;
        padding: 6px;
        background: green;
        color: white;
        border: 2px solid white;
        border-radius: 8px;
        cursor: pointer;
        pointer-events: auto;
        z-index: 1;
      opacity: 0;
}
#papa:hover .controls1{ opacity: 1;}
</style>
<div id="papa">
<div id="videoContainer">
<video id="myPlayer" controls width="100%" height="auto"></video>
</div>
<div class="controls1">
<button onclick="playPause()">播放/暂停</button>
<button onclick="prevVideo()">上一个</button>
<button onclick="nextVideo()">下一个</button>
</div></div>
<script>
const playlist = [
'https://cccimg.com/view.php/ee868160b62ced6157805a5cb3471ad0.mp4',
'https://cccimg.com/view.php/c2345712dc789446ea2de239f423cf41.mp4'
];

let currentIndex = 0;
const player = document.getElementById('myPlayer');

function initPlayer() {
player.src = playlist;
player.load();
}

player.addEventListener('ended', () => {
if(currentIndex < playlist.length-1) {
    currentIndex++;
    player.src = playlist;
    player.play();
}
});

function playPause() {
player.paused ? player.play() : player.pause();
}

function prevVideo() {
if(currentIndex > 0) {
    currentIndex--;
    player.src = playlist;
    player.play();
}
}

function nextVideo() {
if(currentIndex < playlist.length-1) {
    currentIndex++;
    player.src = playlist;
    player.play();
}
}

initPlayer();
</script>

庶民 发表于 2025-3-31 09:11

真的有趣。

梦江南 发表于 2025-3-31 16:55

有点恐怖。

杨帆 发表于 2025-3-31 17:46

本帖最后由 杨帆 于 2025-3-31 17:48 编辑

庶民 发表于 2025-3-31 09:11
真的有趣。
呵呵,谢谢观赏

杨帆 发表于 2025-3-31 17:47

梦江南 发表于 2025-3-31 16:55
有点恐怖。
呵呵,本来如此,谢谢观赏{:4_204:}

红影 发表于 2025-3-31 18:54

这个配音很滑稽。残酷的动物世界。{:4_187:}

红影 发表于 2025-3-31 18:54

感谢杨帆带来的好帖{:4_187:}

杨帆 发表于 2025-3-31 18:58

红影 发表于 2025-3-31 18:54
这个配音很滑稽。残酷的动物世界。

是,谢谢影子欣赏、鼓励{:4_204:}

红影 发表于 2025-3-31 21:35

杨帆 发表于 2025-3-31 18:58
是,谢谢影子欣赏、鼓励

其实看动物世界觉得挺残酷的,但是没办法,都是为了活着。
页: [1]
查看完整版本: 趣说动物