fixed a bug on the web player
This commit is contained in:
@@ -354,8 +354,27 @@ const AnimePlayer = (function() {
|
||||
}
|
||||
|
||||
function initVideoPlayer(url, type, subtitles = []) {
|
||||
const video = els.video;
|
||||
Array.from(video.querySelectorAll('track')).forEach(t => t.remove());
|
||||
if (plyrInstance) {
|
||||
plyrInstance.destroy();
|
||||
plyrInstance = null;
|
||||
}
|
||||
if (hlsInstance) {
|
||||
hlsInstance.destroy();
|
||||
hlsInstance = null;
|
||||
}
|
||||
|
||||
const container = document.querySelector('.video-frame');
|
||||
|
||||
container.innerHTML = '';
|
||||
|
||||
const newVideo = document.createElement('video');
|
||||
newVideo.id = 'player';
|
||||
newVideo.controls = true;
|
||||
newVideo.crossOrigin = 'anonymous';
|
||||
newVideo.playsInline = true;
|
||||
|
||||
container.appendChild(newVideo);
|
||||
els.video = newVideo;
|
||||
|
||||
if (Hls.isSupported() && (type === 'm3u8' || url.includes('.m3u8'))) {
|
||||
console.log("Using HLS.js");
|
||||
|
||||
Reference in New Issue
Block a user