Update artplayer plugin versions

This commit is contained in:
Harvey Zack committed 2023-11-26 14:05:09 +08:00
1 parent b235f9bbac
commit d8720d3bcf
14 files changed
+366 -257

No files matched your search

+24
View File
@@ -0,0 +1,24 @@
function playMpd(video, url, art) {
if (dashjs.supportsMediaSource()) {
if (art.dash) art.dash.destroy();
const dash = dashjs.MediaPlayer().create();
dash.initialize(video, url, art.option.autoplay);
art.dash = dash;
art.on('destroy', () => dash.destroy());
} else {
art.notice.show = 'Unsupported playback format: mpd';
}
}
var art = new Artplayer({
container: '.artplayer-app',
url: 'https://dash.akamaized.net/akamai/bbb_30fps/bbb_30fps.mpd',
type: 'mpd',
customType: {
mpd: playMpd
},
});
art.on('ready', () => {
console.info(art.dash);
});
+25
View File
@@ -0,0 +1,25 @@
function playFlv(video, url, art) {
if (flvjs.isSupported()) {
if (art.flv) art.flv.destroy();
const flv = flvjs.createPlayer({ type: 'flv', url });
flv.attachMediaElement(video);
flv.load();
art.flv = flv;
art.on('destroy', () => flv.destroy());
} else {
art.notice.show = 'Unsupported playback format: flv';
}
}
var art = new Artplayer({
container: '.artplayer-app',
url: '/assets/sample/video.flv',
type: 'flv',
customType: {
flv: playFlv,
},
});
art.on('ready', () => {
console.info(art.flv);
});
+27
View File
@@ -0,0 +1,27 @@
function playM3u8(video, url, art) {
if (Hls.isSupported()) {
if (art.hls) art.hls.destroy();
const hls = new Hls();
hls.loadSource(url);
hls.attachMedia(video);
art.hls = hls;
art.on('destroy', () => hls.destroy());
} else if (video.canPlayType('application/vnd.apple.mpegurl')) {
video.src = url;
} else {
art.notice.show = 'Unsupported playback format: m3u8';
}
}
var art = new Artplayer({
container: '.artplayer-app',
url: 'https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8',
type: 'm3u8',
customType: {
m3u8: playM3u8,
},
});
art.on('ready', () => {
console.info(art.hls);
});
+31
View File
@@ -0,0 +1,31 @@
function playFlv(video, url, art) {
if (mpegts.isSupported()) {
if (art.flv) art.flv.destroy();
const flv = mpegts.createPlayer({
type: 'flv',
url: url
});
flv.attachMediaElement(video);
flv.load();
flv.play();
art.flv = flv;
art.on('destroy', () => flv.destroy());
} else {
art.notice.show = 'Unsupported playback format: flv';
}
}
var art = new Artplayer({
container: '.artplayer-app',
url: '/assets/sample/video.flv',
type: 'flv',
customType: {
flv: playFlv,
},
});
art.on('ready', () => {
console.info(art.flv);
});