master
yin5th 2021-11-23 12:54:37 +08:00
parent 71d9802c11
commit 5a675fc379
2 changed files with 9 additions and 8 deletions

View File

@ -20,19 +20,16 @@
</div> </div>
<!--舞台背景--> <!--舞台背景-->
<div class="stage"> <div class="stage">
<div class="video" > <div class="video">
<video id="mousedown" loop autoplay muted src="image/vd.mp4" ></video> <video id="mousedown" loop autoplay muted src="image/vd.mp4" ></video>
</div> </div>
<!--音乐--> <!--音乐-->
<audio id="music" controls autoplay loop style="z-index: 999; position: fixed;display: none;"> <audio id="music" data-song="顶级 Slow 气派炸街5.0.mp3" controls autoplay loop style="z-index: 999; position: fixed;display: none;">
<source src="http://bili.scdxtc.cn/music/顶级 Slow 气派炸街5.0.mp3" type="audio/mp3"> <source src="http://bili.scdxtc.cn/music/顶级 Slow 气派炸街5.0.mp3" type="audio/mp3">
</audio> </audio>
<!--点击播放音乐--> <!--点击播放音乐-->
<script> <script>
document.body.addEventListener('mousedown', function(){ document.body.addEventListener('mousedown', function(){
// console.log('3333','sss')
// var vdo = $("audio")[0]; //jquery
$('#music')[0].play() $('#music')[0].play()
}, false); }, false);
</script> </script>

View File

@ -63,17 +63,21 @@ function music() {
musicList = res musicList = res
console.log($('#music')[0], '3333') console.log($('#music')[0], '3333')
if (musicList.length > 0) { if (musicList.length > 0) {
$('#music').data('song', musicList[0]) $('#music source').attr('src', 'http://bili.scdxtc.cn/music/'+musicList[15])
// $('#music')[0].attr('src', 'http://bili.scdxtc.cn/music/'+musicList[0])
} }
}) })
} }
// 切歌
function changeMusic() { function changeMusic() {
console.log('切歌')
$.get('http://bili.scdxtc.cn', function (res) { $.get('http://bili.scdxtc.cn', function (res) {
musicList = res musicList = res
if (musicList.length > 0) { if (musicList.length > 0) {
$('#music')[0].attr('src', musicList[0]) let index = Math.floor(Math.random()*(musicList.length-1))
$('#music').data('song', musicList[index])
$('#music source').attr('src', 'http://bili.scdxtc.cn/music/'+musicList[index])
$('#music')[0].load()
} }
}) })
} }