@atlaskit/media-viewer 54.11.0 → 54.11.2
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/AGENTS.md +4 -0
- package/CHANGELOG.md +26 -0
- package/dist/cjs/analytics/ufoExperiences.js +1 -1
- package/dist/cjs/insetViewerContext.js +23 -3
- package/dist/cjs/styleWrappers.compiled.css +4 -0
- package/dist/cjs/styleWrappers.js +34 -14
- package/dist/cjs/utils/fit-viewport.js +14 -0
- package/dist/cjs/viewers/video.js +126 -22
- package/dist/es2019/analytics/ufoExperiences.js +1 -1
- package/dist/es2019/insetViewerContext.js +15 -2
- package/dist/es2019/styleWrappers.compiled.css +4 -0
- package/dist/es2019/styleWrappers.js +34 -14
- package/dist/es2019/utils/fit-viewport.js +11 -0
- package/dist/es2019/viewers/video.js +110 -12
- package/dist/esm/analytics/ufoExperiences.js +1 -1
- package/dist/esm/insetViewerContext.js +22 -2
- package/dist/esm/styleWrappers.compiled.css +4 -0
- package/dist/esm/styleWrappers.js +34 -14
- package/dist/esm/utils/fit-viewport.js +9 -0
- package/dist/esm/viewers/video.js +127 -23
- package/dist/types/insetViewerContext.d.ts +3 -0
- package/dist/types/styleWrappers.d.ts +4 -2
- package/dist/types/utils/fit-viewport.d.ts +2 -0
- package/dist/types/viewers/video.d.ts +2 -14
- package/package.json +4 -4
|
@@ -13,7 +13,7 @@ import Motion from '@atlaskit/motion/entering/motion';
|
|
|
13
13
|
import ExitingPersistence from '@atlaskit/motion/exiting-persistence';
|
|
14
14
|
// eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
|
|
15
15
|
import { Box, xcss } from '@atlaskit/primitives';
|
|
16
|
-
import { useIsInsetViewer, useSetMediaFooterControls } from './insetViewerContext';
|
|
16
|
+
import { useHasMediaFooterVideoControls, useIsInsetViewer, useSetMediaFooterControls } from './insetViewerContext';
|
|
17
17
|
const INSET_HEADER_HEIGHT = "var(--ds-space-800, 64px)";
|
|
18
18
|
const INSET_SIDEBAR_WIDTH = '400px';
|
|
19
19
|
|
|
@@ -40,6 +40,7 @@ const insetViewerSidebarHeaderContentStyles = null;
|
|
|
40
40
|
const insetViewerSidebarHeaderTitleStyles = null;
|
|
41
41
|
const insetViewerMediaStageStyles = null;
|
|
42
42
|
const insetViewerMediaFooterBarStyles = null;
|
|
43
|
+
const insetViewerVideoMediaFooterBarStyles = null;
|
|
43
44
|
const listWrapperStyles = null;
|
|
44
45
|
const insetViewerListWrapperStyles = null;
|
|
45
46
|
const itemStageStyles = null;
|
|
@@ -59,6 +60,7 @@ const hdIconGroupWrapperStyles = null;
|
|
|
59
60
|
const errorMessageWrapperStyles = null;
|
|
60
61
|
const errorImageStyles = null;
|
|
61
62
|
const videoStyles = null;
|
|
63
|
+
const insetViewerVideoStyles = null;
|
|
62
64
|
const pdfWrapperStyles = null;
|
|
63
65
|
const arrowStyles = null;
|
|
64
66
|
const arrowWrapperStyles = null;
|
|
@@ -99,6 +101,8 @@ const audioCoverStyles = null;
|
|
|
99
101
|
const defaultCoverWrapperStyles = null;
|
|
100
102
|
const downloadButtonWrapperStyles = null;
|
|
101
103
|
const customVideoPlayerWrapperStyles = null;
|
|
104
|
+
const insetViewerCustomVideoPlayerWrapperStyles = null;
|
|
105
|
+
const insetViewerFittedVideoFrameStyles = null;
|
|
102
106
|
const sidebarWrapperStyles = null;
|
|
103
107
|
const insetViewerSidebarWrapperStyles = null;
|
|
104
108
|
const spinnerWrapperStyles = null;
|
|
@@ -194,10 +198,11 @@ export const MediaStage = ({
|
|
|
194
198
|
}, children);
|
|
195
199
|
export const MediaFooterBar = () => {
|
|
196
200
|
const setMediaFooterControls = useSetMediaFooterControls();
|
|
201
|
+
const hasVideoControls = useHasMediaFooterVideoControls();
|
|
197
202
|
return /*#__PURE__*/React.createElement("div", {
|
|
198
203
|
ref: setMediaFooterControls,
|
|
199
204
|
"data-testid": "media-viewer-media-footer",
|
|
200
|
-
className: ax(["_1reoewfl _18m9ewfl _1o9zidpf _4t3ixncg _vchhusvi _1bsb1osq _1e0c1txw _4cvr1h6o _1bah1h6o _ca0qpxbi _u5f31ejb _n3tdpxbi _19bv1ejb _kqswh2mm _lcxv1rj4"])
|
|
205
|
+
className: ax(["_1reoewfl _18m9ewfl _1o9zidpf _4t3ixncg _vchhusvi _1bsb1osq _1e0c1txw _4cvr1h6o _1bah1h6o _ca0qpxbi _u5f31ejb _n3tdpxbi _19bv1ejb _kqswh2mm _lcxv1rj4", hasVideoControls && "_4t3iz5ib _ca0qv47k"])
|
|
201
206
|
});
|
|
202
207
|
};
|
|
203
208
|
export const ListWrapper = ({
|
|
@@ -291,13 +296,18 @@ export const ErrorImage = ({
|
|
|
291
296
|
export const Video = ({
|
|
292
297
|
autoPlay,
|
|
293
298
|
controls,
|
|
294
|
-
src
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
299
|
+
src,
|
|
300
|
+
onVideoElementChange
|
|
301
|
+
}) => {
|
|
302
|
+
const isInsetViewer = useIsInsetViewer();
|
|
303
|
+
return /*#__PURE__*/React.createElement("video", {
|
|
304
|
+
ref: onVideoElementChange,
|
|
305
|
+
autoPlay: autoPlay,
|
|
306
|
+
controls: controls,
|
|
307
|
+
src: src,
|
|
308
|
+
className: ax([!isInsetViewer && "_1bsbauwl _4t3i1kxc", isInsetViewer && "_16jlidpf _1o9zidpf _i0dl1wug _2rko1mok _1reo15vq _18m915vq _1e0c1ule _1bsb1osq _4t3i1osq _p12f1osq _c71l1osq _1ul9idpf _1tkeidpf _5ral1f51"])
|
|
309
|
+
});
|
|
310
|
+
};
|
|
301
311
|
const PDFWrapperBody = /*#__PURE__*/forwardRef(({
|
|
302
312
|
innerRef,
|
|
303
313
|
'data-testid': datatestId,
|
|
@@ -509,13 +519,23 @@ export const DownloadButtonWrapper = ({
|
|
|
509
519
|
}) => /*#__PURE__*/React.createElement("div", {
|
|
510
520
|
className: ax(["_19pk1ejb _y3gn1h6o _1sfy1fjg _4pkp1fjg"])
|
|
511
521
|
}, children);
|
|
512
|
-
export const CustomVideoPlayerWrapper = ({
|
|
522
|
+
export const CustomVideoPlayerWrapper = /*#__PURE__*/forwardRef(({
|
|
513
523
|
'data-testid': datatestId,
|
|
514
524
|
children
|
|
515
|
-
}) =>
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
525
|
+
}, ref) => {
|
|
526
|
+
const isInsetViewer = useIsInsetViewer();
|
|
527
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
528
|
+
ref: ref,
|
|
529
|
+
"data-testid": datatestId,
|
|
530
|
+
className: ax([!isInsetViewer && "_1p6zkb7n _1vnlkb7n _qbrxf1ug _1y2kauwl _z18o1kxc _1ghp1kxc", isInsetViewer && "_1reo15vq _18m915vq _1bsb1osq _4t3i1osq _p12f1osq _c71l1osq _1e0c1txw _4cvr1h6o _1bah1h6o _vchhusvi"])
|
|
531
|
+
}, children);
|
|
532
|
+
});
|
|
533
|
+
export const FittedVideoFrame = /*#__PURE__*/forwardRef(({
|
|
534
|
+
children
|
|
535
|
+
}, ref) => /*#__PURE__*/React.createElement("div", {
|
|
536
|
+
ref: ref,
|
|
537
|
+
className: ax(["_16jlidpf _1o9zidpf _i0dl1wug _1reo15vq _18m915vq _2rko1mok _1bsb1osq _4t3i1osq _p12f1osq _c71l1osq _1ul9idpf _1tkeidpf _1e0c1txw _4cvr1h6o _1bah1h6o"])
|
|
538
|
+
}, children));
|
|
519
539
|
export const SidebarWrapper = ({
|
|
520
540
|
'data-testid': datatestId,
|
|
521
541
|
children
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Rectangle } from '@atlaskit/media-ui/rectangle';
|
|
2
|
+
|
|
3
|
+
// Matches inset viewer header/footer horizontal padding (space.300).
|
|
4
|
+
const INSET_VIEWER_FIT_GUTTER_PX = 24;
|
|
5
|
+
export const insetFittedViewport = el => {
|
|
6
|
+
const {
|
|
7
|
+
clientWidth,
|
|
8
|
+
clientHeight
|
|
9
|
+
} = el;
|
|
10
|
+
return new Rectangle(Math.max(0, clientWidth - INSET_VIEWER_FIT_GUTTER_PX * 2), clientHeight);
|
|
11
|
+
};
|
|
@@ -1,21 +1,29 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { getArtifactUrl, globalMediaEventEmitter, isFileIdentifier } from '@atlaskit/media-client';
|
|
4
|
+
import { Camera } from '@atlaskit/media-ui/camera/camera';
|
|
4
5
|
import { CustomMediaPlayer } from '@atlaskit/media-ui/customMediaPlayer';
|
|
6
|
+
import { InsetViewerProvider } from '@atlaskit/media-ui/insetViewerProvider';
|
|
5
7
|
import { MediaPlayer } from '@atlaskit/media-ui/mediaPlayer';
|
|
8
|
+
import { Rectangle } from '@atlaskit/media-ui/rectangle';
|
|
6
9
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
7
10
|
import { buildVideoErrorDiagnostics } from '../buildVideoErrorDiagnostics';
|
|
8
11
|
import { Outcome } from '../domain/outcome';
|
|
12
|
+
import { withInsetViewerFooter } from '../insetViewerContext';
|
|
9
13
|
import { MediaViewerError } from '../MediaViewerError';
|
|
10
|
-
import { Video, CustomVideoPlayerWrapper } from '../styleWrappers';
|
|
14
|
+
import { Video, CustomVideoPlayerWrapper, FittedVideoFrame } from '../styleWrappers';
|
|
15
|
+
import { insetFittedViewport } from '../utils/fit-viewport';
|
|
11
16
|
import { getObjectUrlFromFileState } from '../utils/getObjectUrlFromFileState';
|
|
12
17
|
import { isIE } from '../utils/isIE';
|
|
13
18
|
import { BaseViewer } from './base-viewer';
|
|
14
19
|
const hdArtifact = 'video_1280.mp4';
|
|
15
20
|
const sdArtifact = 'video_640.mp4';
|
|
16
|
-
|
|
21
|
+
class _VideoViewer extends BaseViewer {
|
|
17
22
|
constructor(...args) {
|
|
18
23
|
super(...args);
|
|
24
|
+
_defineProperty(this, "insetVideoFrame", null);
|
|
25
|
+
_defineProperty(this, "insetVideo", null);
|
|
26
|
+
_defineProperty(this, "insetVideoResizeObserver", null);
|
|
19
27
|
_defineProperty(this, "onFirstPlay", () => {
|
|
20
28
|
const {
|
|
21
29
|
item,
|
|
@@ -51,6 +59,66 @@ export class VideoViewer extends BaseViewer {
|
|
|
51
59
|
}
|
|
52
60
|
onError && onError(new MediaViewerError('videoviewer-playback', secondaryError));
|
|
53
61
|
});
|
|
62
|
+
_defineProperty(this, "updateInsetVideoSize", () => {
|
|
63
|
+
const frame = this.insetVideoFrame;
|
|
64
|
+
const wrapper = frame === null || frame === void 0 ? void 0 : frame.parentElement;
|
|
65
|
+
const video = this.insetVideo;
|
|
66
|
+
if (!wrapper || !frame || !video || video.videoWidth <= 0 || video.videoHeight <= 0) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const viewport = insetFittedViewport(wrapper);
|
|
70
|
+
if (viewport.width <= 0 || viewport.height <= 0) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const camera = new Camera(viewport, new Rectangle(video.videoWidth, video.videoHeight));
|
|
74
|
+
const nextSize = camera.scaledImg(camera.scaleToFit);
|
|
75
|
+
frame.style.width = `${nextSize.width}px`;
|
|
76
|
+
frame.style.height = `${nextSize.height}px`;
|
|
77
|
+
});
|
|
78
|
+
_defineProperty(this, "unbindInsetVideoSize", () => {
|
|
79
|
+
var _this$insetVideo, _this$insetVideoResiz;
|
|
80
|
+
(_this$insetVideo = this.insetVideo) === null || _this$insetVideo === void 0 ? void 0 : _this$insetVideo.removeEventListener('loadedmetadata', this.updateInsetVideoSize);
|
|
81
|
+
(_this$insetVideoResiz = this.insetVideoResizeObserver) === null || _this$insetVideoResiz === void 0 ? void 0 : _this$insetVideoResiz.disconnect();
|
|
82
|
+
this.insetVideoResizeObserver = null;
|
|
83
|
+
});
|
|
84
|
+
_defineProperty(this, "bindInsetVideoSize", () => {
|
|
85
|
+
const frame = this.insetVideoFrame;
|
|
86
|
+
const wrapper = frame === null || frame === void 0 ? void 0 : frame.parentElement;
|
|
87
|
+
const video = this.insetVideo;
|
|
88
|
+
if (!wrapper || !frame || !video) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
video.addEventListener('loadedmetadata', this.updateInsetVideoSize);
|
|
92
|
+
if (typeof ResizeObserver !== 'undefined') {
|
|
93
|
+
this.insetVideoResizeObserver = new ResizeObserver(this.updateInsetVideoSize);
|
|
94
|
+
this.insetVideoResizeObserver.observe(wrapper);
|
|
95
|
+
}
|
|
96
|
+
this.updateInsetVideoSize();
|
|
97
|
+
});
|
|
98
|
+
_defineProperty(this, "setInsetVideo", video => {
|
|
99
|
+
this.unbindInsetVideoSize();
|
|
100
|
+
this.insetVideo = video;
|
|
101
|
+
this.bindInsetVideoSize();
|
|
102
|
+
});
|
|
103
|
+
_defineProperty(this, "setInsetVideoFrame", frame => {
|
|
104
|
+
this.unbindInsetVideoSize();
|
|
105
|
+
this.insetVideoFrame = frame;
|
|
106
|
+
this.bindInsetVideoSize();
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
componentDidMount() {
|
|
110
|
+
super.componentDidMount();
|
|
111
|
+
if (this.props.isInsetViewer) {
|
|
112
|
+
var _this$props$setHasVid, _this$props;
|
|
113
|
+
(_this$props$setHasVid = (_this$props = this.props).setHasVideoControls) === null || _this$props$setHasVid === void 0 ? void 0 : _this$props$setHasVid.call(_this$props, true);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
componentWillUnmount() {
|
|
117
|
+
if (this.props.isInsetViewer) {
|
|
118
|
+
var _this$props$setHasVid2, _this$props2;
|
|
119
|
+
(_this$props$setHasVid2 = (_this$props2 = this.props).setHasVideoControls) === null || _this$props$setHasVid2 === void 0 ? void 0 : _this$props$setHasVid2.call(_this$props2, false);
|
|
120
|
+
}
|
|
121
|
+
super.componentWillUnmount();
|
|
54
122
|
}
|
|
55
123
|
get initialState() {
|
|
56
124
|
return {
|
|
@@ -62,14 +130,31 @@ export class VideoViewer extends BaseViewer {
|
|
|
62
130
|
item,
|
|
63
131
|
showControls,
|
|
64
132
|
previewCount,
|
|
65
|
-
identifier
|
|
133
|
+
identifier,
|
|
134
|
+
isInsetViewer,
|
|
135
|
+
mediaFooterControls
|
|
66
136
|
} = this.props;
|
|
67
137
|
const useCustomVideoPlayer = !isIE();
|
|
68
138
|
const isAutoPlay = previewCount === 0;
|
|
69
139
|
const hdAvailable = isHDAvailable(item);
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
140
|
+
if (!useCustomVideoPlayer) {
|
|
141
|
+
if (!isInsetViewer) {
|
|
142
|
+
return /*#__PURE__*/React.createElement(Video, {
|
|
143
|
+
autoPlay: isAutoPlay,
|
|
144
|
+
controls: true,
|
|
145
|
+
src: content
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
return /*#__PURE__*/React.createElement(CustomVideoPlayerWrapper, null, /*#__PURE__*/React.createElement(FittedVideoFrame, {
|
|
149
|
+
ref: this.setInsetVideoFrame
|
|
150
|
+
}, /*#__PURE__*/React.createElement(Video, {
|
|
151
|
+
autoPlay: isAutoPlay,
|
|
152
|
+
controls: true,
|
|
153
|
+
src: content,
|
|
154
|
+
onVideoElementChange: this.setInsetVideo
|
|
155
|
+
})));
|
|
156
|
+
}
|
|
157
|
+
const playerElement = isFileIdentifier(identifier) && fg('platform_media_video_captions') ? /*#__PURE__*/React.createElement(MediaPlayer, {
|
|
73
158
|
identifier: identifier,
|
|
74
159
|
type: "video",
|
|
75
160
|
isAutoPlay: isAutoPlay,
|
|
@@ -82,6 +167,8 @@ export class VideoViewer extends BaseViewer {
|
|
|
82
167
|
onError: this.onError,
|
|
83
168
|
onPlay: this.onPlay,
|
|
84
169
|
onTimeChanged: this.onTimeChanged,
|
|
170
|
+
controlsPortalElement: mediaFooterControls,
|
|
171
|
+
onVideoElementChange: isInsetViewer ? this.setInsetVideo : undefined,
|
|
85
172
|
lastWatchTimeConfig: {
|
|
86
173
|
contentId: item.id
|
|
87
174
|
}
|
|
@@ -98,14 +185,20 @@ export class VideoViewer extends BaseViewer {
|
|
|
98
185
|
onError: this.onError,
|
|
99
186
|
onPlay: this.onPlay,
|
|
100
187
|
onTimeChanged: this.onTimeChanged,
|
|
188
|
+
controlsPortalElement: mediaFooterControls,
|
|
189
|
+
onVideoElementChange: isInsetViewer ? this.setInsetVideo : undefined,
|
|
101
190
|
lastWatchTimeConfig: {
|
|
102
191
|
contentId: item.id
|
|
103
192
|
}
|
|
104
|
-
})) : /*#__PURE__*/React.createElement(Video, {
|
|
105
|
-
autoPlay: isAutoPlay,
|
|
106
|
-
controls: true,
|
|
107
|
-
src: content
|
|
108
193
|
});
|
|
194
|
+
const player = /*#__PURE__*/React.createElement(InsetViewerProvider, {
|
|
195
|
+
isInsetViewer: isInsetViewer
|
|
196
|
+
}, playerElement);
|
|
197
|
+
return /*#__PURE__*/React.createElement(CustomVideoPlayerWrapper, {
|
|
198
|
+
"data-testid": "media-viewer-video-content"
|
|
199
|
+
}, isInsetViewer ? /*#__PURE__*/React.createElement(FittedVideoFrame, {
|
|
200
|
+
ref: this.setInsetVideoFrame
|
|
201
|
+
}, player) : player);
|
|
109
202
|
}
|
|
110
203
|
async init() {
|
|
111
204
|
const {
|
|
@@ -149,11 +242,16 @@ export class VideoViewer extends BaseViewer {
|
|
|
149
242
|
});
|
|
150
243
|
}
|
|
151
244
|
}
|
|
152
|
-
release() {
|
|
245
|
+
release() {
|
|
246
|
+
this.unbindInsetVideoSize();
|
|
247
|
+
this.insetVideo = null;
|
|
248
|
+
this.insetVideoFrame = null;
|
|
249
|
+
}
|
|
153
250
|
}
|
|
154
251
|
function isHDAvailable(file) {
|
|
155
252
|
if (file.status !== 'processed') {
|
|
156
253
|
return false;
|
|
157
254
|
}
|
|
158
255
|
return !!getArtifactUrl(file.artifacts, hdArtifact);
|
|
159
|
-
}
|
|
256
|
+
}
|
|
257
|
+
export const VideoViewer = withInsetViewerFooter(_VideoViewer);
|
|
@@ -7,7 +7,7 @@ import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
|
7
7
|
import { UFOExperience } from '@atlaskit/ufo/experience';
|
|
8
8
|
import { ExperiencePerformanceTypes, ExperienceTypes } from '@atlaskit/ufo/experience-types';
|
|
9
9
|
var packageName = "@atlaskit/media-viewer";
|
|
10
|
-
var packageVersion = "54.
|
|
10
|
+
var packageVersion = "54.11.1";
|
|
11
11
|
var ufoExperience;
|
|
12
12
|
var getExperience = function getExperience() {
|
|
13
13
|
if (!ufoExperience) {
|
|
@@ -6,6 +6,10 @@ var InsetViewerContext = /*#__PURE__*/createContext(false);
|
|
|
6
6
|
// The inset media footer element, once mounted, so controls can portal into it.
|
|
7
7
|
var MediaFooterControlsContext = /*#__PURE__*/createContext(null);
|
|
8
8
|
var SetMediaFooterControlsContext = /*#__PURE__*/createContext(function () {});
|
|
9
|
+
|
|
10
|
+
// Whether a viewer has registered video controls in the footer, which gives the footer extra room.
|
|
11
|
+
var HasMediaFooterVideoControlsContext = /*#__PURE__*/createContext(false);
|
|
12
|
+
var SetHasMediaFooterVideoControlsContext = /*#__PURE__*/createContext(function () {});
|
|
9
13
|
export var InsetViewerProvider = function InsetViewerProvider(_ref) {
|
|
10
14
|
var _ref$isInsetViewer = _ref.isInsetViewer,
|
|
11
15
|
isInsetViewer = _ref$isInsetViewer === void 0 ? false : _ref$isInsetViewer,
|
|
@@ -14,13 +18,21 @@ export var InsetViewerProvider = function InsetViewerProvider(_ref) {
|
|
|
14
18
|
_useState2 = _slicedToArray(_useState, 2),
|
|
15
19
|
mediaFooterControls = _useState2[0],
|
|
16
20
|
setMediaFooterControls = _useState2[1];
|
|
21
|
+
var _useState3 = useState(false),
|
|
22
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
23
|
+
hasVideoControls = _useState4[0],
|
|
24
|
+
setHasVideoControls = _useState4[1];
|
|
17
25
|
return /*#__PURE__*/React.createElement(InsetViewerContext.Provider, {
|
|
18
26
|
value: isInsetViewer
|
|
19
27
|
}, /*#__PURE__*/React.createElement(SetMediaFooterControlsContext.Provider, {
|
|
20
28
|
value: setMediaFooterControls
|
|
21
29
|
}, /*#__PURE__*/React.createElement(MediaFooterControlsContext.Provider, {
|
|
22
30
|
value: mediaFooterControls
|
|
23
|
-
},
|
|
31
|
+
}, /*#__PURE__*/React.createElement(SetHasMediaFooterVideoControlsContext.Provider, {
|
|
32
|
+
value: setHasVideoControls
|
|
33
|
+
}, /*#__PURE__*/React.createElement(HasMediaFooterVideoControlsContext.Provider, {
|
|
34
|
+
value: hasVideoControls
|
|
35
|
+
}, children)))));
|
|
24
36
|
};
|
|
25
37
|
export var useIsInsetViewer = function useIsInsetViewer() {
|
|
26
38
|
return useContext(InsetViewerContext);
|
|
@@ -31,6 +43,12 @@ export var useMediaFooterControls = function useMediaFooterControls() {
|
|
|
31
43
|
export var useSetMediaFooterControls = function useSetMediaFooterControls() {
|
|
32
44
|
return useContext(SetMediaFooterControlsContext);
|
|
33
45
|
};
|
|
46
|
+
export var useHasMediaFooterVideoControls = function useHasMediaFooterVideoControls() {
|
|
47
|
+
return useContext(HasMediaFooterVideoControlsContext);
|
|
48
|
+
};
|
|
49
|
+
export var useSetHasMediaFooterVideoControls = function useSetHasMediaFooterVideoControls() {
|
|
50
|
+
return useContext(SetHasMediaFooterVideoControlsContext);
|
|
51
|
+
};
|
|
34
52
|
export var withInsetViewer = function withInsetViewer(WrappedComponent) {
|
|
35
53
|
var WithInsetViewer = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
36
54
|
var isInsetViewer = useIsInsetViewer();
|
|
@@ -46,10 +64,12 @@ export var withInsetViewerFooter = function withInsetViewerFooter(WrappedCompone
|
|
|
46
64
|
var WithInsetViewerFooter = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
47
65
|
var isInsetViewer = useIsInsetViewer();
|
|
48
66
|
var mediaFooterControls = useMediaFooterControls();
|
|
67
|
+
var setHasVideoControls = useSetHasMediaFooterVideoControls();
|
|
49
68
|
return /*#__PURE__*/React.createElement(WrappedComponent, _extends({}, props, {
|
|
50
69
|
ref: ref,
|
|
51
70
|
isInsetViewer: isInsetViewer,
|
|
52
|
-
mediaFooterControls: mediaFooterControls
|
|
71
|
+
mediaFooterControls: mediaFooterControls,
|
|
72
|
+
setHasVideoControls: setHasVideoControls
|
|
53
73
|
}));
|
|
54
74
|
});
|
|
55
75
|
WithInsetViewerFooter.displayName = "WithInsetViewerFooter(".concat(WrappedComponent.displayName || WrappedComponent.name || 'Component', ")");
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
._11q75a80{background:linear-gradient(180deg,#101214,rgba(14,22,36,0)) no-repeat}
|
|
2
2
|
._151kfhey._151kfhey h1{font:var(--ds-font-body,normal 400 14px/20px "Atlassian Sans",ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
|
|
3
|
+
._2rko1mok{border-radius:var(--ds-radius-large,8px)}
|
|
3
4
|
._2rkofajl{border-radius:var(--ds-radius-small,3px)}
|
|
4
5
|
._2rkopb1k{border-radius:var(--ds-radius-xlarge,9pt)}
|
|
5
6
|
._zulp1b66{gap:var(--ds-space-050,4px)}
|
|
@@ -46,6 +47,7 @@
|
|
|
46
47
|
._1e0c11p5{display:grid}
|
|
47
48
|
._1e0c1o8l{display:inline-block}
|
|
48
49
|
._1e0c1txw{display:flex}
|
|
50
|
+
._1e0c1ule{display:block}
|
|
49
51
|
._1ghp1kxc video{max-height:100vh}
|
|
50
52
|
._1il9nqa1{border-bottom-style:solid}
|
|
51
53
|
._1itkdlpg{background-image:linear-gradient(0deg,#101214,rgba(14,22,36,0))}
|
|
@@ -92,6 +94,7 @@
|
|
|
92
94
|
._4cvr1fhb{align-items:stretch}
|
|
93
95
|
._4cvr1h6o{align-items:center}
|
|
94
96
|
._4cvresu3{align-items:flex-end}
|
|
97
|
+
._4t3i11a6{height:var(--_1goz90u)}
|
|
95
98
|
._4t3i1kdj{height:25pc}
|
|
96
99
|
._4t3i1kxc{height:100vh}
|
|
97
100
|
._4t3i1osq{height:100%}
|
|
@@ -99,6 +102,7 @@
|
|
|
99
102
|
._4t3ixncg{height:var(--ds-space-800,4pc)}
|
|
100
103
|
._4t3ixy5q{height:var(--ds-space-400,2pc)}
|
|
101
104
|
._4t3izwfg{height:2pc}
|
|
105
|
+
._5ral1f51{object-fit:contain}
|
|
102
106
|
._5ralzm06{object-fit:scale-down}
|
|
103
107
|
._5wra1l7x{border-left-color:var(--ds-border,#0b120e24)}
|
|
104
108
|
._6fl4v1ec{transition-timing-function:var(--ds-easing-out-bold,cubic-bezier(0,.4,0,1))}
|
|
@@ -18,7 +18,7 @@ import Motion from '@atlaskit/motion/entering/motion';
|
|
|
18
18
|
import ExitingPersistence from '@atlaskit/motion/exiting-persistence';
|
|
19
19
|
// eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
|
|
20
20
|
import { Box, xcss } from '@atlaskit/primitives';
|
|
21
|
-
import { useIsInsetViewer, useSetMediaFooterControls } from './insetViewerContext';
|
|
21
|
+
import { useHasMediaFooterVideoControls, useIsInsetViewer, useSetMediaFooterControls } from './insetViewerContext';
|
|
22
22
|
var INSET_HEADER_HEIGHT = "var(--ds-space-800, 64px)";
|
|
23
23
|
var INSET_SIDEBAR_WIDTH = '400px';
|
|
24
24
|
|
|
@@ -45,6 +45,7 @@ var insetViewerSidebarHeaderContentStyles = null;
|
|
|
45
45
|
var insetViewerSidebarHeaderTitleStyles = null;
|
|
46
46
|
var insetViewerMediaStageStyles = null;
|
|
47
47
|
var insetViewerMediaFooterBarStyles = null;
|
|
48
|
+
var insetViewerVideoMediaFooterBarStyles = null;
|
|
48
49
|
var listWrapperStyles = null;
|
|
49
50
|
var insetViewerListWrapperStyles = null;
|
|
50
51
|
var itemStageStyles = null;
|
|
@@ -64,6 +65,7 @@ var hdIconGroupWrapperStyles = null;
|
|
|
64
65
|
var errorMessageWrapperStyles = null;
|
|
65
66
|
var errorImageStyles = null;
|
|
66
67
|
var videoStyles = null;
|
|
68
|
+
var insetViewerVideoStyles = null;
|
|
67
69
|
var pdfWrapperStyles = null;
|
|
68
70
|
var arrowStyles = null;
|
|
69
71
|
var arrowWrapperStyles = null;
|
|
@@ -104,6 +106,8 @@ var audioCoverStyles = null;
|
|
|
104
106
|
var defaultCoverWrapperStyles = null;
|
|
105
107
|
var downloadButtonWrapperStyles = null;
|
|
106
108
|
var customVideoPlayerWrapperStyles = null;
|
|
109
|
+
var insetViewerCustomVideoPlayerWrapperStyles = null;
|
|
110
|
+
var insetViewerFittedVideoFrameStyles = null;
|
|
107
111
|
var sidebarWrapperStyles = null;
|
|
108
112
|
var insetViewerSidebarWrapperStyles = null;
|
|
109
113
|
var spinnerWrapperStyles = null;
|
|
@@ -204,10 +208,14 @@ export var MediaStage = function MediaStage(_ref9) {
|
|
|
204
208
|
};
|
|
205
209
|
export var MediaFooterBar = function MediaFooterBar() {
|
|
206
210
|
var setMediaFooterControls = useSetMediaFooterControls();
|
|
211
|
+
var hasVideoControls = useHasMediaFooterVideoControls();
|
|
207
212
|
return /*#__PURE__*/React.createElement("div", {
|
|
208
213
|
ref: setMediaFooterControls,
|
|
209
214
|
"data-testid": "media-viewer-media-footer",
|
|
210
|
-
className: ax(["_1reoewfl _18m9ewfl _1o9zidpf _4t3ixncg _vchhusvi _1bsb1osq _1e0c1txw _4cvr1h6o _1bah1h6o _ca0qpxbi _u5f31ejb _n3tdpxbi _19bv1ejb _kqswh2mm _lcxv1rj4"])
|
|
215
|
+
className: ax(["_1reoewfl _18m9ewfl _1o9zidpf _4t3ixncg _vchhusvi _1bsb1osq _1e0c1txw _4cvr1h6o _1bah1h6o _ca0qpxbi _u5f31ejb _n3tdpxbi _19bv1ejb _kqswh2mm _lcxv1rj4", hasVideoControls && "_4t3i11a6 _ca0qv47k"]),
|
|
216
|
+
style: {
|
|
217
|
+
"--_1goz90u": ix("calc(".concat(INSET_HEADER_HEIGHT, " + ", "var(--ds-space-050, 4px)", ")"))
|
|
218
|
+
}
|
|
211
219
|
});
|
|
212
220
|
};
|
|
213
221
|
export var ListWrapper = function ListWrapper(_ref0) {
|
|
@@ -303,12 +311,15 @@ export var ErrorImage = function ErrorImage(_ref19) {
|
|
|
303
311
|
export var Video = function Video(_ref20) {
|
|
304
312
|
var autoPlay = _ref20.autoPlay,
|
|
305
313
|
controls = _ref20.controls,
|
|
306
|
-
src = _ref20.src
|
|
314
|
+
src = _ref20.src,
|
|
315
|
+
onVideoElementChange = _ref20.onVideoElementChange;
|
|
316
|
+
var isInsetViewer = useIsInsetViewer();
|
|
307
317
|
return /*#__PURE__*/React.createElement("video", {
|
|
318
|
+
ref: onVideoElementChange,
|
|
308
319
|
autoPlay: autoPlay,
|
|
309
320
|
controls: controls,
|
|
310
321
|
src: src,
|
|
311
|
-
className: ax(["_1bsbauwl _4t3i1kxc"])
|
|
322
|
+
className: ax([!isInsetViewer && "_1bsbauwl _4t3i1kxc", isInsetViewer && "_16jlidpf _1o9zidpf _i0dl1wug _2rko1mok _1reo15vq _18m915vq _1e0c1ule _1bsb1osq _4t3i1osq _p12f1osq _c71l1osq _1ul9idpf _1tkeidpf _5ral1f51"])
|
|
312
323
|
});
|
|
313
324
|
};
|
|
314
325
|
var PDFWrapperBody = /*#__PURE__*/forwardRef(function (_ref21, ref) {
|
|
@@ -525,30 +536,39 @@ export var DownloadButtonWrapper = function DownloadButtonWrapper(_ref40) {
|
|
|
525
536
|
className: ax(["_19pk1ejb _y3gn1h6o _1sfy1fjg _4pkp1fjg"])
|
|
526
537
|
}, children);
|
|
527
538
|
};
|
|
528
|
-
export var CustomVideoPlayerWrapper = function
|
|
539
|
+
export var CustomVideoPlayerWrapper = /*#__PURE__*/forwardRef(function (_ref41, ref) {
|
|
529
540
|
var datatestId = _ref41['data-testid'],
|
|
530
541
|
children = _ref41.children;
|
|
542
|
+
var isInsetViewer = useIsInsetViewer();
|
|
531
543
|
return /*#__PURE__*/React.createElement("div", {
|
|
544
|
+
ref: ref,
|
|
532
545
|
"data-testid": datatestId,
|
|
533
|
-
className: ax(["_1p6zkb7n _1vnlkb7n _qbrxf1ug _1y2kauwl _z18o1kxc _1ghp1kxc"])
|
|
546
|
+
className: ax([!isInsetViewer && "_1p6zkb7n _1vnlkb7n _qbrxf1ug _1y2kauwl _z18o1kxc _1ghp1kxc", isInsetViewer && "_1reo15vq _18m915vq _1bsb1osq _4t3i1osq _p12f1osq _c71l1osq _1e0c1txw _4cvr1h6o _1bah1h6o _vchhusvi"])
|
|
534
547
|
}, children);
|
|
535
|
-
};
|
|
536
|
-
export var
|
|
537
|
-
var
|
|
538
|
-
|
|
548
|
+
});
|
|
549
|
+
export var FittedVideoFrame = /*#__PURE__*/forwardRef(function (_ref42, ref) {
|
|
550
|
+
var children = _ref42.children;
|
|
551
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
552
|
+
ref: ref,
|
|
553
|
+
className: ax(["_16jlidpf _1o9zidpf _i0dl1wug _1reo15vq _18m915vq _2rko1mok _1bsb1osq _4t3i1osq _p12f1osq _c71l1osq _1ul9idpf _1tkeidpf _1e0c1txw _4cvr1h6o _1bah1h6o"])
|
|
554
|
+
}, children);
|
|
555
|
+
});
|
|
556
|
+
export var SidebarWrapper = function SidebarWrapper(_ref43) {
|
|
557
|
+
var datatestId = _ref43['data-testid'],
|
|
558
|
+
children = _ref43.children;
|
|
539
559
|
var isInsetViewer = useIsInsetViewer();
|
|
540
560
|
return /*#__PURE__*/React.createElement("div", {
|
|
541
561
|
"data-testid": datatestId,
|
|
542
562
|
className: ax(["_1reo15vq _18m91wug _154iidpf _1xi2idpf _1bsb1ber _4t3i1kxc _bfhkvuon _syazi7uo", isInsetViewer && "_16jlkb7n _1o9zkb7n _i0dlf1ug _1reo15vq _18m91wug _kqswh2mm _154i1wug _1xi21wug _1bsb1kdj _1ul91kdj _1tkeidpf _vchhusvi _bfhk1bhr _t6vde4h9 _1p3lnqa1 _5wra1l7x"])
|
|
543
563
|
}, children);
|
|
544
564
|
};
|
|
545
|
-
export var SpinnerWrapper = function SpinnerWrapper(
|
|
546
|
-
var children =
|
|
565
|
+
export var SpinnerWrapper = function SpinnerWrapper(_ref44) {
|
|
566
|
+
var children = _ref44.children;
|
|
547
567
|
return /*#__PURE__*/React.createElement("div", {
|
|
548
568
|
className: ax(["_1e0c1txw _1bah1h6o _4cvr1h6o _4t3i1osq"])
|
|
549
569
|
}, children);
|
|
550
570
|
};
|
|
551
|
-
export var FormattedMessageWrapper = function FormattedMessageWrapper(
|
|
552
|
-
var children =
|
|
571
|
+
export var FormattedMessageWrapper = function FormattedMessageWrapper(_ref45) {
|
|
572
|
+
var children = _ref45.children;
|
|
553
573
|
return /*#__PURE__*/React.createElement("span", null, children);
|
|
554
574
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Rectangle } from '@atlaskit/media-ui/rectangle';
|
|
2
|
+
|
|
3
|
+
// Matches inset viewer header/footer horizontal padding (space.300).
|
|
4
|
+
var INSET_VIEWER_FIT_GUTTER_PX = 24;
|
|
5
|
+
export var insetFittedViewport = function insetFittedViewport(el) {
|
|
6
|
+
var clientWidth = el.clientWidth,
|
|
7
|
+
clientHeight = el.clientHeight;
|
|
8
|
+
return new Rectangle(Math.max(0, clientWidth - INSET_VIEWER_FIT_GUTTER_PX * 2), clientHeight);
|
|
9
|
+
};
|