mirror of
https://github.com/DIYgod/DPlayer
synced 2024-11-22 18:56:54 +00:00
update README: bilibili 弹幕及直链支持
This commit is contained in:
parent
dda08cb959
commit
102f47f3d2
34
README.md
34
README.md
@ -94,7 +94,11 @@ var option = {
|
||||
+ `ended`: Triggered when DPlayer ended
|
||||
+ `error`: Triggered when an error occurs
|
||||
|
||||
**Bilibili 弹幕支持**
|
||||
**bilibili 弹幕及直链支持**
|
||||
|
||||
弹幕
|
||||
|
||||
API: `https://dplayer.daoapp.io/bilibili?aid=【bilibili视频AV号】`
|
||||
|
||||
```JS
|
||||
var option = {
|
||||
@ -105,6 +109,34 @@ var option = {
|
||||
}
|
||||
```
|
||||
|
||||
直链
|
||||
|
||||
API: `https://dplayer.daoapp.io/video/bilibili?aid=【bilibili视频AV号】`
|
||||
|
||||
```JS
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.onreadystatechange = function () {
|
||||
if (xhr.readyState === 4) {
|
||||
if (xhr.status >= 200 && xhr.status < 300 || xhr.status === 304) {
|
||||
var response = JSON.parse(xhr.responseText);
|
||||
var dp1 = new DPlayer({
|
||||
// options
|
||||
screenshot: false,
|
||||
video: {
|
||||
url: response.durl[0].url
|
||||
// options
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
console.log('Request was unsuccessful: ' + xhr.status);
|
||||
}
|
||||
}
|
||||
};
|
||||
xhr.open('get', 'https://dplayer.daoapp.io/video/bilibili?aid=【bilibili视频AV号】', true);
|
||||
xhr.send(null);
|
||||
```
|
||||
|
||||
**Live Video (HTTP Live Streaming, M3U8 format)**
|
||||
|
||||
It requires the library [hls.js](https://github.com/dailymotion/hls.js) and it should be loaded before DPlayer.min.js.
|
||||
|
Loading…
Reference in New Issue
Block a user