@micromag/screen-timeline 0.3.801 → 0.3.806
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/es/index.js +23 -22
- package/package.json +13 -13
package/es/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { FormattedMessage, defineMessage } from 'react-intl';
|
|
2
2
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
3
|
-
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
4
3
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
5
4
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
5
|
+
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
6
6
|
import classNames from 'classnames';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
|
-
import React, { useState, useEffect, useCallback,
|
|
8
|
+
import React, { useMemo, useState, useEffect, useCallback, useRef } from 'react';
|
|
9
9
|
import { PropTypes as PropTypes$1 } from '@micromag/core';
|
|
10
10
|
import { ScreenElement } from '@micromag/core/components';
|
|
11
11
|
import { useScreenSize, useViewerContext, useViewerWebView, useScreenRenderContext, usePlaybackContext, usePlaybackMediaRef, useViewerContainer } from '@micromag/core/contexts';
|
|
@@ -131,10 +131,11 @@ var Timeline = function Timeline(_ref) {
|
|
|
131
131
|
_usePlaybackMediaRef$ = _usePlaybackMediaRef.isCurrent,
|
|
132
132
|
isCurrentMedia = _usePlaybackMediaRef$ === void 0 ? false : _usePlaybackMediaRef$;
|
|
133
133
|
var _ref2 = alternatives || {},
|
|
134
|
-
|
|
134
|
+
_ref2$audio = _ref2.audio,
|
|
135
|
+
audioAlternative = _ref2$audio === void 0 ? null : _ref2$audio;
|
|
135
136
|
var _ref3 = audioAlternative || {},
|
|
136
137
|
_ref3$autoPlay = _ref3.autoPlay,
|
|
137
|
-
autoPlay = _ref3$autoPlay === void 0 ?
|
|
138
|
+
autoPlay = _ref3$autoPlay === void 0 ? false : _ref3$autoPlay,
|
|
138
139
|
_ref3$loop = _ref3.loop,
|
|
139
140
|
loop = _ref3$loop === void 0 ? false : _ref3$loop,
|
|
140
141
|
_ref3$media = _ref3.media,
|
|
@@ -147,16 +148,17 @@ var Timeline = function Timeline(_ref) {
|
|
|
147
148
|
color = _ref3$color === void 0 ? null : _ref3$color,
|
|
148
149
|
_ref3$progressColor = _ref3.progressColor,
|
|
149
150
|
progressColor = _ref3$progressColor === void 0 ? null : _ref3$progressColor;
|
|
151
|
+
var finalAudioAlternative = useMemo(function () {
|
|
152
|
+
return audioAlternative !== null ? _objectSpread(_objectSpread({}, audioAlternative), {}, {
|
|
153
|
+
autoPlay: !isPreview && !isStatic && !isCapture && autoPlay && current
|
|
154
|
+
}) : null;
|
|
155
|
+
}, [audioAlternative, isPreview, isStatic, isCapture, autoPlay, current]);
|
|
150
156
|
var _useState = useState(false),
|
|
151
157
|
_useState2 = _slicedToArray(_useState, 2),
|
|
152
158
|
hasPlayed = _useState2[0],
|
|
153
159
|
setHasPlayed = _useState2[1];
|
|
154
160
|
var backgroundPlaying = current && (isView || isEdit) && (isCurrentMedia || !isView);
|
|
155
161
|
var audioPlaying = current && (isView || isEdit) && playing && (isCurrentMedia || !isView);
|
|
156
|
-
console.log({
|
|
157
|
-
playing: playing,
|
|
158
|
-
audioPlaying: audioPlaying
|
|
159
|
-
});
|
|
160
162
|
useEffect(function () {
|
|
161
163
|
if (!current) {
|
|
162
164
|
return function () {};
|
|
@@ -249,7 +251,6 @@ var Timeline = function Timeline(_ref) {
|
|
|
249
251
|
}
|
|
250
252
|
}, [trackScreenMedia, audioAlternativeMedia]);
|
|
251
253
|
var onAudioEnded = useCallback(function () {
|
|
252
|
-
console.log('ENDED');
|
|
253
254
|
if (current && !loop) {
|
|
254
255
|
setPlaying(false);
|
|
255
256
|
}
|
|
@@ -520,18 +521,7 @@ var Timeline = function Timeline(_ref) {
|
|
|
520
521
|
paddingTop: spacing / 2,
|
|
521
522
|
paddingBottom: spacing / 2
|
|
522
523
|
}
|
|
523
|
-
}, /*#__PURE__*/React.createElement(Footer, footerProps)) : null),
|
|
524
|
-
background: background,
|
|
525
|
-
width: width,
|
|
526
|
-
height: height,
|
|
527
|
-
resolution: imageResolution,
|
|
528
|
-
playing: backgroundPlaying,
|
|
529
|
-
muted: muted,
|
|
530
|
-
shouldLoad: mediaShouldLoad,
|
|
531
|
-
mediaRef: audioAlternativeMedia === null ? mediaRef : null,
|
|
532
|
-
withoutVideo: isPreview,
|
|
533
|
-
className: styles.background
|
|
534
|
-
}) : null, audioAlternativeMedia !== null ? /*#__PURE__*/React.createElement(Audio, Object.assign({}, audioAlternative, {
|
|
524
|
+
}, /*#__PURE__*/React.createElement(Footer, footerProps)) : null), audioAlternativeMedia !== null ? /*#__PURE__*/React.createElement(Audio, Object.assign({}, finalAudioAlternative, {
|
|
535
525
|
paused: !audioPlaying,
|
|
536
526
|
mediaRef: mediaRef,
|
|
537
527
|
muted: muted,
|
|
@@ -545,7 +535,18 @@ var Timeline = function Timeline(_ref) {
|
|
|
545
535
|
onDurationChange: onAudioDurationChange,
|
|
546
536
|
onSeeked: onAudioSeeked,
|
|
547
537
|
onEnded: onAudioEnded
|
|
548
|
-
})) : null
|
|
538
|
+
})) : null, !isPlaceholder ? /*#__PURE__*/React.createElement(Background, {
|
|
539
|
+
background: background,
|
|
540
|
+
width: width,
|
|
541
|
+
height: height,
|
|
542
|
+
resolution: imageResolution,
|
|
543
|
+
playing: backgroundPlaying,
|
|
544
|
+
muted: muted,
|
|
545
|
+
shouldLoad: mediaShouldLoad,
|
|
546
|
+
mediaRef: audioAlternativeMedia === null ? mediaRef : null,
|
|
547
|
+
withoutVideo: isPreview,
|
|
548
|
+
className: styles.background
|
|
549
|
+
}) : null);
|
|
549
550
|
};
|
|
550
551
|
Timeline.propTypes = propTypes;
|
|
551
552
|
Timeline.defaultProps = defaultProps;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/screen-timeline",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.806",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [
|
|
@@ -60,17 +60,17 @@
|
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
62
|
"@babel/runtime": "^7.13.10",
|
|
63
|
-
"@micromag/core": "^0.3.
|
|
64
|
-
"@micromag/element-background": "^0.3.
|
|
65
|
-
"@micromag/element-container": "^0.3.
|
|
66
|
-
"@micromag/element-footer": "^0.3.
|
|
67
|
-
"@micromag/element-header": "^0.3.
|
|
68
|
-
"@micromag/element-heading": "^0.3.
|
|
69
|
-
"@micromag/element-layout": "^0.3.
|
|
70
|
-
"@micromag/element-scroll": "^0.3.
|
|
71
|
-
"@micromag/element-text": "^0.3.
|
|
72
|
-
"@micromag/element-visual": "^0.3.
|
|
73
|
-
"@micromag/transforms": "^0.3.
|
|
63
|
+
"@micromag/core": "^0.3.803",
|
|
64
|
+
"@micromag/element-background": "^0.3.803",
|
|
65
|
+
"@micromag/element-container": "^0.3.803",
|
|
66
|
+
"@micromag/element-footer": "^0.3.803",
|
|
67
|
+
"@micromag/element-header": "^0.3.803",
|
|
68
|
+
"@micromag/element-heading": "^0.3.803",
|
|
69
|
+
"@micromag/element-layout": "^0.3.803",
|
|
70
|
+
"@micromag/element-scroll": "^0.3.803",
|
|
71
|
+
"@micromag/element-text": "^0.3.803",
|
|
72
|
+
"@micromag/element-visual": "^0.3.803",
|
|
73
|
+
"@micromag/transforms": "^0.3.803",
|
|
74
74
|
"classnames": "^2.2.6",
|
|
75
75
|
"lodash": "^4.17.21",
|
|
76
76
|
"prop-types": "^15.7.2",
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
"access": "public",
|
|
82
82
|
"registry": "https://registry.npmjs.org/"
|
|
83
83
|
},
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "11b32cfa59e2c5b6b332e377e0290e0bf5036f36"
|
|
85
85
|
}
|