From 96e098936e6c39de2c7744c5d8c9f45b59d81f7f Mon Sep 17 00:00:00 2001 From: shiyiya Date: Sun, 2 Jun 2024 10:28:53 +0800 Subject: [PATCH] again --- examples/standalone/main.ts | 2 +- packages/torrent/src/index.ts | 6 +----- packages/ui/src/components/Subtitle.ts | 12 ++---------- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/examples/standalone/main.ts b/examples/standalone/main.ts index 4ef04a45..33224232 100644 --- a/examples/standalone/main.ts +++ b/examples/standalone/main.ts @@ -105,7 +105,7 @@ const player = Player.make('#player', { source: DANMAKU //SUPER_DANMAKU }), new Playlist({ - initialIndex, + initialIndex: 7, sources: [ { title: 'HLS with SRT subtitle', diff --git a/packages/torrent/src/index.ts b/packages/torrent/src/index.ts index 33872a78..cbc478af 100644 --- a/packages/torrent/src/index.ts +++ b/packages/torrent/src/index.ts @@ -51,11 +51,7 @@ class TorrentPlugin implements PlayerPlugin { torrent.files.forEach((file) => { if (!foundMp4 && file.name.endsWith('.mp4') && file.renderTo) { foundMp4 = true - file.renderTo($video, { - autoplay: $video.autoplay, - controls: false, - maxBlobLength: 2 * 1024 * 1000 * 1000 // 2 GB - }) + file.renderTo($video) this.player.once('loadedmetadata', (e) => { this.player.emit('canplay', e) }) diff --git a/packages/ui/src/components/Subtitle.ts b/packages/ui/src/components/Subtitle.ts index e68d5dde..28feff70 100644 --- a/packages/ui/src/components/Subtitle.ts +++ b/packages/ui/src/components/Subtitle.ts @@ -217,18 +217,10 @@ export class Subtitle { const { src, encoding, type = 'auto' } = currentSubtitle if (src.startsWith('blob:')) { - $track.addEventListener( - 'load', - () => { - this.changeOffset() - this.show() - }, - { once: true } - ) - + this.changeOffset() + this.show() $track.src = src $iosTrack && ($iosTrack.src = src) - return }