@scarlett-player/native 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/index.cjs CHANGED
@@ -82,7 +82,7 @@ function createNativePlugin(config) {
82
82
  return video;
83
83
  }
84
84
  video = document.createElement("video");
85
- video.style.cssText = "width:100%;height:100%;display:block;object-fit:contain;background:#000";
85
+ video.style.cssText = "position:absolute;top:0;left:0;width:100%;height:100%;display:block;object-fit:contain;background:#000";
86
86
  video.preload = preload;
87
87
  video.controls = false;
88
88
  video.playsInline = true;
@@ -99,6 +99,9 @@ function createNativePlugin(config) {
99
99
  videoEl.addEventListener(event, handler);
100
100
  handlers.push([event, handler]);
101
101
  };
102
+ on("play", () => {
103
+ api?.setState("paused", false);
104
+ });
102
105
  on("playing", () => {
103
106
  api?.setState("playing", true);
104
107
  api?.setState("paused", false);
@@ -304,6 +307,10 @@ function createNativePlugin(config) {
304
307
  const onLoaded = () => {
305
308
  videoEl.removeEventListener("loadedmetadata", onLoaded);
306
309
  videoEl.removeEventListener("error", onError);
310
+ const muted = api?.getState("muted");
311
+ const volume = api?.getState("volume");
312
+ if (muted !== void 0) videoEl.muted = muted;
313
+ if (volume !== void 0) videoEl.volume = volume;
307
314
  api?.setState("source", { src, type: mimeType });
308
315
  api?.setState("playbackState", "ready");
309
316
  api?.setState("buffering", false);
package/dist/index.js CHANGED
@@ -57,7 +57,7 @@ function createNativePlugin(config) {
57
57
  return video;
58
58
  }
59
59
  video = document.createElement("video");
60
- video.style.cssText = "width:100%;height:100%;display:block;object-fit:contain;background:#000";
60
+ video.style.cssText = "position:absolute;top:0;left:0;width:100%;height:100%;display:block;object-fit:contain;background:#000";
61
61
  video.preload = preload;
62
62
  video.controls = false;
63
63
  video.playsInline = true;
@@ -74,6 +74,9 @@ function createNativePlugin(config) {
74
74
  videoEl.addEventListener(event, handler);
75
75
  handlers.push([event, handler]);
76
76
  };
77
+ on("play", () => {
78
+ api?.setState("paused", false);
79
+ });
77
80
  on("playing", () => {
78
81
  api?.setState("playing", true);
79
82
  api?.setState("paused", false);
@@ -279,6 +282,10 @@ function createNativePlugin(config) {
279
282
  const onLoaded = () => {
280
283
  videoEl.removeEventListener("loadedmetadata", onLoaded);
281
284
  videoEl.removeEventListener("error", onError);
285
+ const muted = api?.getState("muted");
286
+ const volume = api?.getState("volume");
287
+ if (muted !== void 0) videoEl.muted = muted;
288
+ if (volume !== void 0) videoEl.volume = volume;
282
289
  api?.setState("source", { src, type: mimeType });
283
290
  api?.setState("playbackState", "ready");
284
291
  api?.setState("buffering", false);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scarlett-player/native",
3
- "version": "0.2.0",
3
+ "version": "0.4.1",
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": "0.2.0"
26
+ "@scarlett-player/core": "0.4.1"
27
27
  },
28
28
  "keywords": [
29
29
  "video",