DPlayer 弹幕
2022/5/19小于 1 分钟
介绍
适合 DPlayer 使用的弹幕
示例
点击查看
<div ref="dp"></div>
export default {
mounted() {
this.$nextTick(() => {
import("dplayer").then(({ default: DPlayer }) => {
this.dp = new DPlayer({
container: this.$refs.dp,
video: {
url: "https://danmu.u2sb.com/assets/video/1214946209-1-192.mp4",
},
danmaku: {
api: "https://danmu.u2sb.com/api/dp/bilibili/",
id: "cENuyhsT2rMOCohK",
addition: [
"https://danmu.u2sb.com/api/dp/bilibili/v3/BV1JP41167xK.json",
],
},
});
});
});
},
beforeUnmount() {
this.dp.destroy();
},
};
提示
一定要把 id
改掉,别 TM 傻逼呵呵的直接用我测试视频的 id 直接就写上去了,自己想办法随便生成一个随机字符串。