成长值: 342 签到天数: 4739 天 [LV.Master]伴坛终老
|
发表于 2020/8/3 18:23
|
显示全部楼层
|阅读模式
|Google Chrome 84.0.4147.105 |Windows 10
DPlayer只是一个视频播放器,并不直接负责网络请求
可以参考以下代码:
- let request = new XMLHttpRequest();
- request.responseType = 'blob';
- request.open('get', 'map4 url', true);
- request.setRequestHeader('Authorization', `123456`);
- request.onreadystatechange = e => {
- if (request.readyState === XMLHttpRequest.DONE && request.status === 200) {
- const dp = new DPlayer({
- container: document.getElementById('dplayer'),
- video: {
- url: URL.createObjectURL(request.response),
- },
- });
- }
- };
- request.send(null);
复制代码
https://github.com/MoePlayer/DPlayer/issues/956 |
|