feat: add HLS playback support with hls.js #1

Merged
kfj001 merged 5 commits from (deleted):master into master 2026-08-10 20:50:43 -07:00
3 changed files with 19 additions and 0 deletions
Showing only changes of commit c59c96ce19 - Show all commits

No files matched your search

+9
View File
@@ -7,6 +7,9 @@
"": { "": {
"name": "goon-plugin", "name": "goon-plugin",
"version": "0.1.0", "version": "0.1.0",
"dependencies": {
"hls.js": "^1.5.17"
},
"devDependencies": { "devDependencies": {
"ajv": "^8.17.1", "ajv": "^8.17.1",
"ajv-formats": "^3.0.1", "ajv-formats": "^3.0.1",
@@ -2781,6 +2784,12 @@
"node": ">= 0.4" "node": ">= 0.4"
} }
}, },
"node_modules/hls.js": {
"version": "1.6.17",
"resolved": "https://registry.npmjs.org/hls.js/-/hls.js-1.6.17.tgz",
"integrity": "sha512-NUplVGVuc1hSPwdB/9/cbRkUmLrYi75/hqiXKdA+l300pJNxDu96R7jRb2imDzWJqIUF4I5ThmAdp9GvOCXsuQ==",
"license": "Apache-2.0"
},
"node_modules/html-encoding-sniffer": { "node_modules/html-encoding-sniffer": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-4.0.0.tgz", "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-4.0.0.tgz",
+3
View File
@@ -13,6 +13,9 @@
"test:watch": "vitest", "test:watch": "vitest",
"check": "tsc --noEmit" "check": "tsc --noEmit"
}, },
"dependencies": {
"hls.js": "^1.5.17"
},
"devDependencies": { "devDependencies": {
"ajv": "^8.17.1", "ajv": "^8.17.1",
"ajv-formats": "^3.0.1", "ajv-formats": "^3.0.1",
+7
View File
@@ -48,6 +48,8 @@ async function playHls(video, manifestUrl) {
video.src = manifestUrl; video.src = manifestUrl;
return; return;
} }
// Clean up any existing HLS instance before creating a new one
destroyHls(video);
const hls = new HLS({ debug: false, enableWorker: true, lowLatencyMode: false }); const hls = new HLS({ debug: false, enableWorker: true, lowLatencyMode: false });
hls.loadSource(manifestUrl); hls.loadSource(manifestUrl);
hls.attachMedia(video); hls.attachMedia(video);
@@ -99,6 +101,11 @@ async function createVideoElement(entry) {
video.src = resolveSrc(entry); video.src = resolveSrc(entry);
} }
// Set poster image so a thumbnail shows before playback begins
if (entry && typeof entry === 'object' && entry.poster) {
video.poster = entry.poster;
}
return video; return video;
} }