mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-28 02:01:20 -08:00
Update hls.quality.js
This commit is contained in:
1 parent
46de63b86e
commit
2aa95fd3a8
1 file changed
+4
-18
@@ -17,24 +17,10 @@ var art = new Artplayer({
|
|||||||
],
|
],
|
||||||
customType: {
|
customType: {
|
||||||
m3u8: function (video, url) {
|
m3u8: function (video, url) {
|
||||||
if (Hls.isSupported()) {
|
// Attach the Hls instance to the Artplayer instance
|
||||||
// Destroy the last decoder instance before switching url
|
art.hls = new Hls();
|
||||||
if (art.hls) art.hls.destroy();
|
art.hls.loadSource(url);
|
||||||
|
art.hls.attachMedia(video);
|
||||||
// When the player is destroyed, the decoder instance must also be destroyed
|
|
||||||
art.on('destroy', () => {
|
|
||||||
if (art.hls) art.hls.destroy();
|
|
||||||
});
|
|
||||||
|
|
||||||
// Attach the Hls instance to the Artplayer instance
|
|
||||||
art.hls = new Hls();
|
|
||||||
art.hls.loadSource(url);
|
|
||||||
art.hls.attachMedia(video);
|
|
||||||
} else if (video.canPlayType('application/vnd.apple.mpegurl')) {
|
|
||||||
video.src = url;
|
|
||||||
} else {
|
|
||||||
art.notice.show = 'Does not support playback of m3u8';
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
Reference in new issue
Block a user