@folklore/hooks 0.0.49 → 0.0.50
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/cjs.js +29 -25
- package/dist/es.js +29 -25
- package/package.json +2 -2
package/dist/cjs.js
CHANGED
|
@@ -233,24 +233,28 @@ function useDailymotionPlayer() {
|
|
|
233
233
|
});
|
|
234
234
|
debug('Load video [ID: %s]', videoId);
|
|
235
235
|
} else {
|
|
236
|
-
|
|
236
|
+
element.id = `dailymotion-player-${videoId}-${Date.now()}`;
|
|
237
|
+
player = dailymotion.createPlayer(element.id, {
|
|
237
238
|
video: videoId,
|
|
238
239
|
width,
|
|
239
240
|
height,
|
|
240
241
|
params: playerParams
|
|
242
|
+
}).then(newPlayer => {
|
|
243
|
+
debug('Player ready [ID: %s]', videoId);
|
|
244
|
+
setPlayerReady(true);
|
|
245
|
+
playerRef.current = newPlayer;
|
|
241
246
|
});
|
|
242
247
|
debug('Create player [ID: %s]', videoId);
|
|
243
248
|
}
|
|
244
|
-
if (!playerReady) {
|
|
245
|
-
setPlayerReady(true);
|
|
246
|
-
}
|
|
247
|
-
playerRef.current = player;
|
|
248
249
|
playerElementRef.current = element;
|
|
249
250
|
}, [apiLoaded, elementHasChanged, videoId, width, height, autoplay, muted, start, controls, queueAutoplayNext, queueEnable, sharingEnable, uiLogo, uiStartScreenInfo]);
|
|
250
251
|
react.useEffect(() => {
|
|
251
252
|
const {
|
|
252
253
|
current: player = null
|
|
253
254
|
} = playerRef;
|
|
255
|
+
const {
|
|
256
|
+
current: dailymotion = null
|
|
257
|
+
} = apiRef;
|
|
254
258
|
if (player === null) {
|
|
255
259
|
return () => {};
|
|
256
260
|
}
|
|
@@ -335,27 +339,27 @@ function useDailymotionPlayer() {
|
|
|
335
339
|
setPlayState(currentPlayState);
|
|
336
340
|
debug('onAdEnd [ID: %s]', videoId);
|
|
337
341
|
}
|
|
338
|
-
player.on(
|
|
339
|
-
player.on(
|
|
340
|
-
player.on(
|
|
341
|
-
player.on(
|
|
342
|
-
player.on(
|
|
343
|
-
player.on(
|
|
344
|
-
player.on(
|
|
345
|
-
player.on(
|
|
346
|
-
player.on(
|
|
347
|
-
player.on(
|
|
342
|
+
player.on(dailymotion.events.PLAYER_CRITICALPATHREADY, onPlaybackReady);
|
|
343
|
+
player.on(dailymotion.events.VIDEO_DURATIONCHANGE, onDurationChange);
|
|
344
|
+
player.on(dailymotion.events.PLAYER_VOLUMECHANGE, onVolumeChange);
|
|
345
|
+
player.on(dailymotion.events.VIDEO_PLAY, onPlay);
|
|
346
|
+
player.on(dailymotion.events.VIDEO_PAUSE, onPause);
|
|
347
|
+
player.on(dailymotion.events.VIDEO_END, onEnd);
|
|
348
|
+
player.on(dailymotion.events.VIDEO_PLAYING, onPlaying);
|
|
349
|
+
player.on(dailymotion.events.VIDEO_BUFFERING, onWaiting);
|
|
350
|
+
player.on(dailymotion.events.AD_START, onAdStart);
|
|
351
|
+
player.on(dailymotion.events.AD_END, onAdEnd);
|
|
348
352
|
return () => {
|
|
349
|
-
player.off(
|
|
350
|
-
player.off(
|
|
351
|
-
player.off(
|
|
352
|
-
player.off(
|
|
353
|
-
player.off(
|
|
354
|
-
player.off(
|
|
355
|
-
player.off(
|
|
356
|
-
player.off(
|
|
357
|
-
player.off(
|
|
358
|
-
player.off(
|
|
353
|
+
player.off(dailymotion.events.PLAYER_CRITICALPATHREADY, onPlaybackReady);
|
|
354
|
+
player.off(dailymotion.events.VIDEO_DURATIONCHANGE, onDurationChange);
|
|
355
|
+
player.off(dailymotion.events.PLAYER_VOLUMECHANGE, onVolumeChange);
|
|
356
|
+
player.off(dailymotion.events.VIDEO_PLAY, onPlay);
|
|
357
|
+
player.off(dailymotion.events.VIDEO_PAUSE, onPause);
|
|
358
|
+
player.off(dailymotion.events.VIDEO_END, onEnd);
|
|
359
|
+
player.off(dailymotion.events.VIDEO_PLAYING, onPlaying);
|
|
360
|
+
player.off(dailymotion.events.VIDEO_BUFFERING, onWaiting);
|
|
361
|
+
player.off(dailymotion.events.AD_START, onAdStart);
|
|
362
|
+
player.off(dailymotion.events.AD_END, onAdEnd);
|
|
359
363
|
};
|
|
360
364
|
}, [playerRef.current, playerReady, videoId, setLoaded, setPlayState, setMetadata, setVolumeState, setMuted]);
|
|
361
365
|
const play = react.useCallback(() => {
|
package/dist/es.js
CHANGED
|
@@ -222,24 +222,28 @@ function useDailymotionPlayer() {
|
|
|
222
222
|
});
|
|
223
223
|
debug('Load video [ID: %s]', videoId);
|
|
224
224
|
} else {
|
|
225
|
-
|
|
225
|
+
element.id = `dailymotion-player-${videoId}-${Date.now()}`;
|
|
226
|
+
player = dailymotion.createPlayer(element.id, {
|
|
226
227
|
video: videoId,
|
|
227
228
|
width,
|
|
228
229
|
height,
|
|
229
230
|
params: playerParams
|
|
231
|
+
}).then(newPlayer => {
|
|
232
|
+
debug('Player ready [ID: %s]', videoId);
|
|
233
|
+
setPlayerReady(true);
|
|
234
|
+
playerRef.current = newPlayer;
|
|
230
235
|
});
|
|
231
236
|
debug('Create player [ID: %s]', videoId);
|
|
232
237
|
}
|
|
233
|
-
if (!playerReady) {
|
|
234
|
-
setPlayerReady(true);
|
|
235
|
-
}
|
|
236
|
-
playerRef.current = player;
|
|
237
238
|
playerElementRef.current = element;
|
|
238
239
|
}, [apiLoaded, elementHasChanged, videoId, width, height, autoplay, muted, start, controls, queueAutoplayNext, queueEnable, sharingEnable, uiLogo, uiStartScreenInfo]);
|
|
239
240
|
useEffect(() => {
|
|
240
241
|
const {
|
|
241
242
|
current: player = null
|
|
242
243
|
} = playerRef;
|
|
244
|
+
const {
|
|
245
|
+
current: dailymotion = null
|
|
246
|
+
} = apiRef;
|
|
243
247
|
if (player === null) {
|
|
244
248
|
return () => {};
|
|
245
249
|
}
|
|
@@ -324,27 +328,27 @@ function useDailymotionPlayer() {
|
|
|
324
328
|
setPlayState(currentPlayState);
|
|
325
329
|
debug('onAdEnd [ID: %s]', videoId);
|
|
326
330
|
}
|
|
327
|
-
player.on(
|
|
328
|
-
player.on(
|
|
329
|
-
player.on(
|
|
330
|
-
player.on(
|
|
331
|
-
player.on(
|
|
332
|
-
player.on(
|
|
333
|
-
player.on(
|
|
334
|
-
player.on(
|
|
335
|
-
player.on(
|
|
336
|
-
player.on(
|
|
331
|
+
player.on(dailymotion.events.PLAYER_CRITICALPATHREADY, onPlaybackReady);
|
|
332
|
+
player.on(dailymotion.events.VIDEO_DURATIONCHANGE, onDurationChange);
|
|
333
|
+
player.on(dailymotion.events.PLAYER_VOLUMECHANGE, onVolumeChange);
|
|
334
|
+
player.on(dailymotion.events.VIDEO_PLAY, onPlay);
|
|
335
|
+
player.on(dailymotion.events.VIDEO_PAUSE, onPause);
|
|
336
|
+
player.on(dailymotion.events.VIDEO_END, onEnd);
|
|
337
|
+
player.on(dailymotion.events.VIDEO_PLAYING, onPlaying);
|
|
338
|
+
player.on(dailymotion.events.VIDEO_BUFFERING, onWaiting);
|
|
339
|
+
player.on(dailymotion.events.AD_START, onAdStart);
|
|
340
|
+
player.on(dailymotion.events.AD_END, onAdEnd);
|
|
337
341
|
return () => {
|
|
338
|
-
player.off(
|
|
339
|
-
player.off(
|
|
340
|
-
player.off(
|
|
341
|
-
player.off(
|
|
342
|
-
player.off(
|
|
343
|
-
player.off(
|
|
344
|
-
player.off(
|
|
345
|
-
player.off(
|
|
346
|
-
player.off(
|
|
347
|
-
player.off(
|
|
342
|
+
player.off(dailymotion.events.PLAYER_CRITICALPATHREADY, onPlaybackReady);
|
|
343
|
+
player.off(dailymotion.events.VIDEO_DURATIONCHANGE, onDurationChange);
|
|
344
|
+
player.off(dailymotion.events.PLAYER_VOLUMECHANGE, onVolumeChange);
|
|
345
|
+
player.off(dailymotion.events.VIDEO_PLAY, onPlay);
|
|
346
|
+
player.off(dailymotion.events.VIDEO_PAUSE, onPause);
|
|
347
|
+
player.off(dailymotion.events.VIDEO_END, onEnd);
|
|
348
|
+
player.off(dailymotion.events.VIDEO_PLAYING, onPlaying);
|
|
349
|
+
player.off(dailymotion.events.VIDEO_BUFFERING, onWaiting);
|
|
350
|
+
player.off(dailymotion.events.AD_START, onAdStart);
|
|
351
|
+
player.off(dailymotion.events.AD_END, onAdEnd);
|
|
348
352
|
};
|
|
349
353
|
}, [playerRef.current, playerReady, videoId, setLoaded, setPlayState, setMetadata, setVolumeState, setMuted]);
|
|
350
354
|
const play = useCallback(() => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@folklore/hooks",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.50",
|
|
4
4
|
"description": "React hooks",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"publishConfig": {
|
|
50
50
|
"access": "public"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "60293e0c7b0480cf8235095faa7313c5222f5f02",
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@folklore/events": "^0.0.5",
|
|
55
55
|
"@folklore/services": "^0.1.40",
|