@scarlett-player/native 1.1.1 → 1.4.0

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 CHANGED
@@ -25,12 +25,20 @@ await player.load('https://example.com/video.mp4');
25
25
 
26
26
  ## Supported Formats
27
27
 
28
+ Video:
29
+
28
30
  - **MP4** - H.264/AAC (most common)
29
31
  - **WebM** - VP8/VP9/Opus
30
32
  - **MOV** - QuickTime (H.264/AAC)
31
33
  - **MKV** - Matroska (browser support varies)
32
34
  - **OGV/OGG** - Theora/Vorbis
33
35
 
36
+ Audio:
37
+
38
+ - **MP3**, **WAV**, **OGG**, **FLAC**, **AAC**, **M4A**, **Opus** (pairs with
39
+ `@scarlett-player/audio-ui` and `@scarlett-player/media-session` for a full
40
+ audio player)
41
+
34
42
  ## Configuration
35
43
 
36
44
  ```typescript
package/dist/index.cjs CHANGED
@@ -204,6 +204,30 @@ function createNativePlugin(config) {
204
204
  timestamp: Date.now()
205
205
  });
206
206
  });
207
+ on("enterpictureinpicture", () => {
208
+ api?.setState("pip", true);
209
+ api?.logger.debug("PiP: entered (standard)");
210
+ });
211
+ on("leavepictureinpicture", () => {
212
+ api?.setState("pip", false);
213
+ api?.logger.debug("PiP: exited (standard)");
214
+ if (!videoEl.paused || api?.getState("playing")) {
215
+ videoEl.play().catch(() => {
216
+ });
217
+ }
218
+ });
219
+ const webkitVideo = videoEl;
220
+ if ("webkitPresentationMode" in videoEl) {
221
+ on("webkitpresentationmodechanged", () => {
222
+ const mode = webkitVideo.webkitPresentationMode;
223
+ api?.setState("pip", mode === "picture-in-picture");
224
+ api?.logger.debug(`PiP: mode changed to ${mode} (webkit)`);
225
+ if (mode === "inline" && videoEl.paused) {
226
+ videoEl.play().catch(() => {
227
+ });
228
+ }
229
+ });
230
+ }
207
231
  return () => {
208
232
  handlers.forEach(([event, handler]) => {
209
233
  videoEl.removeEventListener(event, handler);
package/dist/index.js CHANGED
@@ -179,6 +179,30 @@ function createNativePlugin(config) {
179
179
  timestamp: Date.now()
180
180
  });
181
181
  });
182
+ on("enterpictureinpicture", () => {
183
+ api?.setState("pip", true);
184
+ api?.logger.debug("PiP: entered (standard)");
185
+ });
186
+ on("leavepictureinpicture", () => {
187
+ api?.setState("pip", false);
188
+ api?.logger.debug("PiP: exited (standard)");
189
+ if (!videoEl.paused || api?.getState("playing")) {
190
+ videoEl.play().catch(() => {
191
+ });
192
+ }
193
+ });
194
+ const webkitVideo = videoEl;
195
+ if ("webkitPresentationMode" in videoEl) {
196
+ on("webkitpresentationmodechanged", () => {
197
+ const mode = webkitVideo.webkitPresentationMode;
198
+ api?.setState("pip", mode === "picture-in-picture");
199
+ api?.logger.debug(`PiP: mode changed to ${mode} (webkit)`);
200
+ if (mode === "inline" && videoEl.paused) {
201
+ videoEl.play().catch(() => {
202
+ });
203
+ }
204
+ });
205
+ }
182
206
  return () => {
183
207
  handlers.forEach(([event, handler]) => {
184
208
  videoEl.removeEventListener(event, handler);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scarlett-player/native",
3
- "version": "1.1.1",
3
+ "version": "1.4.0",
4
4
  "description": "Native Video Provider Plugin for Scarlett Player (MP4, WebM, MOV, MKV)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -23,7 +23,7 @@
23
23
  "typescript": "^5.3.0",
24
24
  "tsup": "^8.0.0",
25
25
  "vitest": "^1.6.0",
26
- "@scarlett-player/core": "1.1.1"
26
+ "@scarlett-player/core": "1.4.0"
27
27
  },
28
28
  "keywords": [
29
29
  "video",