softbuilders-react-video-player 1.1.6 → 1.1.7
Sign up to get free protection for your applications and to get access to all the features.
@@ -69,22 +69,23 @@ const VideoPlayerComponent = ({ id, options, notes, chapters, startTime = 0, han
|
|
69
69
|
});
|
70
70
|
}
|
71
71
|
return () => {
|
72
|
-
if (playerRef
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
bigPlayButtonRoot[id]
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
controlBarRoot[id]
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
72
|
+
if (playerRef)
|
73
|
+
if (playerRef.current) {
|
74
|
+
// Dispose of the player properly on component unmount
|
75
|
+
playerRef.current.dispose();
|
76
|
+
playerRef.current = undefined;
|
77
|
+
// Defer unmounting of big play button and control bar to avoid race conditions
|
78
|
+
setTimeout(() => {
|
79
|
+
if (bigPlayButtonRoot[id]) {
|
80
|
+
bigPlayButtonRoot[id].unmount();
|
81
|
+
bigPlayButtonRoot[id] = undefined;
|
82
|
+
}
|
83
|
+
if (controlBarRoot[id]) {
|
84
|
+
controlBarRoot[id].unmount();
|
85
|
+
controlBarRoot[id] = undefined;
|
86
|
+
}
|
87
|
+
}, 0);
|
88
|
+
}
|
88
89
|
};
|
89
90
|
}, [options]);
|
90
91
|
useEffect(() => {
|
@@ -119,7 +120,7 @@ const VideoPlayerComponent = ({ id, options, notes, chapters, startTime = 0, han
|
|
119
120
|
duration,
|
120
121
|
]);
|
121
122
|
useEffect(() => {
|
122
|
-
if (isReady) {
|
123
|
+
if (isReady && playerRef) {
|
123
124
|
const playButtonTimeout = setTimeout(() => {
|
124
125
|
renderBigPlayButton(id, playerRef.current, isPaused, setIsPaused);
|
125
126
|
}, 500);
|
@@ -127,11 +128,13 @@ const VideoPlayerComponent = ({ id, options, notes, chapters, startTime = 0, han
|
|
127
128
|
}
|
128
129
|
}, [id, isPaused, isReady]);
|
129
130
|
useEffect(() => {
|
130
|
-
if (playerRef
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
131
|
+
if (playerRef) {
|
132
|
+
if (playerRef.current) {
|
133
|
+
const intervalId = setInterval(() => {
|
134
|
+
setIsPaused(playerRef.current.paused());
|
135
|
+
}, 500);
|
136
|
+
return () => clearInterval(intervalId);
|
137
|
+
}
|
135
138
|
}
|
136
139
|
}, []);
|
137
140
|
return (_jsx("div", { id: `video-container-${id}`, className: "sb-relative sb-rounded-md sb-overflow-hidden", children: _jsx("div", { "data-vjs-player": true, children: _jsx("div", { ref: videoRef }) }) }));
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/VideoPlayerComponent/index.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,QAAQ,MAAM,kBAAkB,CAAC;AACxC,OAAO,OAAO,MAAM,UAAU,CAAC;AAE/B,OAAO,4BAA4B,CAAC;AACpC,OAAO,UAAU,MAAM,eAAe,CAAC;AAOvC,OAAO,mBAAmB,CAAC;AAC3B,OAAO,2BAA2B,CAAC;AACnC,OAAO,EAAE,+BAA+B,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAE7C,IAAI,iBAAiB,GAEjB,EAAE,CAAC;AAEP,MAAM,mBAAmB,GAAG,CAC1B,EAAU,EACV,MAA0B,EAC1B,QAAiB,EACjB,WAA0D,EAC1D,EAAE;IACF,MAAM,SAAS,GAAG,QAAQ,CAAC,cAAc,CAAC,mBAAmB,EAAE,EAAE,CAAC,CAAC;IACnE,IAAI,SAAS,EAAE,CAAC;QACd,MAAM,OAAO,GAAQ,SAAS,CAAC,aAAa,CAAC,sBAAsB,CAAC,CAAC;QACrE,IAAI,OAAO,EAAE,CAAC;YACZ,IAAI,CAAC,iBAAiB,CAAC,EAAE,CAAC,EAAE,CAAC;gBAC3B,sDAAsD;gBACtD,iB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AAC;YAER,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,iBAAiB,CAAC,CAAC,CAAC,uBAAuB;QACvE,CAAC;IACH,CAAC,EAAE,CAAC,EAAE,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;IAE5B,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,SAAS,EAAE,CAAC;YACd,IAAI,SAAS,CAAC,OAAO,EAAE,CAAC;gBACtB,MAAM,UAAU,GAAG,WAAW,CAAC,GAAG,EAAE;oBAClC,WAAW,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;gBAC1C,CAAC,EAAE,GAAG,CAAC,CAAC;gBAER,OAAO,GAAG,EAAE,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;YACzC,CAAC;QACH,CAAC;IACH,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,CACL,cACE,EAAE,EAAE,mBAAmB,EAAE,EAAE,EAC3B,SAAS,EAAC,8CAA8C,YAExD,iDACE,cAAK,GAAG,EAAE,QAAQ,GAAI,GAClB,GACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
@@ -149,23 +149,24 @@ const VideoPlayerComponent = <T,>({
|
|
149
149
|
}
|
150
150
|
|
151
151
|
return () => {
|
152
|
-
if (playerRef
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
bigPlayButtonRoot[id]
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
controlBarRoot[id]
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
152
|
+
if (playerRef)
|
153
|
+
if (playerRef.current) {
|
154
|
+
// Dispose of the player properly on component unmount
|
155
|
+
playerRef.current.dispose();
|
156
|
+
playerRef.current = undefined;
|
157
|
+
|
158
|
+
// Defer unmounting of big play button and control bar to avoid race conditions
|
159
|
+
setTimeout(() => {
|
160
|
+
if (bigPlayButtonRoot[id]) {
|
161
|
+
bigPlayButtonRoot[id].unmount();
|
162
|
+
bigPlayButtonRoot[id] = undefined;
|
163
|
+
}
|
164
|
+
if (controlBarRoot[id]) {
|
165
|
+
controlBarRoot[id].unmount();
|
166
|
+
controlBarRoot[id] = undefined;
|
167
|
+
}
|
168
|
+
}, 0);
|
169
|
+
}
|
169
170
|
};
|
170
171
|
}, [options]);
|
171
172
|
|
@@ -212,7 +213,7 @@ const VideoPlayerComponent = <T,>({
|
|
212
213
|
]);
|
213
214
|
|
214
215
|
useEffect(() => {
|
215
|
-
if (isReady) {
|
216
|
+
if (isReady && playerRef) {
|
216
217
|
const playButtonTimeout = setTimeout(() => {
|
217
218
|
renderBigPlayButton(id, playerRef.current, isPaused, setIsPaused);
|
218
219
|
}, 500);
|
@@ -222,12 +223,14 @@ const VideoPlayerComponent = <T,>({
|
|
222
223
|
}, [id, isPaused, isReady]);
|
223
224
|
|
224
225
|
useEffect(() => {
|
225
|
-
if (playerRef
|
226
|
-
|
227
|
-
|
228
|
-
|
226
|
+
if (playerRef) {
|
227
|
+
if (playerRef.current) {
|
228
|
+
const intervalId = setInterval(() => {
|
229
|
+
setIsPaused(playerRef.current.paused());
|
230
|
+
}, 500);
|
229
231
|
|
230
|
-
|
232
|
+
return () => clearInterval(intervalId);
|
233
|
+
}
|
231
234
|
}
|
232
235
|
}, []);
|
233
236
|
|
package/dist/index.mjs
CHANGED
@@ -1224,19 +1224,21 @@ var VideoPlayerComponent = ({
|
|
1224
1224
|
});
|
1225
1225
|
}
|
1226
1226
|
return () => {
|
1227
|
-
if (playerRef
|
1228
|
-
playerRef.current
|
1229
|
-
|
1230
|
-
|
1231
|
-
|
1232
|
-
bigPlayButtonRoot[id]
|
1233
|
-
|
1234
|
-
|
1235
|
-
|
1236
|
-
controlBarRoot[id]
|
1237
|
-
|
1238
|
-
|
1239
|
-
|
1227
|
+
if (playerRef) {
|
1228
|
+
if (playerRef.current) {
|
1229
|
+
playerRef.current.dispose();
|
1230
|
+
playerRef.current = void 0;
|
1231
|
+
setTimeout(() => {
|
1232
|
+
if (bigPlayButtonRoot[id]) {
|
1233
|
+
bigPlayButtonRoot[id].unmount();
|
1234
|
+
bigPlayButtonRoot[id] = void 0;
|
1235
|
+
}
|
1236
|
+
if (controlBarRoot[id]) {
|
1237
|
+
controlBarRoot[id].unmount();
|
1238
|
+
controlBarRoot[id] = void 0;
|
1239
|
+
}
|
1240
|
+
}, 0);
|
1241
|
+
}
|
1240
1242
|
}
|
1241
1243
|
};
|
1242
1244
|
}, [options]);
|
@@ -1279,7 +1281,7 @@ var VideoPlayerComponent = ({
|
|
1279
1281
|
duration
|
1280
1282
|
]);
|
1281
1283
|
useEffect14(() => {
|
1282
|
-
if (isReady) {
|
1284
|
+
if (isReady && playerRef) {
|
1283
1285
|
const playButtonTimeout = setTimeout(() => {
|
1284
1286
|
renderBigPlayButton(id, playerRef.current, isPaused, setIsPaused);
|
1285
1287
|
}, 500);
|
@@ -1287,11 +1289,13 @@ var VideoPlayerComponent = ({
|
|
1287
1289
|
}
|
1288
1290
|
}, [id, isPaused, isReady]);
|
1289
1291
|
useEffect14(() => {
|
1290
|
-
if (playerRef
|
1291
|
-
|
1292
|
-
|
1293
|
-
|
1294
|
-
|
1292
|
+
if (playerRef) {
|
1293
|
+
if (playerRef.current) {
|
1294
|
+
const intervalId = setInterval(() => {
|
1295
|
+
setIsPaused(playerRef.current.paused());
|
1296
|
+
}, 500);
|
1297
|
+
return () => clearInterval(intervalId);
|
1298
|
+
}
|
1295
1299
|
}
|
1296
1300
|
}, []);
|
1297
1301
|
return /* @__PURE__ */ jsx34(
|