@scarlett-player/hls 0.2.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-CBBDW7UR.js → chunk-I4BGO7UY.js} +4 -0
- package/dist/index.cjs +24 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +23 -2
- package/dist/light.cjs +24 -1
- package/dist/light.d.cts +2 -2
- package/dist/light.d.ts +2 -2
- package/dist/light.js +23 -2
- package/dist/{types-Co8zOXVb.d.cts → types-Df2TUpPu.d.cts} +1 -1
- package/dist/{types-Co8zOXVb.d.ts → types-Df2TUpPu.d.ts} +1 -1
- package/package.json +2 -2
|
@@ -149,6 +149,9 @@ function setupVideoEventHandlers(video, api) {
|
|
|
149
149
|
video.addEventListener(event, handler);
|
|
150
150
|
handlers.push({ event, handler });
|
|
151
151
|
};
|
|
152
|
+
addHandler("play", () => {
|
|
153
|
+
api.setState("paused", false);
|
|
154
|
+
});
|
|
152
155
|
addHandler("playing", () => {
|
|
153
156
|
api.setState("playing", true);
|
|
154
157
|
api.setState("paused", false);
|
|
@@ -257,6 +260,7 @@ function setupVideoEventHandlers(video, api) {
|
|
|
257
260
|
}
|
|
258
261
|
|
|
259
262
|
export {
|
|
263
|
+
formatLevel,
|
|
260
264
|
mapLevels,
|
|
261
265
|
setupHlsEventHandlers,
|
|
262
266
|
setupVideoEventHandlers
|
package/dist/index.cjs
CHANGED
|
@@ -238,6 +238,9 @@ function setupVideoEventHandlers(video, api) {
|
|
|
238
238
|
video.addEventListener(event, handler);
|
|
239
239
|
handlers.push({ event, handler });
|
|
240
240
|
};
|
|
241
|
+
addHandler("play", () => {
|
|
242
|
+
api.setState("paused", false);
|
|
243
|
+
});
|
|
241
244
|
addHandler("playing", () => {
|
|
242
245
|
api.setState("playing", true);
|
|
243
246
|
api.setState("paused", false);
|
|
@@ -386,7 +389,7 @@ function createHLSPlugin(config) {
|
|
|
386
389
|
return video;
|
|
387
390
|
}
|
|
388
391
|
video = document.createElement("video");
|
|
389
|
-
video.style.cssText = "width:100%;height:100%;display:block;object-fit:contain;background:#000";
|
|
392
|
+
video.style.cssText = "position:absolute;top:0;left:0;width:100%;height:100%;display:block;object-fit:contain;background:#000";
|
|
390
393
|
video.preload = "metadata";
|
|
391
394
|
video.controls = false;
|
|
392
395
|
video.playsInline = true;
|
|
@@ -654,6 +657,20 @@ function createHLSPlugin(config) {
|
|
|
654
657
|
if (!isNaN(levelIndex) && levelIndex >= 0 && levelIndex < hls.levels.length) {
|
|
655
658
|
hls.nextLevel = levelIndex;
|
|
656
659
|
api?.logger.debug(`Quality: queued switch to level ${levelIndex}`);
|
|
660
|
+
const targetLevel = hls.levels[levelIndex];
|
|
661
|
+
if (targetLevel) {
|
|
662
|
+
const label = formatLevel(targetLevel);
|
|
663
|
+
api?.setState("currentQuality", {
|
|
664
|
+
id: `level-${levelIndex}`,
|
|
665
|
+
label: `${label}...`,
|
|
666
|
+
// Ellipsis indicates switching in progress
|
|
667
|
+
width: targetLevel.width,
|
|
668
|
+
height: targetLevel.height,
|
|
669
|
+
bitrate: targetLevel.bitrate,
|
|
670
|
+
active: false
|
|
671
|
+
// Not yet active
|
|
672
|
+
});
|
|
673
|
+
}
|
|
657
674
|
}
|
|
658
675
|
}
|
|
659
676
|
});
|
|
@@ -692,6 +709,12 @@ function createHLSPlugin(config) {
|
|
|
692
709
|
} else {
|
|
693
710
|
throw new Error("HLS playback not supported in this browser");
|
|
694
711
|
}
|
|
712
|
+
if (video) {
|
|
713
|
+
const muted = api.getState("muted");
|
|
714
|
+
const volume = api.getState("volume");
|
|
715
|
+
if (muted !== void 0) video.muted = muted;
|
|
716
|
+
if (volume !== void 0) video.volume = volume;
|
|
717
|
+
}
|
|
695
718
|
api.setState("playbackState", "ready");
|
|
696
719
|
api.setState("buffering", false);
|
|
697
720
|
},
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { H as HLSPluginConfig, I as IHLSPlugin } from './types-
|
|
2
|
-
export {
|
|
1
|
+
import { H as HLSPluginConfig, I as IHLSPlugin } from './types-Df2TUpPu.cjs';
|
|
2
|
+
export { a as HLSError, b as HLSLiveInfo, c as HLSQualityLevel } from './types-Df2TUpPu.cjs';
|
|
3
3
|
import '@scarlett-player/core';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { H as HLSPluginConfig, I as IHLSPlugin } from './types-
|
|
2
|
-
export {
|
|
1
|
+
import { H as HLSPluginConfig, I as IHLSPlugin } from './types-Df2TUpPu.js';
|
|
2
|
+
export { a as HLSError, b as HLSLiveInfo, c as HLSQualityLevel } from './types-Df2TUpPu.js';
|
|
3
3
|
import '@scarlett-player/core';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
+
formatLevel,
|
|
2
3
|
mapLevels,
|
|
3
4
|
setupHlsEventHandlers,
|
|
4
5
|
setupVideoEventHandlers
|
|
5
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-I4BGO7UY.js";
|
|
6
7
|
|
|
7
8
|
// src/hls-loader.ts
|
|
8
9
|
var hlsConstructor = null;
|
|
@@ -97,7 +98,7 @@ function createHLSPlugin(config) {
|
|
|
97
98
|
return video;
|
|
98
99
|
}
|
|
99
100
|
video = document.createElement("video");
|
|
100
|
-
video.style.cssText = "width:100%;height:100%;display:block;object-fit:contain;background:#000";
|
|
101
|
+
video.style.cssText = "position:absolute;top:0;left:0;width:100%;height:100%;display:block;object-fit:contain;background:#000";
|
|
101
102
|
video.preload = "metadata";
|
|
102
103
|
video.controls = false;
|
|
103
104
|
video.playsInline = true;
|
|
@@ -365,6 +366,20 @@ function createHLSPlugin(config) {
|
|
|
365
366
|
if (!isNaN(levelIndex) && levelIndex >= 0 && levelIndex < hls.levels.length) {
|
|
366
367
|
hls.nextLevel = levelIndex;
|
|
367
368
|
api?.logger.debug(`Quality: queued switch to level ${levelIndex}`);
|
|
369
|
+
const targetLevel = hls.levels[levelIndex];
|
|
370
|
+
if (targetLevel) {
|
|
371
|
+
const label = formatLevel(targetLevel);
|
|
372
|
+
api?.setState("currentQuality", {
|
|
373
|
+
id: `level-${levelIndex}`,
|
|
374
|
+
label: `${label}...`,
|
|
375
|
+
// Ellipsis indicates switching in progress
|
|
376
|
+
width: targetLevel.width,
|
|
377
|
+
height: targetLevel.height,
|
|
378
|
+
bitrate: targetLevel.bitrate,
|
|
379
|
+
active: false
|
|
380
|
+
// Not yet active
|
|
381
|
+
});
|
|
382
|
+
}
|
|
368
383
|
}
|
|
369
384
|
}
|
|
370
385
|
});
|
|
@@ -403,6 +418,12 @@ function createHLSPlugin(config) {
|
|
|
403
418
|
} else {
|
|
404
419
|
throw new Error("HLS playback not supported in this browser");
|
|
405
420
|
}
|
|
421
|
+
if (video) {
|
|
422
|
+
const muted = api.getState("muted");
|
|
423
|
+
const volume = api.getState("volume");
|
|
424
|
+
if (muted !== void 0) video.muted = muted;
|
|
425
|
+
if (volume !== void 0) video.volume = volume;
|
|
426
|
+
}
|
|
406
427
|
api.setState("playbackState", "ready");
|
|
407
428
|
api.setState("buffering", false);
|
|
408
429
|
},
|
package/dist/light.cjs
CHANGED
|
@@ -238,6 +238,9 @@ function setupVideoEventHandlers(video, api) {
|
|
|
238
238
|
video.addEventListener(event, handler);
|
|
239
239
|
handlers.push({ event, handler });
|
|
240
240
|
};
|
|
241
|
+
addHandler("play", () => {
|
|
242
|
+
api.setState("paused", false);
|
|
243
|
+
});
|
|
241
244
|
addHandler("playing", () => {
|
|
242
245
|
api.setState("playing", true);
|
|
243
246
|
api.setState("paused", false);
|
|
@@ -385,7 +388,7 @@ function createHLSPlugin(config) {
|
|
|
385
388
|
return video;
|
|
386
389
|
}
|
|
387
390
|
video = document.createElement("video");
|
|
388
|
-
video.style.cssText = "width:100%;height:100%;display:block;object-fit:contain;background:#000";
|
|
391
|
+
video.style.cssText = "position:absolute;top:0;left:0;width:100%;height:100%;display:block;object-fit:contain;background:#000";
|
|
389
392
|
video.preload = "metadata";
|
|
390
393
|
video.controls = false;
|
|
391
394
|
video.playsInline = true;
|
|
@@ -647,6 +650,20 @@ function createHLSPlugin(config) {
|
|
|
647
650
|
if (!isNaN(levelIndex) && levelIndex >= 0 && levelIndex < hls.levels.length) {
|
|
648
651
|
hls.nextLevel = levelIndex;
|
|
649
652
|
api?.logger.debug(`Quality: queued switch to level ${levelIndex}`);
|
|
653
|
+
const targetLevel = hls.levels[levelIndex];
|
|
654
|
+
if (targetLevel) {
|
|
655
|
+
const label = formatLevel(targetLevel);
|
|
656
|
+
api?.setState("currentQuality", {
|
|
657
|
+
id: `level-${levelIndex}`,
|
|
658
|
+
label: `${label}...`,
|
|
659
|
+
// Ellipsis indicates switching in progress
|
|
660
|
+
width: targetLevel.width,
|
|
661
|
+
height: targetLevel.height,
|
|
662
|
+
bitrate: targetLevel.bitrate,
|
|
663
|
+
active: false
|
|
664
|
+
// Not yet active
|
|
665
|
+
});
|
|
666
|
+
}
|
|
650
667
|
}
|
|
651
668
|
}
|
|
652
669
|
});
|
|
@@ -685,6 +702,12 @@ function createHLSPlugin(config) {
|
|
|
685
702
|
} else {
|
|
686
703
|
throw new Error("HLS playback not supported in this browser");
|
|
687
704
|
}
|
|
705
|
+
if (video) {
|
|
706
|
+
const muted = api.getState("muted");
|
|
707
|
+
const volume = api.getState("volume");
|
|
708
|
+
if (muted !== void 0) video.muted = muted;
|
|
709
|
+
if (volume !== void 0) video.volume = volume;
|
|
710
|
+
}
|
|
688
711
|
api.setState("playbackState", "ready");
|
|
689
712
|
api.setState("buffering", false);
|
|
690
713
|
},
|
package/dist/light.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { H as HLSPluginConfig, I as IHLSPlugin } from './types-
|
|
2
|
-
export {
|
|
1
|
+
import { H as HLSPluginConfig, I as IHLSPlugin } from './types-Df2TUpPu.cjs';
|
|
2
|
+
export { a as HLSError, b as HLSLiveInfo, c as HLSQualityLevel } from './types-Df2TUpPu.cjs';
|
|
3
3
|
import '@scarlett-player/core';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/light.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { H as HLSPluginConfig, I as IHLSPlugin } from './types-
|
|
2
|
-
export {
|
|
1
|
+
import { H as HLSPluginConfig, I as IHLSPlugin } from './types-Df2TUpPu.js';
|
|
2
|
+
export { a as HLSError, b as HLSLiveInfo, c as HLSQualityLevel } from './types-Df2TUpPu.js';
|
|
3
3
|
import '@scarlett-player/core';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/light.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
+
formatLevel,
|
|
2
3
|
mapLevels,
|
|
3
4
|
setupHlsEventHandlers,
|
|
4
5
|
setupVideoEventHandlers
|
|
5
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-I4BGO7UY.js";
|
|
6
7
|
|
|
7
8
|
// src/hls-loader-light.ts
|
|
8
9
|
var hlsConstructor = null;
|
|
@@ -96,7 +97,7 @@ function createHLSPlugin(config) {
|
|
|
96
97
|
return video;
|
|
97
98
|
}
|
|
98
99
|
video = document.createElement("video");
|
|
99
|
-
video.style.cssText = "width:100%;height:100%;display:block;object-fit:contain;background:#000";
|
|
100
|
+
video.style.cssText = "position:absolute;top:0;left:0;width:100%;height:100%;display:block;object-fit:contain;background:#000";
|
|
100
101
|
video.preload = "metadata";
|
|
101
102
|
video.controls = false;
|
|
102
103
|
video.playsInline = true;
|
|
@@ -358,6 +359,20 @@ function createHLSPlugin(config) {
|
|
|
358
359
|
if (!isNaN(levelIndex) && levelIndex >= 0 && levelIndex < hls.levels.length) {
|
|
359
360
|
hls.nextLevel = levelIndex;
|
|
360
361
|
api?.logger.debug(`Quality: queued switch to level ${levelIndex}`);
|
|
362
|
+
const targetLevel = hls.levels[levelIndex];
|
|
363
|
+
if (targetLevel) {
|
|
364
|
+
const label = formatLevel(targetLevel);
|
|
365
|
+
api?.setState("currentQuality", {
|
|
366
|
+
id: `level-${levelIndex}`,
|
|
367
|
+
label: `${label}...`,
|
|
368
|
+
// Ellipsis indicates switching in progress
|
|
369
|
+
width: targetLevel.width,
|
|
370
|
+
height: targetLevel.height,
|
|
371
|
+
bitrate: targetLevel.bitrate,
|
|
372
|
+
active: false
|
|
373
|
+
// Not yet active
|
|
374
|
+
});
|
|
375
|
+
}
|
|
361
376
|
}
|
|
362
377
|
}
|
|
363
378
|
});
|
|
@@ -396,6 +411,12 @@ function createHLSPlugin(config) {
|
|
|
396
411
|
} else {
|
|
397
412
|
throw new Error("HLS playback not supported in this browser");
|
|
398
413
|
}
|
|
414
|
+
if (video) {
|
|
415
|
+
const muted = api.getState("muted");
|
|
416
|
+
const volume = api.getState("volume");
|
|
417
|
+
if (muted !== void 0) video.muted = muted;
|
|
418
|
+
if (volume !== void 0) video.volume = volume;
|
|
419
|
+
}
|
|
399
420
|
api.setState("playbackState", "ready");
|
|
400
421
|
api.setState("buffering", false);
|
|
401
422
|
},
|
|
@@ -98,4 +98,4 @@ interface IHLSPlugin extends Plugin<HLSPluginConfig> {
|
|
|
98
98
|
switchToHlsJs(): Promise<void>;
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
export type { HLSPluginConfig as H, IHLSPlugin as I,
|
|
101
|
+
export type { HLSPluginConfig as H, IHLSPlugin as I, HLSError as a, HLSLiveInfo as b, HLSQualityLevel as c };
|
|
@@ -98,4 +98,4 @@ interface IHLSPlugin extends Plugin<HLSPluginConfig> {
|
|
|
98
98
|
switchToHlsJs(): Promise<void>;
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
export type { HLSPluginConfig as H, IHLSPlugin as I,
|
|
101
|
+
export type { HLSPluginConfig as H, IHLSPlugin as I, HLSError as a, HLSLiveInfo as b, HLSQualityLevel as c };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scarlett-player/hls",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "HLS Provider Plugin for Scarlett Player",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"vitest": "^1.6.0",
|
|
38
38
|
"@vitest/coverage-v8": "^1.6.0",
|
|
39
39
|
"jsdom": "^24.0.0",
|
|
40
|
-
"@scarlett-player/core": "0.
|
|
40
|
+
"@scarlett-player/core": "0.4.1"
|
|
41
41
|
},
|
|
42
42
|
"keywords": [
|
|
43
43
|
"video",
|