@karnstack/kino 0.1.1 → 0.1.3

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.
@@ -807,6 +807,7 @@ function Scrubber() {
807
807
  className: "kino-scrubber",
808
808
  onPointerMove,
809
809
  onPointerLeave: () => setHover(null),
810
+ onPointerDown,
810
811
  children: [hover && /* @__PURE__ */ jsxs("div", {
811
812
  ref: previewRef,
812
813
  className: "kino-preview kino-glass",
@@ -834,7 +835,6 @@ function Scrubber() {
834
835
  "aria-valuemax": Math.floor(duration) || 0,
835
836
  "aria-valuenow": Math.floor(currentTime),
836
837
  "aria-valuetext": formatTime(currentTime),
837
- onPointerDown,
838
838
  children: [
839
839
  buffered.map(([s, e], i) => /* @__PURE__ */ jsx("div", {
840
840
  className: "kino-buffered",
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { _ as usePlayer, a as SkipBackButton, c as Captions, d as Player, f as useControlsVisible, g as useMediaSelector, h as PlayerContext, i as PlayPauseButton, l as IdleOverlay, m as useWrapperRef, n as FullscreenButton, o as SkipForwardButton, p as useIsCompact, r as PipButton, s as VolumeControl, t as ControlBar, u as Scrubber, v as usePlayerActions, y as formatTime } from "./control-bar-DrAeqaap.js";
1
+ import { _ as usePlayer, a as SkipBackButton, c as Captions, d as Player, f as useControlsVisible, g as useMediaSelector, h as PlayerContext, i as PlayPauseButton, l as IdleOverlay, m as useWrapperRef, n as FullscreenButton, o as SkipForwardButton, p as useIsCompact, r as PipButton, s as VolumeControl, t as ControlBar, u as Scrubber, v as usePlayerActions, y as formatTime } from "./control-bar-B-p1rMgm.js";
2
2
  export { Captions, ControlBar, FullscreenButton, IdleOverlay, PipButton, PlayPauseButton, Player, PlayerContext, Scrubber, SkipBackButton, SkipForwardButton, VolumeControl, formatTime, useControlsVisible, useIsCompact, useMediaSelector, usePlayer, usePlayerActions, useWrapperRef };
package/dist/mux.js CHANGED
@@ -1,4 +1,4 @@
1
- import { c as Captions, d as Player, l as IdleOverlay, t as ControlBar } from "./control-bar-DrAeqaap.js";
1
+ import { c as Captions, d as Player, l as IdleOverlay, t as ControlBar } from "./control-bar-B-p1rMgm.js";
2
2
  import { useEffect, useRef } from "react";
3
3
  import { jsx, jsxs } from "react/jsx-runtime";
4
4
  import "@mux/mux-video";
@@ -99,6 +99,7 @@ function createMuxProvider(opts) {
99
99
  hasTextTracks: true
100
100
  }
101
101
  };
102
+ let desiredRate = opts.defaultRate ?? 1;
102
103
  const listeners = /* @__PURE__ */ new Set();
103
104
  const emit = () => listeners.forEach((l) => l());
104
105
  const patch = (p) => {
@@ -193,6 +194,7 @@ function createMuxProvider(opts) {
193
194
  const syncFromEl = () => {
194
195
  if (!el) return;
195
196
  bindRenditions();
197
+ if (el.playbackRate !== desiredRate) el.playbackRate = desiredRate;
196
198
  applyTextTrackModes();
197
199
  const ranges = [];
198
200
  for (let i = 0; i < el.buffered.length; i++) ranges.push([el.buffered.start(i), el.buffered.end(i)]);
@@ -201,7 +203,7 @@ function createMuxProvider(opts) {
201
203
  currentTime: el.currentTime,
202
204
  duration: el.duration || 0,
203
205
  buffered: ranges,
204
- rate: el.playbackRate,
206
+ rate: desiredRate,
205
207
  volume: el.volume,
206
208
  muted: el.muted,
207
209
  readyState: el.readyState,
@@ -275,9 +277,9 @@ function createMuxProvider(opts) {
275
277
  if (el) el.currentTime = t;
276
278
  },
277
279
  setRate: (r) => {
278
- if (!el) return;
279
- el.playbackRate = r;
280
- el.defaultPlaybackRate = r;
280
+ desiredRate = r;
281
+ if (el) el.playbackRate = r;
282
+ patch({ rate: r });
281
283
  },
282
284
  setVolume: (v) => {
283
285
  if (el) el.volume = Math.min(1, Math.max(0, v));
@@ -331,8 +333,7 @@ function createMuxProvider(opts) {
331
333
  el.playsInline = true;
332
334
  el.poster = opts.poster ?? buildImageUrl(opts.playbackId, "thumbnail", opts.tokens?.thumbnail);
333
335
  if (opts.autoPlay) el.autoplay = true;
334
- el.playbackRate = state.rate;
335
- el.defaultPlaybackRate = state.rate;
336
+ el.playbackRate = desiredRate;
336
337
  if (opts.envKey) el.envKey = opts.envKey;
337
338
  if (opts.metadata) el.metadata = {
338
339
  video_id: opts.metadata.videoId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@karnstack/kino",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Themeable React video player with pluggable providers.",
5
5
  "license": "MIT",
6
6
  "author": "Karn",