@scarlett-player/hls 0.1.0 → 0.1.2

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/README.md ADDED
@@ -0,0 +1,65 @@
1
+ # @scarlett-player/hls
2
+
3
+ HLS playback plugin for Scarlett Player. Uses hls.js with native Safari fallback.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @scarlett-player/core @scarlett-player/hls
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```typescript
14
+ import { ScarlettPlayer } from '@scarlett-player/core';
15
+ import { createHLSPlugin } from '@scarlett-player/hls';
16
+
17
+ const player = new ScarlettPlayer({
18
+ container: document.getElementById('player'),
19
+ plugins: [createHLSPlugin()],
20
+ });
21
+
22
+ await player.init();
23
+ await player.load('https://example.com/video.m3u8');
24
+ ```
25
+
26
+ ## Features
27
+
28
+ - Adaptive bitrate streaming
29
+ - Quality level selection
30
+ - Live stream support with DVR
31
+ - Native Safari HLS fallback
32
+ - Automatic hls.js loading
33
+
34
+ ## Configuration
35
+
36
+ ```typescript
37
+ createHLSPlugin({
38
+ // hls.js config options
39
+ hlsConfig: {
40
+ maxBufferLength: 30,
41
+ maxMaxBufferLength: 600,
42
+ },
43
+ // Prefer native HLS when available (Safari)
44
+ preferNativeHLS: false,
45
+ });
46
+ ```
47
+
48
+ ## Quality Selection
49
+
50
+ ```typescript
51
+ // Get available qualities
52
+ const qualities = player.getQualities();
53
+ // [{ index: 0, height: 1080, bitrate: 5000000 }, ...]
54
+
55
+ // Set quality (use -1 for auto)
56
+ player.setQuality(0); // Highest quality
57
+ player.setQuality(-1); // Auto/ABR
58
+
59
+ // Get current quality
60
+ const current = player.getCurrentQuality();
61
+ ```
62
+
63
+ ## License
64
+
65
+ MIT
package/dist/index.cjs CHANGED
@@ -648,8 +648,8 @@ function createHLSPlugin(config) {
648
648
  isAutoQuality = false;
649
649
  const levelIndex = parseInt(quality.replace("level-", ""), 10);
650
650
  if (!isNaN(levelIndex) && levelIndex >= 0 && levelIndex < hls.levels.length) {
651
- hls.currentLevel = levelIndex;
652
- api?.logger.debug(`Quality: set to level ${levelIndex}`);
651
+ hls.nextLevel = levelIndex;
652
+ api?.logger.debug(`Quality: queued switch to level ${levelIndex}`);
653
653
  }
654
654
  }
655
655
  });
package/dist/index.js CHANGED
@@ -611,8 +611,8 @@ function createHLSPlugin(config) {
611
611
  isAutoQuality = false;
612
612
  const levelIndex = parseInt(quality.replace("level-", ""), 10);
613
613
  if (!isNaN(levelIndex) && levelIndex >= 0 && levelIndex < hls.levels.length) {
614
- hls.currentLevel = levelIndex;
615
- api?.logger.debug(`Quality: set to level ${levelIndex}`);
614
+ hls.nextLevel = levelIndex;
615
+ api?.logger.debug(`Quality: queued switch to level ${levelIndex}`);
616
616
  }
617
617
  }
618
618
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scarlett-player/hls",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "HLS Provider Plugin for Scarlett Player",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -33,7 +33,7 @@
33
33
  }
34
34
  },
35
35
  "devDependencies": {
36
- "@scarlett-player/core": "file:../../core",
36
+ "@scarlett-player/core": "workspace:*",
37
37
  "hls.js": "^1.5.0",
38
38
  "typescript": "^5.3.0",
39
39
  "tsup": "^8.0.0",
@@ -58,5 +58,5 @@
58
58
  "bugs": {
59
59
  "url": "https://github.com/Hackney-Enterprises-Inc/scarlett-player/issues"
60
60
  },
61
- "homepage": "https://github.com/Hackney-Enterprises-Inc/scarlett-player#readme"
61
+ "homepage": "https://scarlettplayer.com"
62
62
  }