@micromag/screen-video 0.4.89 → 0.4.90-alpha.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.
Files changed (2) hide show
  1. package/es/index.js +169 -178
  2. package/package.json +11 -11
package/es/index.js CHANGED
@@ -3,7 +3,7 @@ import { c } from 'react/compiler-runtime';
3
3
  import { getSizeWithinBounds } from '@folklore/size';
4
4
  import classNames from 'classnames';
5
5
  import { useState, useEffect } from 'react';
6
- import { PlaceholderVideo, Empty, ScreenElement } from '@micromag/core/components';
6
+ import { Empty, ScreenElement } from '@micromag/core/components';
7
7
  import { useScreenSize, useScreenRenderContext, useViewerNavigation, useViewerContext, useViewerWebView, usePlaybackContext, usePlaybackMediaRef, useViewerActivityDetected } from '@micromag/core/contexts';
8
8
  import { useTrackScreenMedia, useDebounce } from '@micromag/core/hooks';
9
9
  import { isHeaderFilled, isFooterFilled, getFooterProps, getMediaThumbnail, mergeRefs } from '@micromag/core/utils';
@@ -16,10 +16,10 @@ import Image from '@micromag/element-image';
16
16
  import Video from '@micromag/element-video';
17
17
  import { jsx, jsxs } from 'react/jsx-runtime';
18
18
 
19
- var styles = {"container":"micromag-screen-video-container","content":"micromag-screen-video-content","emptyContainer":"micromag-screen-video-emptyContainer","empty":"micromag-screen-video-empty","inner":"micromag-screen-video-inner","header":"micromag-screen-video-header","bottom":"micromag-screen-video-bottom","placeholder":"micromag-screen-video-placeholder","videoContainer":"micromag-screen-video-videoContainer","fullscreen":"micromag-screen-video-fullscreen","image":"micromag-screen-video-image","video":"micromag-screen-video-video"};
19
+ var styles = {"container":"micromag-screen-video-container","content":"micromag-screen-video-content","emptyContainer":"micromag-screen-video-emptyContainer","empty":"micromag-screen-video-empty","inner":"micromag-screen-video-inner","header":"micromag-screen-video-header","bottom":"micromag-screen-video-bottom","videoContainer":"micromag-screen-video-videoContainer","fullscreen":"micromag-screen-video-fullscreen","image":"micromag-screen-video-image","video":"micromag-screen-video-video"};
20
20
 
