媆媆_ 2023-05-11 10:15 采纳率: 31.8%
浏览 30
已结题

视频播放器Dplayer如何监听切换清晰度

视频播放器Dplayer如何监听切换清晰度
视频播放器Dplayer如何监听切换清晰度

  • 写回答

2条回答 默认 最新

  • 丘比特惩罚陆 Java领域新星创作者 2023-05-11 10:26
    关注
    
    // 监听playbackratechange事件
    const player = new DPlayer({
        container: document.getElementById('dplayer'),
        video: {
            url: 'https://example.com/path/to/video.mp4',
            type: 'auto'
        }
    });
    player.on('playbackratechange', function () {
        console.log('Switch to new quality');
    });
    
    // 监听video:switchQuality事件
    const player = new DPlayer({
        container: document.getElementById('dplayer'),
        video: {
            url: 'https://example.com/path/to/video.mp4',
            quality: [
                {
                    name: '1080P',
                    url: 'https://example.com/path/to/video_1080p.mp4',
                    type: 'normal'
                },
                {
                    name: '720P',
                    url: 'https://example.com/path/to/video_720p.mp4',
                    type: 'normal'
                },
                {
                    name: '480P',
                    url: 'https://example.com/path/to/video_480p.mp4',
                    type: 'normal'
                }
            ]
        }
    });
    player.on('video:switchQuality', function (index) {
        console.log('Switch to quality ' + index);
    });
    
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论 编辑记录
查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 5月26日
  • 已采纳回答 5月18日
  • 创建了问题 5月11日

悬赏问题

  • ¥15 pycharm添加远程解释器报错
  • ¥15 如何让子窗口鼠标滚动独立,不要传递消息给主窗口
  • ¥15 如何能达到用ping0.cc检测成这样?如图
  • ¥15 关于#DMA固件#的问题,请各位专家解答!
  • ¥15 matlab生成的x1图不趋于稳定,之后的图像是稳定的水平线
  • ¥15 请问华为OD岗位的内部职业发展通道都有哪些,以及各个级别晋升的要求
  • ¥20 微信小程序 canvas 问题
  • ¥15 系统 24h2 专业工作站版,浏览文件夹的图库,视频,图片之类的怎样删除?
  • ¥15 怎么把512还原为520格式
  • ¥15 MATLAB的动态模态分解出现错误,以CFX非定常模拟结果为快照