Dplayer 实现视频(URL)切换

本文介绍了如何使用DPlayer配置视频播放器,包括设置视频URL、预览图片和缩略图,以及如何调用switchVideo方法切换视频源。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

首先呢,先声明一个,很简单的,然后调用sw()就可以了

<div class="card" style="width:100%;height:60%;margin-top:7.5%;">
		<div id="dplayer" class="background2"></div>
		<script>
			const dp = new DPlayer({
			container: document.getElementById('dplayer'),
			screenshot: true,
			video: {
				url: 'http://static.smartisanos.cn/common/video/t1-ui.mp4',
				pic: 'http://static.smartisanos.cn/pr/img/video/video_03_cc87ce5bdb.jpg',
				thumbnails: 'https://moeplayer.b0.upaiyun.com/dplayer/hikarunara_thumbnails.jpg'
			}
		})function sw(){
			dp.switchVideo({
    url: 'video/背景.mp4',
    pic: 'http://static.smartisanos.cn/pr/img/video/video_03_cc87ce5bdb.jpg',
    thumbnails: 'https://moeplayer.b0.upaiyun.com/dplayer/hikarunara_thumbnails.jpg'
			})
		}
		</script>

 

评论 9
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值