Dplayer参数- 一款非常优秀的开源弹幕H5播放器
- const dp = new DPlayer({
- container: document.getElementById('dplayer'),
- autoplay: false,//自动播放
- live: false,//直播模式
- theme: '#FADFA3',//主题颜色
- loop: true,//循环播放
- lang: 'zh-cn',//语言选择
- screenshot: true,//截图选项
- hotkey: true,//热键开启
- airplay: false,//在 Safari 中开启 AirPlay
- lang: 'zh-cn',//语言
- preload: 'auto',//视频预加载
- logo: 'logo.png',//LOGO
- volume: 0.7,//音量
- mutex: true,//播放器互斥
- video: {//视频参数
- url: 'dplayer.mp4',//视频地址
- pic: 'dplayer.png',//视频封面
- thumbnails: 'thumbnails.jpg',//缩略图
- type: 'auto',//视频类型
- },
- subtitle: {//外挂字幕参数
- url: 'dplayer.vtt',
- type: 'webvtt',
- fontSize: '25px',
- bottom: '10%',
- color: '#b7daff',
- },
- danmaku: {//弹幕参数
- id: '9E2E3368B56CDBB4',
- api: 'https://api.prprpr.me/dplayer/',
- token: 'tokendemo',
- maximum: 1000,
- addition: ['https://api.prprpr.me/dplayer/v3/bilibili?aid=4157142'],
- user: 'DIYgod',
- bottom: '15%',
- unlimited: true,
- speedRate: 0.5,
- },
- contextmenu: [//鼠标右键菜单参数
- {
- text: 'custom1',
- link: 'https://GitHub.com/DIYgod/DPlayer',
- },
- {
- text: 'custom2',
- click: (player) => {
- console.log(player);
- },
- },
- ],
- highlight: [//自定义进度条提示点参数
- {
- time: 20,
- text: '这是第 20 秒',
- },
- {
- time: 120,
- text: '这是 2 分钟',
- },
- ],});
复制代码
|