21
21
  function VideoScreen(t0) {
22
- const $ = c(112);
22
+ const $ = c(111);
23
23
  const {
24
24
  layout: t1,
25
25
  video: t2,
@@ -289,69 +289,55 @@ function VideoScreen(t0) {
289
289
  });
290
290
  const resizedVideoLeft = -(resizedVideoWidth - width) / 2;
291
291
  const resizedVideoTop = -(resizedVideoHeight - height) / 2;
292
+ if (!hasVideoUrl && ready) {
293
+ setReady(false);
294
+ }
292
295
  let t36;
293
- if ($[16] !== fullscreen) {
294
- t36 = fullscreen ? {
295
- width: "100%",
296
- height: "100%"
297
- } : {
298
- width: "100%"
296
+ if ($[16] !== setReady) {
297
+ t36 = () => {
298
+ setReady(true);
299
299
  };
300
- $[16] = fullscreen;
300
+ $[16] = setReady;
301
301
  $[17] = t36;
302
302
  } else {
303
303
  t36 = $[17];
304
304
  }
305
- const placeholderProps = t36;
306
- if (!hasVideoUrl && ready) {
307
- setReady(false);
308
- }
305
+ const onVideoReady = t36;
309
306
  let t37;
310
- if ($[18] !== setReady) {
307
+ if ($[18] !== autoPlay || $[19] !== current || $[20] !== hasVideoUrl || $[21] !== isView || $[22] !== playing || $[23] !== setControlsSuggestPlay || $[24] !== setPlaying) {
311
308
  t37 = () => {
312
- setReady(true);
313
- };
314
- $[18] = setReady;
315
- $[19] = t37;
316
- } else {
317
- t37 = $[19];
318
- }
319
- const onVideoReady = t37;
320
- let t38;
321
- if ($[20] !== autoPlay || $[21] !== current || $[22] !== hasVideoUrl || $[23] !== isView || $[24] !== playing || $[25] !== setControlsSuggestPlay || $[26] !== setPlaying) {
322
- t38 = () => {
323
309
  if (isView && playing && current && hasVideoUrl && autoPlay) {
324
310
  setPlaying(false);
325
311
  setControlsSuggestPlay(true);
326
312
  }
327
313
  };
328
- $[20] = autoPlay;
329
- $[21] = current;
330
- $[22] = hasVideoUrl;
331
- $[23] = isView;
332
- $[24] = playing;
333
- $[25] = setControlsSuggestPlay;
334
- $[26] = setPlaying;
335
- $[27] = t38;
314
+ $[18] = autoPlay;
315
+ $[19] = current;
316
+ $[20] = hasVideoUrl;
317
+ $[21] = isView;
318
+ $[22] = playing;
319
+ $[23] = setControlsSuggestPlay;
320
+ $[24] = setPlaying;
321
+ $[25] = t37;
336
322
  } else {
337
- t38 = $[27];
323
+ t37 = $[25];
338
324
  }
339
- const onPlayError = t38;
340
- let t39;
341
- if ($[28] !== className || $[29] !== fullscreen) {
342
- t39 = classNames([styles.container, className, {
325
+ const onPlayError = t37;
326
+ let t38;
327
+ if ($[26] !== className || $[27] !== fullscreen) {
328
+ t38 = classNames([styles.container, className, {
343
329
  [styles.fullscreen]: fullscreen
344
330
  }]);
345
- $[28] = className;
346
- $[29] = fullscreen;
347
- $[30] = t39;
331
+ $[26] = className;
332
+ $[27] = fullscreen;
333
+ $[28] = t38;
348
334
  } else {
349
- t39 = $[30];
335
+ t38 = $[28];
350
336
  }
351
- const t40 = isStatic || isCapture || ready;
352
- let t41;
353
- if ($[31] !== controlsVisible || $[32] !== current || $[33] !== hasHeader || $[34] !== header || $[35] !== isPlaceholder || $[36] !== isPreview || $[37] !== spacing || $[38] !== viewerTopHeight) {
354
- t41 = !isPlaceholder && hasHeader ? /*#__PURE__*/jsx("div", {
337
+ const t39 = isStatic || isCapture || ready;
338
+ let t40;
339
+ if ($[29] !== controlsVisible || $[30] !== current || $[31] !== hasHeader || $[32] !== header || $[33] !== isPlaceholder || $[34] !== isPreview || $[35] !== spacing || $[36] !== viewerTopHeight) {
340
+ t40 = !isPlaceholder && hasHeader ? /*#__PURE__*/jsx("div", {
355
341
  className: styles.header,
356
342
  style: {
357
343
  paddingTop: spacing / 2,
@@ -364,32 +350,35 @@ function VideoScreen(t0) {
364
350
  ...header
365
351
  })
366
352
  }, "header") : null;
367
- $[31] = controlsVisible;
368
- $[32] = current;
369
- $[33] = hasHeader;
370
- $[34] = header;
371
- $[35] = isPlaceholder;
372
- $[36] = isPreview;
373
- $[37] = spacing;
374
- $[38] = viewerTopHeight;
375
- $[39] = t41;
353
+ $[29] = controlsVisible;
354
+ $[30] = current;
355
+ $[31] = hasHeader;
356
+ $[32] = header;
357
+ $[33] = isPlaceholder;
358
+ $[34] = isPreview;
359
+ $[35] = spacing;
360
+ $[36] = viewerTopHeight;
361
+ $[37] = t40;
376
362
  } else {
377
- t41 = $[39];
363
+ t40 = $[37];
378
364
  }
379
- let t42;
380
- if ($[40] !== placeholderProps) {
381
- t42 = /*#__PURE__*/jsx(PlaceholderVideo, {
382
- className: styles.placeholder,
383
- ...placeholderProps
384
- });
385
- $[40] = placeholderProps;
386
- $[41] = t42;
365
+ const t41 = fullscreen ? "100%" : "50%";
366
+ const t42 = fullscreen ? "100%" : "50%";
367
+ let t43;
368
+ if ($[38] !== t41 || $[39] !== t42) {
369
+ t43 = {
370
+ width: t41,
371
+ height: t42
372
+ };
373
+ $[38] = t41;
374
+ $[39] = t42;
375
+ $[40] = t43;
387
376
  } else {
388
- t42 = $[41];
377
+ t43 = $[40];
389
378
  }
390
- let t43;
391
- if ($[42] === Symbol.for("react.memo_cache_sentinel")) {
392
- t43 = /*#__PURE__*/jsx("div", {
379
+ let t44;
380
+ if ($[41] === Symbol.for("react.memo_cache_sentinel")) {
381
+ t44 = /*#__PURE__*/jsx("div", {
393
382
  className: styles.emptyContainer,
394
383
  children: /*#__PURE__*/jsx(Empty, {
395
384
  className: styles.empty,
@@ -399,14 +388,14 @@ function VideoScreen(t0) {
399
388
  })
400
389
  })
401
390
  });
402
- $[42] = t43;
391
+ $[41] = t44;
403
392
  } else {
404
- t43 = $[42];
393
+ t44 = $[41];
405
394
  }
406
- const t44 = !hasVideoUrl;
407
- let t45;
408
- if ($[43] !== current || $[44] !== currentQualityLevel || $[45] !== customMediaRef || $[46] !== finalThumbnail || $[47] !== finalVideo || $[48] !== hasVideoUrl || $[49] !== isView || $[50] !== mediaRef || $[51] !== mediaShouldLoad || $[52] !== muted || $[53] !== onDurationChange || $[54] !== onEnded || $[55] !== onPause || $[56] !== onPlay || $[57] !== onPlayError || $[58] !== onProgressStep || $[59] !== onSeeked || $[60] !== onTimeUpdate || $[61] !== onVideoReady || $[62] !== resizedVideoHeight || $[63] !== resizedVideoLeft || $[64] !== resizedVideoTop || $[65] !== resizedVideoWidth || $[66] !== resolution || $[67] !== setCurrentQualityLevel || $[68] !== shouldDisplayPoster || $[69] !== videoPlaying) {
409
- t45 = hasVideoUrl ? /*#__PURE__*/jsx("div", {
395
+ const t45 = !hasVideoUrl;
396
+ let t46;
397
+ if ($[42] !== current || $[43] !== currentQualityLevel || $[44] !== customMediaRef || $[45] !== finalThumbnail || $[46] !== finalVideo || $[47] !== hasVideoUrl || $[48] !== isView || $[49] !== mediaRef || $[50] !== mediaShouldLoad || $[51] !== muted || $[52] !== onDurationChange || $[53] !== onEnded || $[54] !== onPause || $[55] !== onPlay || $[56] !== onPlayError || $[57] !== onProgressStep || $[58] !== onSeeked || $[59] !== onTimeUpdate || $[60] !== onVideoReady || $[61] !== resizedVideoHeight || $[62] !== resizedVideoLeft || $[63] !== resizedVideoTop || $[64] !== resizedVideoWidth || $[65] !== resolution || $[66] !== setCurrentQualityLevel || $[67] !== shouldDisplayPoster || $[68] !== videoPlaying) {
398
+ t46 = hasVideoUrl ? /*#__PURE__*/jsx("div", {
410
399
  className: styles.videoContainer,
411
400
  style: {
412
401
  width: resizedVideoWidth,
@@ -448,55 +437,57 @@ function VideoScreen(t0) {
448
437
  onQualityLevelChange: setCurrentQualityLevel
449
438
  })
450
439
  }) : null;
451
- $[43] = current;
452
- $[44] = currentQualityLevel;
453
- $[45] = customMediaRef;
454
- $[46] = finalThumbnail;
455
- $[47] = finalVideo;
456
- $[48] = hasVideoUrl;
457
- $[49] = isView;
458
- $[50] = mediaRef;
459
- $[51] = mediaShouldLoad;
460
- $[52] = muted;
461
- $[53] = onDurationChange;
462
- $[54] = onEnded;
463
- $[55] = onPause;
464
- $[56] = onPlay;
465
- $[57] = onPlayError;
466
- $[58] = onProgressStep;
467
- $[59] = onSeeked;
468
- $[60] = onTimeUpdate;
469
- $[61] = onVideoReady;
470
- $[62] = resizedVideoHeight;
471
- $[63] = resizedVideoLeft;
472
- $[64] = resizedVideoTop;
473
- $[65] = resizedVideoWidth;
474
- $[66] = resolution;
475
- $[67] = setCurrentQualityLevel;
476
- $[68] = shouldDisplayPoster;
477
- $[69] = videoPlaying;
478
- $[70] = t45;
440
+ $[42] = current;
441
+ $[43] = currentQualityLevel;
442
+ $[44] = customMediaRef;
443
+ $[45] = finalThumbnail;
444
+ $[46] = finalVideo;
445
+ $[47] = hasVideoUrl;
446
+ $[48] = isView;
447
+ $[49] = mediaRef;
448
+ $[50] = mediaShouldLoad;
449
+ $[51] = muted;
450
+ $[52] = onDurationChange;
451
+ $[53] = onEnded;
452
+ $[54] = onPause;
453
+ $[55] = onPlay;
454
+ $[56] = onPlayError;
455
+ $[57] = onProgressStep;
456
+ $[58] = onSeeked;
457
+ $[59] = onTimeUpdate;
458
+ $[60] = onVideoReady;
459
+ $[61] = resizedVideoHeight;
460
+ $[62] = resizedVideoLeft;
461
+ $[63] = resizedVideoTop;
462
+ $[64] = resizedVideoWidth;
463
+ $[65] = resolution;
464
+ $[66] = setCurrentQualityLevel;
465
+ $[67] = shouldDisplayPoster;
466
+ $[68] = videoPlaying;
467
+ $[69] = t46;
479
468
  } else {
480
- t45 = $[70];
469
+ t46 = $[69];
481
470
  }
482
- let t46;
483
- if ($[71] !== t42 || $[72] !== t44 || $[73] !== t45) {
484
- t46 = /*#__PURE__*/jsx(ScreenElement, {
485
- placeholder: t42,
486
- empty: t43,
487
- isEmpty: t44,
488
- children: t45
471
+ let t47;
472
+ if ($[70] !== t43 || $[71] !== t45 || $[72] !== t46) {
473
+ t47 = /*#__PURE__*/jsx(ScreenElement, {
474
+ placeholder: "video",
475
+ placeholderProps: t43,
476
+ placeholderClassName: "position-absolute top-50 start-50 translate-middle w-100",
477
+ empty: t44,
478
+ isEmpty: t45,
479
+ children: t46
489
480
  }, "video");
490
- $[71] = t42;
491
- $[72] = t44;
492
- $[73] = t45;
493
- $[74] = t46;
481
+ $[70] = t43;
482
+ $[71] = t45;
483
+ $[72] = t46;
484
+ $[73] = t47;
494
485
  } else {
495
- t46 = $[74];
486
+ t47 = $[73];
496
487
  }
497
- let t47;
498
- if ($[75] !== captions || $[76] !== closedCaptions || $[77] !== current || $[78] !== currentTime || $[79] !== footerProps || $[80] !== hasFooter || $[81] !== isCapture || $[82] !== isPlaceholder || $[83] !== isPreview || $[84] !== isStatic || $[85] !== spacing || $[86] !== viewerBottomHeight || $[87] !== viewerBottomSidesWidth) {
499
- t47 = !isPlaceholder ? /*#__PURE__*/jsxs("div", {
488
+ let t48;
489
+ if ($[74] !== captions || $[75] !== closedCaptions || $[76] !== current || $[77] !== currentTime || $[78] !== footerProps || $[79] !== hasFooter || $[80] !== isCapture || $[81] !== isPlaceholder || $[82] !== isPreview || $[83] !== isStatic || $[84] !== spacing || $[85] !== viewerBottomHeight || $[86] !== viewerBottomSidesWidth) {
490
+ t48 = !isPlaceholder ? /*#__PURE__*/jsxs("div", {
500
491
  className: styles.bottom,
501
492
  style: {
502
493
  transform: current && !isPreview ? `translate3d(0, -${viewerBottomHeight}px, 0)` : null,
@@ -514,54 +505,54 @@ function VideoScreen(t0) {
514
505
  ...footerProps
515
506
  }) : null]
516
507
  }, "bottom-content") : null;
517
- $[75] = captions;
518
- $[76] = closedCaptions;
519
- $[77] = current;
520
- $[78] = currentTime;
521
- $[79] = footerProps;
522
- $[80] = hasFooter;
523
- $[81] = isCapture;
524
- $[82] = isPlaceholder;
525
- $[83] = isPreview;
526
- $[84] = isStatic;
527
- $[85] = spacing;
528
- $[86] = viewerBottomHeight;
529
- $[87] = viewerBottomSidesWidth;
530
- $[88] = t47;
508
+ $[74] = captions;
509
+ $[75] = closedCaptions;
510
+ $[76] = current;
511
+ $[77] = currentTime;
512
+ $[78] = footerProps;
513
+ $[79] = hasFooter;
514
+ $[80] = isCapture;
515
+ $[81] = isPlaceholder;
516
+ $[82] = isPreview;
517
+ $[83] = isStatic;
518
+ $[84] = spacing;
519
+ $[85] = viewerBottomHeight;
520
+ $[86] = viewerBottomSidesWidth;
521
+ $[87] = t48;
531
522
  } else {
532
- t47 = $[88];
523
+ t48 = $[87];
533
524
  }
534
- let t48;
535
- if ($[89] !== t41 || $[90] !== t46 || $[91] !== t47) {
536
- t48 = /*#__PURE__*/jsxs("div", {
525
+ let t49;
526
+ if ($[88] !== t40 || $[89] !== t47 || $[90] !== t48) {
527
+ t49 = /*#__PURE__*/jsxs("div", {
537
528
  className: styles.inner,
538
- children: [t41, t46, t47]
529
+ children: [t40, t47, t48]
539
530
  });
540
- $[89] = t41;
541
- $[90] = t46;
542
- $[91] = t47;
543
- $[92] = t48;
531
+ $[88] = t40;
532
+ $[89] = t47;
533
+ $[90] = t48;
534
+ $[91] = t49;
544
535
  } else {
545
- t48 = $[92];
536
+ t49 = $[91];
546
537
  }
547
- let t49;
548
- if ($[93] !== height || $[94] !== t48 || $[95] !== width) {
549
- t49 = /*#__PURE__*/jsx(Container, {
538
+ let t50;
539
+ if ($[92] !== height || $[93] !== t49 || $[94] !== width) {
540
+ t50 = /*#__PURE__*/jsx(Container, {
550
541
  width: width,
551
542
  height: height,
552
543
  className: styles.content,
553
- children: t48
544
+ children: t49
554
545
  });
555
- $[93] = height;
556
- $[94] = t48;
557
- $[95] = width;
558
- $[96] = t49;
546
+ $[92] = height;
547
+ $[93] = t49;
548
+ $[94] = width;
549
+ $[95] = t50;
559
550
  } else {
560
- t49 = $[96];
551
+ t50 = $[95];
561
552
  }
562
- let t50;
563
- if ($[97] !== background || $[98] !== backgroundPlaying || $[99] !== height || $[100] !== isPlaceholder || $[101] !== isPreview || $[102] !== mediaShouldLoad || $[103] !== muted || $[104] !== resolution || $[105] !== width) {
564
- t50 = !isPlaceholder ? /*#__PURE__*/jsx(Background, {
553
+ let t51;
554
+ if ($[96] !== background || $[97] !== backgroundPlaying || $[98] !== height || $[99] !== isPlaceholder || $[100] !== isPreview || $[101] !== mediaShouldLoad || $[102] !== muted || $[103] !== resolution || $[104] !== width) {
555
+ t51 = !isPlaceholder ? /*#__PURE__*/jsx(Background, {
565
556
  background: background,
566
557
  width: width,
567
558
  height: height,
@@ -571,35 +562,35 @@ function VideoScreen(t0) {
571
562
  shouldLoad: mediaShouldLoad,
572
563
  withoutVideo: isPreview
573
564
  }) : null;
574
- $[97] = background;
575
- $[98] = backgroundPlaying;
576
- $[99] = height;
577
- $[100] = isPlaceholder;
578
- $[101] = isPreview;
579
- $[102] = mediaShouldLoad;
580
- $[103] = muted;
581
- $[104] = resolution;
582
- $[105] = width;
583
- $[106] = t50;
565
+ $[96] = background;
566
+ $[97] = backgroundPlaying;
567
+ $[98] = height;
568
+ $[99] = isPlaceholder;
569
+ $[100] = isPreview;
570
+ $[101] = mediaShouldLoad;
571
+ $[102] = muted;
572
+ $[103] = resolution;
573
+ $[104] = width;
574
+ $[105] = t51;
584
575
  } else {
585
- t50 = $[106];
576
+ t51 = $[105];
586
577
  }
587
- let t51;
588
- if ($[107] !== t39 || $[108] !== t40 || $[109] !== t49 || $[110] !== t50) {
589
- t51 = /*#__PURE__*/jsxs("div", {
590
- className: t39,
591
- "data-screen-ready": t40,
592
- children: [t49, t50]
578
+ let t52;
579
+ if ($[106] !== t38 || $[107] !== t39 || $[108] !== t50 || $[109] !== t51) {
580
+ t52 = /*#__PURE__*/jsxs("div", {
581
+ className: t38,
582
+ "data-screen-ready": t39,
583
+ children: [t50, t51]
593
584
  });
585
+ $[106] = t38;
594
586
  $[107] = t39;
595
- $[108] = t40;
596
- $[109] = t49;
597
- $[110] = t50;
598
- $[111] = t51;
587
+ $[108] = t50;
588
+ $[109] = t51;
589
+ $[110] = t52;
599
590
  } else {
600
- t51 = $[111];
591
+ t52 = $[110];
601
592
  }
602
- return t51;
593
+ return t52;
603
594
  }
604
595
  function _temp() {}
605
596
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micromag/screen-video",
3
- "version": "0.4.89",
3
+ "version": "0.4.90-alpha.1",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "keywords": [
@@ -63,15 +63,15 @@
63
63
  "dependencies": {
64
64
  "@babel/runtime": "^7.28.6",
65
65
  "@folklore/size": "^0.1.20",
66
- "@micromag/core": "^0.4.88",
67
- "@micromag/element-background": "^0.4.88",
68
- "@micromag/element-closed-captions": "^0.4.88",
69
- "@micromag/element-container": "^0.4.88",
70
- "@micromag/element-footer": "^0.4.89",
71
- "@micromag/element-header": "^0.4.88",
72
- "@micromag/element-image": "^0.4.89",
73
- "@micromag/element-video": "^0.4.88",
74
- "@micromag/transforms": "^0.4.88",
66
+ "@micromag/core": "^0.4.90-alpha.1",
67
+ "@micromag/element-background": "^0.4.90-alpha.1",
68
+ "@micromag/element-closed-captions": "^0.4.90-alpha.1",
69
+ "@micromag/element-container": "^0.4.90-alpha.1",
70
+ "@micromag/element-footer": "^0.4.90-alpha.1",
71
+ "@micromag/element-header": "^0.4.90-alpha.1",
72
+ "@micromag/element-image": "^0.4.90-alpha.1",
73
+ "@micromag/element-video": "^0.4.90-alpha.1",
74
+ "@micromag/transforms": "^0.4.90-alpha.1",
75
75
  "classnames": "^2.2.6",
76
76
  "lodash": "^4.17.23",
77
77
  "react-intl": "^8.1.3 || ^10.0.0",
@@ -81,6 +81,6 @@
81
81
  "access": "public",
82
82
  "registry": "https://registry.npmjs.org/"
83
83
  },
84
- "gitHead": "b22ccb83a7c0679970a453b09e2be779ed68f839",
84
+ "gitHead": "a13dd2242ee733dc3b3663354783f0b4395f9926",
85
85
  "types": "es/index.d.ts"
86
86
  }