softbuilders-react-video-player 1.1.29 → 1.1.30

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,8 +2,8 @@ import React from "react";
2
2
  import { SoftBuildersVideoPlayerChapter, SoftBuildersVideoPlayerNote, SoftBuildersVideoPlayerOptions } from "../../types";
3
3
  export type Props<T = any> = {
4
4
  options: SoftBuildersVideoPlayerOptions;
5
- notes: SoftBuildersVideoPlayerNote[];
6
- chapters: SoftBuildersVideoPlayerChapter[];
5
+ notes?: SoftBuildersVideoPlayerNote[];
6
+ chapters?: SoftBuildersVideoPlayerChapter[];
7
7
  startTime?: number;
8
8
  handleSaveNoteAction?: (time: number, note: string) => Promise<T>;
9
9
  onPlay?: (time: number) => void;
@@ -35,8 +35,8 @@ const Component = ({ options, notes, chapters, startTime = 0, handleSaveNoteActi
35
35
  useEffect(() => {
36
36
  const getTracks = async () => {
37
37
  const newTracks = [];
38
- if (Array.isArray(options.tracks))
39
- for (const [i, s] of options.tracks.entries()) {
38
+ if (Array.isArray(options === null || options === void 0 ? void 0 : options.tracks))
39
+ for (const [i, s] of options === null || options === void 0 ? void 0 : options.tracks.entries()) {
40
40
  let src = s.src;
41
41
  if (s.memeType == "text/srt") {
42
42
  src = await convertSRTtoVTT(s.src);
@@ -46,7 +46,7 @@ const Component = ({ options, notes, chapters, startTime = 0, handleSaveNoteActi
46
46
  setTracks(newTracks);
47
47
  };
48
48
  getTracks();
49
- }, [options.tracks]);
49
+ }, [options === null || options === void 0 ? void 0 : options.tracks]);
50
50
  const id = (Date.now() + Math.random() * 100).toString();
51
51
  return (_jsx(VideoPlayerComponent, { id: id, chapters: chapters, options: Object.assign(Object.assign({}, options), { tracks }), notes: notes, poster: "", startTime: startTime, handleSaveNoteAction: handleSaveNoteAction, onPause: onPause, onPlay: onPlay }));
52
52
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/SoftBuildersVideoPlayer/index.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,IAAI,EAAE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AAoB,EAAE,oBAAoB,EAC1C,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,GACd,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,uBAAuB,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,EAAE;IACvE,OAAO,CACL,SAAS,CAAC,OAAO,KAAK,SAAS,CAAC,OAAO;QACvC,SAAS,CAAC,KAAK,KAAK,SAAS,CAAC,KAAK;QACnC,SAAS,CAAC,QAAQ,KAAK,SAAS,CAAC,QAAQ;QACzC,SAAS,CAAC,SAAS,KAAK,SAAS,CAAC,SAAS,CAC5C,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/SoftBuildersVideoPlayer/index.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,oBAAoB,MAAM,yBAAyB,CAAC;AAO3D,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,MAAM,eAAe,GAAmC;IACtD,QAAQ,EAAE,KAAK;IACf,QAAQ,EAAE,IAAI;IACd,KAAK,EAAE,IAAI;IACX,KAAK,EAAE,IAAI;IACX,MAAM,EAAE,GAAG;IACX,KAAK,EAAE,GAAG;IACV,OAAO,EAAE,EAAE;IACX,MAAM,EAAE,EAAE;CACX,CAAC;AAaF,MAAM,SAAS,GAAG,CAAK,EACrB,OAAO,EACP,KAAK,EACL,QAAQ,EACR,SAAS,GAAG,CAAC,EACb,oBAAoB,EACpB,MAAM,EACN,OAAO,EACP,SAAS,GAAG,IAAI,GACP,EAAE,EAAE;IACb,OAAO,GAAG,gCACL,OAAO,KACV,UAAU,EAAE,IAAI,EAChB,iBAAiB,EAAE,CAAC,EACpB,UAAU,EAAE;YACV,YAAY,EAAE,MAAM;SACrB,GACK,CAA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;
24
- notes: SoftBuildersVideoPlayerNote[];
25
- chapters: SoftBuildersVideoPlayerChapter[];
24
+ notes?: SoftBuildersVideoPlayerNote[];
25
+ chapters?: SoftBuildersVideoPlayerChapter[];
26
26
  startTime?: number;
27
27
  handleSaveNoteAction?: (time: number, note: string) => Promise<T>;
28
28
  onPlay?: (time: number) => void;
@@ -65,8 +65,8 @@ const Component = <T,>({
65
65
  useEffect(() => {
66
66
  const getTracks = async () => {
67
67
  const newTracks: SoftBuildersVideoPlayerTrack[] = [];
68
- if (Array.isArray(options.tracks))
69
- for (const [i, s] of options.tracks.entries()) {
68
+ if (Array.isArray(options?.tracks))
69
+ for (const [i, s] of options?.tracks.entries()) {
70
70
  let src = s.src;
71
71
 
72
72
  if (s.memeType == "text/srt") {
@@ -83,7 +83,7 @@ const Component = <T,>({
83
83
  };
84
84
 
85
85
  getTracks();
86
- }, [options.tracks]);
86
+ }, [options?.tracks]);
87
87
 
88
88
  const id = (Date.now() + Math.random() * 100).toString();
89
89
 
@@ -5,7 +5,7 @@ import "../../styles/tailwind.css";
5
5
  export type Props<T = any> = {
6
6
  id: string;
7
7
  options: SoftBuildersVideoPlayerOptions;
8
- notes: SoftBuildersVideoPlayerNote[];
8
+ notes?: SoftBuildersVideoPlayerNote[];
9
9
  chapters: SoftBuildersVideoPlayerChapter[];
10
10
  startTime?: number;
11
11
  poster?: string;
@@ -92,7 +92,7 @@ const renderControlBar = <T,>(
92
92
  export type Props<T = any> = {
93
93
  id: string;
94
94
  options: SoftBuildersVideoPlayerOptions;
95
- notes: SoftBuildersVideoPlayerNote[];
95
+ notes?: SoftBuildersVideoPlayerNote[];
96
96
  chapters: SoftBuildersVideoPlayerChapter[];
97
97
  startTime?: number;
98
98
  poster?: string; // Changed to string type for poster URL
package/dist/index.d.mts CHANGED
@@ -21,7 +21,7 @@ type SoftBuildersVideoPlayerOptions = {
21
21
  muted?: boolean;
22
22
  poster?: string;
23
23
  sources: SoftBuildersVideoPlayerSource[];
24
- tracks: SoftBuildersVideoPlayerTrack[];
24
+ tracks?: SoftBuildersVideoPlayerTrack[];
25
25
  width?: number;
26
26
  height?: number;
27
27
  };
@@ -37,8 +37,8 @@ interface SoftBuildersVideoPlayerChapter {
37
37
 
38
38
  type Props<T = any> = {
39
39
  options: SoftBuildersVideoPlayerOptions;
40
- notes: SoftBuildersVideoPlayerNote[];
41
- chapters: SoftBuildersVideoPlayerChapter[];
40
+ notes?: SoftBuildersVideoPlayerNote[];
41
+ chapters?: SoftBuildersVideoPlayerChapter[];
42
42
  startTime?: number;
43
43
  handleSaveNoteAction?: (time: number, note: string) => Promise<T>;
44
44
  onPlay?: (time: number) => void;
package/dist/index.mjs CHANGED
@@ -1686,8 +1686,8 @@ var Component = ({
1686
1686
  useEffect15(() => {
1687
1687
  const getTracks = async () => {
1688
1688
  const newTracks = [];
1689
- if (Array.isArray(options.tracks))
1690
- for (const [i, s] of options.tracks.entries()) {
1689
+ if (Array.isArray(options == null ? void 0 : options.tracks))
1690
+ for (const [i, s] of options == null ? void 0 : options.tracks.entries()) {
1691
1691
  let src = s.src;
1692
1692
  if (s.memeType == "text/srt") {
1693
1693
  src = await convertSRTtoVTT(s.src);
@@ -1699,7 +1699,7 @@ var Component = ({
1699
1699
  setTracks(newTracks);
1700
1700
  };
1701
1701
  getTracks();
1702
- }, [options.tracks]);
1702
+ }, [options == null ? void 0 : options.tracks]);
1703
1703
  const id = (Date.now() + Math.random() * 100).toString();
1704
1704
  return /* @__PURE__ */ jsx36(
1705
1705
  VideoPlayerComponent_default,
package/dist/types.d.ts CHANGED
@@ -18,7 +18,7 @@ export type SoftBuildersVideoPlayerOptions = {
18
18
  muted?: boolean;
19
19
  poster?: string;
20
20
  sources: SoftBuildersVideoPlayerSource[];
21
- tracks: SoftBuildersVideoPlayerTrack[];
21
+ tracks?: SoftBuildersVideoPlayerTrack[];
22
22
  width?: number;
23
23
  height?: number;
24
24
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "softbuilders-react-video-player",
3
3
  "description": "Standalone video player component",
4
- "version": "1.1.29",
4
+ "version": "1.1.30",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "files": [