update docs

This commit is contained in:
Harvey committed 2022-05-17 12:32:09 +08:00
1 parent 7330c0224c
commit f83e8a01fc
48 files changed
+215 -170

No files matched your search

@@ -8,7 +8,9 @@ slug: /libraries
- Homepage: [https://github.com/Bilibili/flv.js](https://github.com/Bilibili/flv.js)
<div className="run-code" data-libs="https://cdn.jsdelivr.net/npm/flv.js@1.6.2/dist/flv.min.js">▶ Run Code</div>
<div className="run-code" data-libs="https://cdn.jsdelivr.net/npm/flv.js@1.6.2/dist/flv.min.js">
▶ Run Code
</div>
```js
var art = new Artplayer({
@@ -17,12 +19,16 @@ var art = new Artplayer({
url: '/assets/sample/video.flv',
customType: {
flv: function (video, url) {
const flvPlayer = flvjs.createPlayer({
type: 'flv',
url: url,
});
flvPlayer.attachMediaElement(video);
flvPlayer.load();
if (flvjs.isSupported()) {
const flvPlayer = flvjs.createPlayer({
type: 'flv',
url: url,
});
flvPlayer.attachMediaElement(video);
flvPlayer.load();
} else {
art.notice.show = 'Does not support playback of flv';
}
},
},
});
@@ -32,7 +38,9 @@ var art = new Artplayer({
- Homepage: [https://github.com/video-dev/hls.js](https://github.com/video-dev/hls.js)
<div className="run-code" data-libs="https://cdn.jsdelivr.net/npm/hls.js@1.1.1/dist/hls.min.js">▶ Run Code</div>
<div className="run-code" data-libs="https://cdn.jsdelivr.net/npm/hls.js@1.1.1/dist/hls.min.js">
▶ Run Code
</div>
```js
var art = new Artplayer({
@@ -41,9 +49,18 @@ var art = new Artplayer({
url: 'https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8',
customType: {
m3u8: function (video, url) {
var hls = new Hls();
hls.loadSource(url);
hls.attachMedia(video);
if (Hls.isSupported()) {
const hls = new Hls();
hls.loadSource(url);
hls.attachMedia(video);
} else {
const canPlay = video.canPlayType('application/vnd.apple.mpegurl');
if (canPlay === 'probably' || canPlay == 'maybe') {
video.src = url;
} else {
art.notice.show = 'Does not support playback of m3u8';
}
}
},
},
});
@@ -53,7 +70,9 @@ var art = new Artplayer({
- Homepage: [https://github.com/Dash-Industry-Forum/dash.js](https://github.com/Dash-Industry-Forum/dash.js)
<div className="run-code" data-libs="https://cdn.jsdelivr.net/npm/dashjs@4.1.0/dist/dash.all.debug.min.js">▶ Run Code</div>
<div className="run-code" data-libs="https://cdn.jsdelivr.net/npm/dashjs@4.1.0/dist/dash.all.debug.min.js">
▶ Run Code
</div>
```js
var art = new Artplayer({
@@ -73,7 +92,9 @@ var art = new Artplayer({
- Homepage: [https://github.com/google/shaka-player](https://github.com/google/shaka-player)
<div className="run-code" data-libs="https://cdn.jsdelivr.net/npm/shaka-player@3.2.1/dist/shaka-player.compiled.min.js">▶ Run Code</div>
<div className="run-code" data-libs="https://cdn.jsdelivr.net/npm/shaka-player@3.2.1/dist/shaka-player.compiled.min.js">
▶ Run Code
</div>
```js
var art = new Artplayer({
@@ -94,14 +115,15 @@ var art = new Artplayer({
- Homepage: [https://github.com/webtorrent/webtorrent](https://github.com/webtorrent/webtorrent)
<div className="run-code" data-libs="https://cdn.jsdelivr.net/npm/webtorrent@1.5.8/webtorrent.min.js">▶ Run Code</div>
<div className="run-code" data-libs="https://cdn.jsdelivr.net/npm/webtorrent@1.5.8/webtorrent.min.js">
▶ Run Code
</div>
```js
var art = new Artplayer({
container: '.artplayer-app',
autoplay: true,
url:
'magnet:?xt=urn:btih:6a9759bffd5c0af65319979fb7832189f4f3c35d&dn=sintel.mp4&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.fastcast.nz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com&tr=wss%3A%2F%2Ftracker.webtorrent.io&ws=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2Fsintel-1024-surround.mp4',
url: 'magnet:?xt=urn:btih:6a9759bffd5c0af65319979fb7832189f4f3c35d&dn=sintel.mp4&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.fastcast.nz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com&tr=wss%3A%2F%2Ftracker.webtorrent.io&ws=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2Fsintel-1024-surround.mp4',
type: 'torrent',
customType: {
torrent: function (video, url, art) {
@@ -8,7 +8,9 @@ slug: /zh-cn/libraries
- 主页: [https://github.com/Bilibili/flv.js](https://github.com/Bilibili/flv.js)
<div className="run-code" data-libs="https://cdn.jsdelivr.net/npm/flv.js@1.6.2/dist/flv.min.js">▶ Run Code</div>
<div className="run-code" data-libs="https://cdn.jsdelivr.net/npm/flv.js@1.6.2/dist/flv.min.js">
▶ Run Code
</div>
```js
var art = new Artplayer({
@@ -17,12 +19,16 @@ var art = new Artplayer({
url: '/assets/sample/video.flv',
customType: {
flv: function (video, url) {
const flvPlayer = flvjs.createPlayer({
type: 'flv',
url: url,
});
flvPlayer.attachMediaElement(video);
flvPlayer.load();
if (flvjs.isSupported()) {
const flvPlayer = flvjs.createPlayer({
type: 'flv',
url: url,
});
flvPlayer.attachMediaElement(video);
flvPlayer.load();
} else {
art.notice.show = '不支持播放格式:flv';
}
},
},
});
@@ -32,7 +38,9 @@ var art = new Artplayer({
- 主页: [https://github.com/video-dev/hls.js](https://github.com/video-dev/hls.js)
<div className="run-code" data-libs="https://cdn.jsdelivr.net/npm/hls.js@1.1.1/dist/hls.min.js">▶ Run Code</div>
<div className="run-code" data-libs="https://cdn.jsdelivr.net/npm/hls.js@1.1.1/dist/hls.min.js">
▶ Run Code
</div>
```js
var art = new Artplayer({
@@ -41,9 +49,18 @@ var art = new Artplayer({
url: 'https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8',
customType: {
m3u8: function (video, url) {
var hls = new Hls();
hls.loadSource(url);
hls.attachMedia(video);
if (Hls.isSupported()) {
const hls = new Hls();
hls.loadSource(url);
hls.attachMedia(video);
} else {
const canPlay = video.canPlayType('application/vnd.apple.mpegurl');
if (canPlay === 'probably' || canPlay == 'maybe') {
video.src = url;
} else {
art.notice.show = '不支持播放格式:m3u8';
}
}
},
},
});
@@ -53,7 +70,9 @@ var art = new Artplayer({
- 主页: [https://github.com/Dash-Industry-Forum/dash.js](https://github.com/Dash-Industry-Forum/dash.js)
<div className="run-code" data-libs="https://cdn.jsdelivr.net/npm/dashjs@4.1.0/dist/dash.all.debug.min.js">▶ Run Code</div>
<div className="run-code" data-libs="https://cdn.jsdelivr.net/npm/dashjs@4.1.0/dist/dash.all.debug.min.js">
▶ Run Code
</div>
```js
var art = new Artplayer({
@@ -73,7 +92,9 @@ var art = new Artplayer({
- 主页: [https://github.com/google/shaka-player](https://github.com/google/shaka-player)
<div className="run-code" data-libs="https://cdn.jsdelivr.net/npm/shaka-player@3.2.1/dist/shaka-player.compiled.min.js">▶ Run Code</div>
<div className="run-code" data-libs="https://cdn.jsdelivr.net/npm/shaka-player@3.2.1/dist/shaka-player.compiled.min.js">
▶ Run Code
</div>
```js
var art = new Artplayer({
@@ -94,14 +115,15 @@ var art = new Artplayer({
- 主页: [https://github.com/webtorrent/webtorrent](https://github.com/webtorrent/webtorrent)
<div className="run-code" data-libs="https://cdn.jsdelivr.net/npm/webtorrent@1.5.8/webtorrent.min.js">▶ Run Code</div>
<div className="run-code" data-libs="https://cdn.jsdelivr.net/npm/webtorrent@1.5.8/webtorrent.min.js">
▶ Run Code
</div>
```js
var art = new Artplayer({
container: '.artplayer-app',
autoplay: true,
url:
'magnet:?xt=urn:btih:6a9759bffd5c0af65319979fb7832189f4f3c35d&dn=sintel.mp4&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.fastcast.nz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com&tr=wss%3A%2F%2Ftracker.webtorrent.io&ws=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2Fsintel-1024-surround.mp4',
url: 'magnet:?xt=urn:btih:6a9759bffd5c0af65319979fb7832189f4f3c35d&dn=sintel.mp4&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.fastcast.nz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com&tr=wss%3A%2F%2Ftracker.webtorrent.io&ws=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2Fsintel-1024-surround.mp4',
type: 'torrent',
customType: {
torrent: function (video, url, art) {