@elice/material-video-file 1.220920.0 → 1.221028.0
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/cjs/components/material-video-file/MaterialVideoFile.d.ts +3 -2
- package/cjs/components/material-video-file/MaterialVideoFile.js +9 -15
- package/cjs/components/material-video-file/MaterialVideoFilePlayer.d.ts +54 -0
- package/cjs/components/material-video-file/MaterialVideoFilePlayer.js +223 -0
- package/cjs/components/{video-player/VideoPlayer.styled.js → material-video-file/MaterialVideoFilePlayer.styled.js} +3 -3
- package/cjs/components/material-video-file/locales.d.ts +2 -1
- package/cjs/components/material-video-file/locales.js +4 -2
- package/es/components/material-video-file/MaterialVideoFile.d.ts +3 -2
- package/es/components/material-video-file/MaterialVideoFile.js +10 -16
- package/es/components/material-video-file/MaterialVideoFilePlayer.d.ts +54 -0
- package/es/components/material-video-file/MaterialVideoFilePlayer.js +216 -0
- package/es/components/{video-player/VideoPlayer.styled.js → material-video-file/MaterialVideoFilePlayer.styled.js} +3 -3
- package/es/components/material-video-file/locales.d.ts +2 -1
- package/es/components/material-video-file/locales.js +4 -2
- package/package.json +8 -8
- package/cjs/components/video-player/VideoPlayer.d.ts +0 -39
- package/cjs/components/video-player/VideoPlayer.js +0 -158
- package/cjs/components/video-player/index.d.ts +0 -2
- package/es/components/video-player/VideoPlayer.d.ts +0 -39
- package/es/components/video-player/VideoPlayer.js +0 -150
- package/es/components/video-player/index.d.ts +0 -2
- /package/cjs/components/{video-player/VideoPlayer.styled.d.ts → material-video-file/MaterialVideoFilePlayer.styled.d.ts} +0 -0
- /package/es/components/{video-player/VideoPlayer.styled.d.ts → material-video-file/MaterialVideoFilePlayer.styled.d.ts} +0 -0
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type {
|
|
3
|
-
declare type PickedVideoPlayerProps = Pick<
|
|
2
|
+
import type { MaterialVideoFilePlayerProps } from './MaterialVideoFilePlayer';
|
|
3
|
+
declare type PickedVideoPlayerProps = Pick<MaterialVideoFilePlayerProps, 'materialVideoFileTrackerDisabled' | 'mainLecturePageId' | 'lms' | 'lmsOrganizationBusinessType' | 'emptyComponent' | 'autoPlay' | 'autoPlayNext' | 'endControl' | 'eliceVideoPlayerUrl' | 'onNavigatePreviousLecturePage' | 'onNavigateNextLecturePage'>;
|
|
4
4
|
export interface MaterialVideoFileProps extends PickedVideoPlayerProps {
|
|
5
5
|
materialVideoFileId: number;
|
|
6
|
+
className?: string;
|
|
6
7
|
locale?: string;
|
|
7
8
|
}
|
|
8
9
|
declare const MaterialVideoFile: React.FC<MaterialVideoFileProps>;
|
|
@@ -4,11 +4,10 @@ var tslib = require('tslib');
|
|
|
4
4
|
var React = require('react');
|
|
5
5
|
var reactIntl = require('react-intl');
|
|
6
6
|
var apiClient = require('@elice/api-client');
|
|
7
|
-
var blocks = require('@elice/blocks');
|
|
8
7
|
var materialSharedUtils = require('@elice/material-shared-utils');
|
|
9
8
|
var classnames = require('classnames');
|
|
10
|
-
var VideoPlayer = require('../video-player/VideoPlayer.js');
|
|
11
9
|
var locales = require('./locales.js');
|
|
10
|
+
var MaterialVideoFilePlayer = require('./MaterialVideoFilePlayer.js');
|
|
12
11
|
var MaterialVideoFile_styled = require('./MaterialVideoFile.styled.js');
|
|
13
12
|
|
|
14
13
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -17,14 +16,14 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
17
16
|
var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
|
|
18
17
|
|
|
19
18
|
const MaterialVideoFile = _a => {
|
|
20
|
-
var _b;
|
|
19
|
+
var _b, _c, _d;
|
|
21
20
|
|
|
22
21
|
var {
|
|
23
22
|
materialVideoFileId,
|
|
24
23
|
className,
|
|
25
24
|
locale = 'en'
|
|
26
25
|
} = _a,
|
|
27
|
-
|
|
26
|
+
playerProps = tslib.__rest(_a, ["materialVideoFileId", "className", "locale"]);
|
|
28
27
|
|
|
29
28
|
const prefixCls = 'em-material-video-file';
|
|
30
29
|
const {
|
|
@@ -34,27 +33,22 @@ const MaterialVideoFile = _a => {
|
|
|
34
33
|
materialVideoFileId
|
|
35
34
|
}, {
|
|
36
35
|
signal
|
|
37
|
-
}), [materialVideoFileId]));
|
|
38
|
-
|
|
39
|
-
const makeOtpKey = async () => {
|
|
40
|
-
return apiClient.postGlobalAuthOtpKeyMake().then(res => res.otpKey);
|
|
41
|
-
}; //
|
|
36
|
+
}), [materialVideoFileId])); //
|
|
42
37
|
//
|
|
43
38
|
//
|
|
44
39
|
|
|
45
|
-
|
|
46
40
|
return React__default["default"].createElement(MaterialVideoFile_styled.StyledMaterialVideoFileWrap, {
|
|
47
41
|
className: classnames__default["default"](prefixCls, className)
|
|
48
42
|
}, React__default["default"].createElement(reactIntl.IntlProvider, {
|
|
49
43
|
locale: locale,
|
|
50
44
|
defaultLocale: "en",
|
|
51
45
|
messages: locale in locales ? locales[locale] : locales.en
|
|
52
|
-
},
|
|
53
|
-
material: (_b = materialVideoFile === null || materialVideoFile === void 0 ? void 0 : materialVideoFile.materialVideoFile) !== null && _b !== void 0 ? _b : null,
|
|
46
|
+
}, React__default["default"].createElement(MaterialVideoFilePlayer, Object.assign({}, playerProps, {
|
|
54
47
|
orgNameShort: orgNameShort,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
48
|
+
materialVideoFile: (_b = materialVideoFile === null || materialVideoFile === void 0 ? void 0 : materialVideoFile.materialVideoFile) !== null && _b !== void 0 ? _b : null,
|
|
49
|
+
materialVideoFileStatus: materialVideoFileStatus,
|
|
50
|
+
title: (_d = (_c = materialVideoFile === null || materialVideoFile === void 0 ? void 0 : materialVideoFile.materialVideoFile.azureMediaVideo) === null || _c === void 0 ? void 0 : _c.videoAssetName) !== null && _d !== void 0 ? _d : undefined
|
|
51
|
+
}))));
|
|
58
52
|
};
|
|
59
53
|
|
|
60
54
|
module.exports = MaterialVideoFile;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { APIStatus } from '@elice/material-shared-types';
|
|
3
|
+
import type { EliceVideoPlayerSearchParams, GetOrgMaterialVideoFileGetResponses } from '@elice/types';
|
|
4
|
+
export interface MaterialVideoFilePlayerProps {
|
|
5
|
+
/** Classname for the element. */
|
|
6
|
+
className?: string;
|
|
7
|
+
/** Material video file. */
|
|
8
|
+
materialVideoFile: null | GetOrgMaterialVideoFileGetResponses['materialVideoFile'];
|
|
9
|
+
/** Fetch status of material video file. */
|
|
10
|
+
materialVideoFileStatus?: APIStatus;
|
|
11
|
+
/** Disable material video file tracker. */
|
|
12
|
+
materialVideoFileTrackerDisabled?: EliceVideoPlayerSearchParams['notrack'];
|
|
13
|
+
/**
|
|
14
|
+
* Linked material (main lecture page) ID.
|
|
15
|
+
* If this is set, the material assumed as sub lecture page.
|
|
16
|
+
*/
|
|
17
|
+
mainLecturePageId?: EliceVideoPlayerSearchParams['lmid'];
|
|
18
|
+
/** Organization name short. */
|
|
19
|
+
orgNameShort: EliceVideoPlayerSearchParams['org'];
|
|
20
|
+
/** Run in LMS env? */
|
|
21
|
+
lms?: EliceVideoPlayerSearchParams['lms'];
|
|
22
|
+
/** Type of LMS org business. */
|
|
23
|
+
lmsOrganizationBusinessType?: EliceVideoPlayerSearchParams['lmstype'];
|
|
24
|
+
/** Auto play. */
|
|
25
|
+
autoPlay?: EliceVideoPlayerSearchParams['autoplay'];
|
|
26
|
+
/** Auto play next lecture page. */
|
|
27
|
+
autoPlayNext?: EliceVideoPlayerSearchParams['autoplaynext'];
|
|
28
|
+
/** End control overlay. */
|
|
29
|
+
endControl?: EliceVideoPlayerSearchParams['endctrl'];
|
|
30
|
+
/** Locale. */
|
|
31
|
+
locale?: EliceVideoPlayerSearchParams['locale'];
|
|
32
|
+
/** Elice video player url. */
|
|
33
|
+
eliceVideoPlayerUrl?: string;
|
|
34
|
+
/** Empty component. */
|
|
35
|
+
emptyComponent: React.ReactNode;
|
|
36
|
+
/** Title of player. (set on iframe) */
|
|
37
|
+
title?: string;
|
|
38
|
+
/** Navigate to previous lecture page. */
|
|
39
|
+
onNavigatePreviousLecturePage?: () => void;
|
|
40
|
+
/** Navigate to next lecture page. */
|
|
41
|
+
onNavigateNextLecturePage?: () => void;
|
|
42
|
+
}
|
|
43
|
+
declare enum VideoMimeType {
|
|
44
|
+
/** `application/vnd.ms-sstr+xml` */
|
|
45
|
+
Smooth = "application/vnd.ms-sstr+xml",
|
|
46
|
+
/** `application/vnd.apple.mpegurl` */
|
|
47
|
+
Hls = "application/vnd.apple.mpegurl",
|
|
48
|
+
/** `application/dash+xml` */
|
|
49
|
+
Mpeg = "application/dash+xml"
|
|
50
|
+
}
|
|
51
|
+
declare const _default: React.FC<MaterialVideoFilePlayerProps> & {
|
|
52
|
+
MimeType: typeof VideoMimeType;
|
|
53
|
+
};
|
|
54
|
+
export default _default;
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var reactIntl = require('react-intl');
|
|
5
|
+
var apiClient = require('@elice/api-client');
|
|
6
|
+
var blocks = require('@elice/blocks');
|
|
7
|
+
var types = require('@elice/types');
|
|
8
|
+
var classnames = require('classnames');
|
|
9
|
+
var MaterialVideoFilePlayer_styled = require('./MaterialVideoFilePlayer.styled.js');
|
|
10
|
+
|
|
11
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
12
|
+
|
|
13
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
14
|
+
var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
|
|
15
|
+
|
|
16
|
+
var VideoUploadStatus;
|
|
17
|
+
|
|
18
|
+
(function (VideoUploadStatus) {
|
|
19
|
+
VideoUploadStatus[VideoUploadStatus["Empty"] = 0] = "Empty";
|
|
20
|
+
VideoUploadStatus[VideoUploadStatus["Encoding"] = 1] = "Encoding";
|
|
21
|
+
VideoUploadStatus[VideoUploadStatus["EncodingFailed"] = 2] = "EncodingFailed";
|
|
22
|
+
VideoUploadStatus[VideoUploadStatus["Ready"] = 3] = "Ready";
|
|
23
|
+
})(VideoUploadStatus || (VideoUploadStatus = {}));
|
|
24
|
+
|
|
25
|
+
var VideoMimeType;
|
|
26
|
+
|
|
27
|
+
(function (VideoMimeType) {
|
|
28
|
+
/** `application/vnd.ms-sstr+xml` */
|
|
29
|
+
VideoMimeType["Smooth"] = "application/vnd.ms-sstr+xml";
|
|
30
|
+
/** `application/vnd.apple.mpegurl` */
|
|
31
|
+
|
|
32
|
+
VideoMimeType["Hls"] = "application/vnd.apple.mpegurl";
|
|
33
|
+
/** `application/dash+xml` */
|
|
34
|
+
|
|
35
|
+
VideoMimeType["Mpeg"] = "application/dash+xml";
|
|
36
|
+
})(VideoMimeType || (VideoMimeType = {}));
|
|
37
|
+
|
|
38
|
+
const ELICE_VIDEO_PLAYER_MESSAGE_EVENT = 'elice-video-player';
|
|
39
|
+
const ELICE_VIDEO_PLAYER_MESSAGE_TYPE = 'navigate';
|
|
40
|
+
|
|
41
|
+
const MaterialVideoFilePlayer = ({
|
|
42
|
+
className,
|
|
43
|
+
materialVideoFile,
|
|
44
|
+
materialVideoFileStatus = 'idle',
|
|
45
|
+
materialVideoFileTrackerDisabled = false,
|
|
46
|
+
mainLecturePageId,
|
|
47
|
+
orgNameShort,
|
|
48
|
+
lms = false,
|
|
49
|
+
lmsOrganizationBusinessType = null,
|
|
50
|
+
autoPlay = false,
|
|
51
|
+
autoPlayNext = false,
|
|
52
|
+
endControl = false,
|
|
53
|
+
locale,
|
|
54
|
+
eliceVideoPlayerUrl,
|
|
55
|
+
emptyComponent = null,
|
|
56
|
+
title = 'elice-video-player',
|
|
57
|
+
onNavigatePreviousLecturePage,
|
|
58
|
+
onNavigateNextLecturePage
|
|
59
|
+
}) => {
|
|
60
|
+
const prefixCls = 'em-video-player';
|
|
61
|
+
const [playerFrameSrc, setPlayerFrameSrc] = React__default["default"].useState(null);
|
|
62
|
+
/**
|
|
63
|
+
* Current video status.
|
|
64
|
+
*/
|
|
65
|
+
|
|
66
|
+
const materialVideoFileUploadStatus = React__default["default"].useMemo(() => {
|
|
67
|
+
var _a, _b, _c, _d;
|
|
68
|
+
|
|
69
|
+
switch (true) {
|
|
70
|
+
case typeof ((_a = materialVideoFile === null || materialVideoFile === void 0 ? void 0 : materialVideoFile.azureMediaVideo) === null || _a === void 0 ? void 0 : _a.status) === 'undefined':
|
|
71
|
+
return VideoUploadStatus.Empty;
|
|
72
|
+
|
|
73
|
+
case ((_b = materialVideoFile === null || materialVideoFile === void 0 ? void 0 : materialVideoFile.azureMediaVideo) === null || _b === void 0 ? void 0 : _b.status) === types.enums.AzureMediaVideoStatus.Encoding:
|
|
74
|
+
return VideoUploadStatus.Encoding;
|
|
75
|
+
|
|
76
|
+
case ((_c = materialVideoFile === null || materialVideoFile === void 0 ? void 0 : materialVideoFile.azureMediaVideo) === null || _c === void 0 ? void 0 : _c.status) === types.enums.AzureMediaVideoStatus.Error:
|
|
77
|
+
return VideoUploadStatus.EncodingFailed;
|
|
78
|
+
|
|
79
|
+
case ((_d = materialVideoFile === null || materialVideoFile === void 0 ? void 0 : materialVideoFile.azureMediaVideo) === null || _d === void 0 ? void 0 : _d.status) === types.enums.AzureMediaVideoStatus.Done && typeof materialVideoFile.azureMediaVideo.videoStreamingUrl === 'string':
|
|
80
|
+
return VideoUploadStatus.Ready;
|
|
81
|
+
|
|
82
|
+
default:
|
|
83
|
+
return VideoUploadStatus.Empty;
|
|
84
|
+
}
|
|
85
|
+
}, [materialVideoFile]); //
|
|
86
|
+
// Get video iframe src.
|
|
87
|
+
//
|
|
88
|
+
|
|
89
|
+
React__default["default"].useEffect(() => {
|
|
90
|
+
if (!eliceVideoPlayerUrl || !materialVideoFile) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const abortCtrl = new AbortController();
|
|
95
|
+
apiClient.postGlobalAuthOtpKeyMake({
|
|
96
|
+
signal: abortCtrl.signal
|
|
97
|
+
}) // issue otp key
|
|
98
|
+
.then(res => res.otpKey) // create search params
|
|
99
|
+
.then(otp => ({
|
|
100
|
+
org: orgNameShort,
|
|
101
|
+
mid: materialVideoFile.id,
|
|
102
|
+
lmid: mainLecturePageId,
|
|
103
|
+
lms,
|
|
104
|
+
lmstype: lms ? lmsOrganizationBusinessType !== null && lmsOrganizationBusinessType !== void 0 ? lmsOrganizationBusinessType : undefined : undefined,
|
|
105
|
+
codec: VideoMimeType.Smooth,
|
|
106
|
+
autoplay: autoPlay,
|
|
107
|
+
autoplaynext: autoPlayNext,
|
|
108
|
+
endctrl: endControl,
|
|
109
|
+
notrack: materialVideoFileTrackerDisabled,
|
|
110
|
+
origin: window.location.origin,
|
|
111
|
+
locale,
|
|
112
|
+
otp
|
|
113
|
+
})) // create url from search params
|
|
114
|
+
.then(params => {
|
|
115
|
+
const url = new URL(eliceVideoPlayerUrl);
|
|
116
|
+
Object.entries(params).forEach(([key, value]) => {
|
|
117
|
+
if (value) {
|
|
118
|
+
url.searchParams.set(key, value);
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
return url;
|
|
122
|
+
}).then(url => url.href).then(setPlayerFrameSrc).catch(err => {
|
|
123
|
+
if (err.name !== 'AbortError') {
|
|
124
|
+
setPlayerFrameSrc(null);
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
return () => {
|
|
128
|
+
abortCtrl.abort();
|
|
129
|
+
};
|
|
130
|
+
}, [orgNameShort, materialVideoFile, materialVideoFileTrackerDisabled, mainLecturePageId, lms, lmsOrganizationBusinessType, eliceVideoPlayerUrl, autoPlay, autoPlayNext, endControl, locale]); //
|
|
131
|
+
// Add event listener for navigating prev and next lecture page.
|
|
132
|
+
//
|
|
133
|
+
|
|
134
|
+
React__default["default"].useEffect(() => {
|
|
135
|
+
const _handle = event => {
|
|
136
|
+
var _a, _b, _c;
|
|
137
|
+
|
|
138
|
+
try {
|
|
139
|
+
const edata = JSON.parse(event.data);
|
|
140
|
+
|
|
141
|
+
if (edata.key !== ELICE_VIDEO_PLAYER_MESSAGE_EVENT || ((_a = edata.event) === null || _a === void 0 ? void 0 : _a.type) !== ELICE_VIDEO_PLAYER_MESSAGE_TYPE) {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
switch ((_c = (_b = edata.event) === null || _b === void 0 ? void 0 : _b.args) === null || _c === void 0 ? void 0 : _c.direction) {
|
|
146
|
+
case 'previous':
|
|
147
|
+
if (typeof onNavigatePreviousLecturePage === 'function') {
|
|
148
|
+
onNavigatePreviousLecturePage();
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
break;
|
|
152
|
+
|
|
153
|
+
case 'next':
|
|
154
|
+
if (typeof onNavigateNextLecturePage === 'function') {
|
|
155
|
+
onNavigateNextLecturePage === null || onNavigateNextLecturePage === void 0 ? void 0 : onNavigateNextLecturePage();
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
break;
|
|
159
|
+
}
|
|
160
|
+
} catch (_) {//
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
window.addEventListener('message', _handle);
|
|
165
|
+
return () => {
|
|
166
|
+
window.removeEventListener('message', _handle);
|
|
167
|
+
};
|
|
168
|
+
}, // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
169
|
+
[]); //
|
|
170
|
+
//
|
|
171
|
+
//
|
|
172
|
+
// pending
|
|
173
|
+
|
|
174
|
+
if (materialVideoFileStatus === 'idle' || materialVideoFileStatus === 'pending' || materialVideoFileStatus === 'resolved' && !playerFrameSrc) {
|
|
175
|
+
return React__default["default"].createElement(MaterialVideoFilePlayer_styled.StyledVideoPlayerLoading, null, React__default["default"].createElement(blocks.Spinner, null));
|
|
176
|
+
} // rejected / empty video
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
if (materialVideoFileStatus === 'rejected' || materialVideoFileUploadStatus === VideoUploadStatus.Empty) {
|
|
180
|
+
return React__default["default"].createElement(React__default["default"].Fragment, {
|
|
181
|
+
children: emptyComponent
|
|
182
|
+
});
|
|
183
|
+
} // encoding
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
if (materialVideoFileUploadStatus === VideoUploadStatus.Encoding) {
|
|
187
|
+
return React__default["default"].createElement(MaterialVideoFilePlayer_styled.StyledVideoPlayerLoading, null, React__default["default"].createElement(blocks.Spinner, null), React__default["default"].createElement(blocks.Text, {
|
|
188
|
+
role: "gray3",
|
|
189
|
+
lineHeight: 1.5,
|
|
190
|
+
textAlign: "center",
|
|
191
|
+
preWrap: true
|
|
192
|
+
}, React__default["default"].createElement(reactIntl.FormattedMessage, {
|
|
193
|
+
id: "videoFile.player.encoding"
|
|
194
|
+
})));
|
|
195
|
+
} // encoding failed
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
if (materialVideoFileUploadStatus === VideoUploadStatus.EncodingFailed) {
|
|
199
|
+
return React__default["default"].createElement(MaterialVideoFilePlayer_styled.StyledVideoPlayerLoading, null, React__default["default"].createElement(blocks.Text, {
|
|
200
|
+
role: "gray3",
|
|
201
|
+
lineHeight: 1.5,
|
|
202
|
+
textAlign: "center",
|
|
203
|
+
preWrap: true
|
|
204
|
+
}, React__default["default"].createElement(reactIntl.FormattedMessage, {
|
|
205
|
+
id: "videoFile.player.encodingFailed"
|
|
206
|
+
})));
|
|
207
|
+
} // resolved
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
return React__default["default"].createElement(MaterialVideoFilePlayer_styled.StyledVideoPlayerWrap, {
|
|
211
|
+
className: classnames__default["default"](prefixCls, className),
|
|
212
|
+
src: playerFrameSrc,
|
|
213
|
+
title: title,
|
|
214
|
+
allow: "autoplay",
|
|
215
|
+
allowFullScreen: true
|
|
216
|
+
});
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
var MaterialVideoFilePlayer$1 = Object.assign(MaterialVideoFilePlayer, {
|
|
220
|
+
MimeType: VideoMimeType
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
module.exports = MaterialVideoFilePlayer$1;
|
|
@@ -9,11 +9,11 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
9
9
|
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
10
10
|
|
|
11
11
|
const StyledVideoPlayerWrap = styled__default["default"].iframe.withConfig({
|
|
12
|
-
componentId: "sc-
|
|
12
|
+
componentId: "sc-1ocq3lp-0"
|
|
13
13
|
})(["width:100%;height:100%;border:0;"]);
|
|
14
14
|
const StyledVideoPlayerLoading = styled__default["default"].div.withConfig({
|
|
15
|
-
componentId: "sc-
|
|
16
|
-
})(["
|
|
15
|
+
componentId: "sc-1ocq3lp-1"
|
|
16
|
+
})(["display:flex;flex-direction:column;align-items:center;justify-content:center;width:100%;height:100%;"]);
|
|
17
17
|
|
|
18
18
|
exports.StyledVideoPlayerLoading = StyledVideoPlayerLoading;
|
|
19
19
|
exports.StyledVideoPlayerWrap = StyledVideoPlayerWrap;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export declare const en: {
|
|
2
2
|
'videoFile.player.preparing': string;
|
|
3
3
|
'videoFile.player.uploadVideoBtn': string;
|
|
4
|
-
'videoFile.player.
|
|
4
|
+
'videoFile.player.encoding': string;
|
|
5
|
+
'videoFile.player.encodingFailed': string;
|
|
5
6
|
'videoFile.player.noVideo': string;
|
|
6
7
|
};
|
|
7
8
|
export declare const ko: typeof en;
|
|
@@ -5,13 +5,15 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
const en = {
|
|
6
6
|
'videoFile.player.preparing': 'Material on preparing.',
|
|
7
7
|
'videoFile.player.uploadVideoBtn': 'Upload File',
|
|
8
|
-
'videoFile.player.
|
|
8
|
+
'videoFile.player.encoding': 'A video is being prepared.\nPlease check back later.',
|
|
9
|
+
'videoFile.player.encodingFailed': 'There was a problem processing the video.\nIf the problem persists, please contact customer service.',
|
|
9
10
|
'videoFile.player.noVideo': 'This file does not exist.'
|
|
10
11
|
};
|
|
11
12
|
const ko = {
|
|
12
13
|
'videoFile.player.preparing': '자료를 준비 중입니다.',
|
|
13
14
|
'videoFile.player.uploadVideoBtn': '파일 업로드',
|
|
14
|
-
'videoFile.player.
|
|
15
|
+
'videoFile.player.encoding': '동영상을 준비 중 입니다.\n잠시 후 다시 확인해주세요.',
|
|
16
|
+
'videoFile.player.encodingFailed': '동영상 준비 중 문제가 발생하였습니다.\n문제가 지속될 경우 고객센터에 문의해주세요.',
|
|
15
17
|
'videoFile.player.noVideo': '존재하지 않는 파일입니다.'
|
|
16
18
|
};
|
|
17
19
|
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type {
|
|
3
|
-
declare type PickedVideoPlayerProps = Pick<
|
|
2
|
+
import type { MaterialVideoFilePlayerProps } from './MaterialVideoFilePlayer';
|
|
3
|
+
declare type PickedVideoPlayerProps = Pick<MaterialVideoFilePlayerProps, 'materialVideoFileTrackerDisabled' | 'mainLecturePageId' | 'lms' | 'lmsOrganizationBusinessType' | 'emptyComponent' | 'autoPlay' | 'autoPlayNext' | 'endControl' | 'eliceVideoPlayerUrl' | 'onNavigatePreviousLecturePage' | 'onNavigateNextLecturePage'>;
|
|
4
4
|
export interface MaterialVideoFileProps extends PickedVideoPlayerProps {
|
|
5
5
|
materialVideoFileId: number;
|
|
6
|
+
className?: string;
|
|
6
7
|
locale?: string;
|
|
7
8
|
}
|
|
8
9
|
declare const MaterialVideoFile: React.FC<MaterialVideoFileProps>;
|
|
@@ -1,24 +1,23 @@
|
|
|
1
1
|
import { __rest } from 'tslib';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { IntlProvider } from 'react-intl';
|
|
4
|
-
import { config, getOrgMaterialVideoFileGet
|
|
5
|
-
import { Spinner } from '@elice/blocks';
|
|
4
|
+
import { config, getOrgMaterialVideoFileGet } from '@elice/api-client';
|
|
6
5
|
import { useMaterialConfig, useMaterialInitFetch } from '@elice/material-shared-utils';
|
|
7
6
|
import classnames from 'classnames';
|
|
8
|
-
import VideoPlayer from '../video-player/VideoPlayer.js';
|
|
9
7
|
import * as locales from './locales.js';
|
|
10
8
|
import { en } from './locales.js';
|
|
9
|
+
import MaterialVideoFilePlayer from './MaterialVideoFilePlayer.js';
|
|
11
10
|
import { StyledMaterialVideoFileWrap } from './MaterialVideoFile.styled.js';
|
|
12
11
|
|
|
13
12
|
const MaterialVideoFile = _a => {
|
|
14
|
-
var _b;
|
|
13
|
+
var _b, _c, _d;
|
|
15
14
|
|
|
16
15
|
var {
|
|
17
16
|
materialVideoFileId,
|
|
18
17
|
className,
|
|
19
18
|
locale = 'en'
|
|
20
19
|
} = _a,
|
|
21
|
-
|
|
20
|
+
playerProps = __rest(_a, ["materialVideoFileId", "className", "locale"]);
|
|
22
21
|
|
|
23
22
|
const prefixCls = 'em-material-video-file';
|
|
24
23
|
const {
|
|
@@ -28,27 +27,22 @@ const MaterialVideoFile = _a => {
|
|
|
28
27
|
materialVideoFileId
|
|
29
28
|
}, {
|
|
30
29
|
signal
|
|
31
|
-
}), [materialVideoFileId]));
|
|
32
|
-
|
|
33
|
-
const makeOtpKey = async () => {
|
|
34
|
-
return postGlobalAuthOtpKeyMake().then(res => res.otpKey);
|
|
35
|
-
}; //
|
|
30
|
+
}), [materialVideoFileId])); //
|
|
36
31
|
//
|
|
37
32
|
//
|
|
38
33
|
|
|
39
|
-
|
|
40
34
|
return React.createElement(StyledMaterialVideoFileWrap, {
|
|
41
35
|
className: classnames(prefixCls, className)
|
|
42
36
|
}, React.createElement(IntlProvider, {
|
|
43
37
|
locale: locale,
|
|
44
38
|
defaultLocale: "en",
|
|
45
39
|
messages: locale in locales ? locales[locale] : en
|
|
46
|
-
},
|
|
47
|
-
material: (_b = materialVideoFile === null || materialVideoFile === void 0 ? void 0 : materialVideoFile.materialVideoFile) !== null && _b !== void 0 ? _b : null,
|
|
40
|
+
}, React.createElement(MaterialVideoFilePlayer, Object.assign({}, playerProps, {
|
|
48
41
|
orgNameShort: orgNameShort,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
42
|
+
materialVideoFile: (_b = materialVideoFile === null || materialVideoFile === void 0 ? void 0 : materialVideoFile.materialVideoFile) !== null && _b !== void 0 ? _b : null,
|
|
43
|
+
materialVideoFileStatus: materialVideoFileStatus,
|
|
44
|
+
title: (_d = (_c = materialVideoFile === null || materialVideoFile === void 0 ? void 0 : materialVideoFile.materialVideoFile.azureMediaVideo) === null || _c === void 0 ? void 0 : _c.videoAssetName) !== null && _d !== void 0 ? _d : undefined
|
|
45
|
+
}))));
|
|
52
46
|
};
|
|
53
47
|
|
|
54
48
|
export { MaterialVideoFile as default };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { APIStatus } from '@elice/material-shared-types';
|
|
3
|
+
import type { EliceVideoPlayerSearchParams, GetOrgMaterialVideoFileGetResponses } from '@elice/types';
|
|
4
|
+
export interface MaterialVideoFilePlayerProps {
|
|
5
|
+
/** Classname for the element. */
|
|
6
|
+
className?: string;
|
|
7
|
+
/** Material video file. */
|
|
8
|
+
materialVideoFile: null | GetOrgMaterialVideoFileGetResponses['materialVideoFile'];
|
|
9
|
+
/** Fetch status of material video file. */
|
|
10
|
+
materialVideoFileStatus?: APIStatus;
|
|
11
|
+
/** Disable material video file tracker. */
|
|
12
|
+
materialVideoFileTrackerDisabled?: EliceVideoPlayerSearchParams['notrack'];
|
|
13
|
+
/**
|
|
14
|
+
* Linked material (main lecture page) ID.
|
|
15
|
+
* If this is set, the material assumed as sub lecture page.
|
|
16
|
+
*/
|
|
17
|
+
mainLecturePageId?: EliceVideoPlayerSearchParams['lmid'];
|
|
18
|
+
/** Organization name short. */
|
|
19
|
+
orgNameShort: EliceVideoPlayerSearchParams['org'];
|
|
20
|
+
/** Run in LMS env? */
|
|
21
|
+
lms?: EliceVideoPlayerSearchParams['lms'];
|
|
22
|
+
/** Type of LMS org business. */
|
|
23
|
+
lmsOrganizationBusinessType?: EliceVideoPlayerSearchParams['lmstype'];
|
|
24
|
+
/** Auto play. */
|
|
25
|
+
autoPlay?: EliceVideoPlayerSearchParams['autoplay'];
|
|
26
|
+
/** Auto play next lecture page. */
|
|
27
|
+
autoPlayNext?: EliceVideoPlayerSearchParams['autoplaynext'];
|
|
28
|
+
/** End control overlay. */
|
|
29
|
+
endControl?: EliceVideoPlayerSearchParams['endctrl'];
|
|
30
|
+
/** Locale. */
|
|
31
|
+
locale?: EliceVideoPlayerSearchParams['locale'];
|
|
32
|
+
/** Elice video player url. */
|
|
33
|
+
eliceVideoPlayerUrl?: string;
|
|
34
|
+
/** Empty component. */
|
|
35
|
+
emptyComponent: React.ReactNode;
|
|
36
|
+
/** Title of player. (set on iframe) */
|
|
37
|
+
title?: string;
|
|
38
|
+
/** Navigate to previous lecture page. */
|
|
39
|
+
onNavigatePreviousLecturePage?: () => void;
|
|
40
|
+
/** Navigate to next lecture page. */
|
|
41
|
+
onNavigateNextLecturePage?: () => void;
|
|
42
|
+
}
|
|
43
|
+
declare enum VideoMimeType {
|
|
44
|
+
/** `application/vnd.ms-sstr+xml` */
|
|
45
|
+
Smooth = "application/vnd.ms-sstr+xml",
|
|
46
|
+
/** `application/vnd.apple.mpegurl` */
|
|
47
|
+
Hls = "application/vnd.apple.mpegurl",
|
|
48
|
+
/** `application/dash+xml` */
|
|
49
|
+
Mpeg = "application/dash+xml"
|
|
50
|
+
}
|
|
51
|
+
declare const _default: React.FC<MaterialVideoFilePlayerProps> & {
|
|
52
|
+
MimeType: typeof VideoMimeType;
|
|
53
|
+
};
|
|
54
|
+
export default _default;
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FormattedMessage } from 'react-intl';
|
|
3
|
+
import { postGlobalAuthOtpKeyMake } from '@elice/api-client';
|
|
4
|
+
import { Spinner, Text } from '@elice/blocks';
|
|
5
|
+
import { enums } from '@elice/types';
|
|
6
|
+
import classnames from 'classnames';
|
|
7
|
+
import { StyledVideoPlayerLoading, StyledVideoPlayerWrap } from './MaterialVideoFilePlayer.styled.js';
|
|
8
|
+
|
|
9
|
+
var VideoUploadStatus;
|
|
10
|
+
|
|
11
|
+
(function (VideoUploadStatus) {
|
|
12
|
+
VideoUploadStatus[VideoUploadStatus["Empty"] = 0] = "Empty";
|
|
13
|
+
VideoUploadStatus[VideoUploadStatus["Encoding"] = 1] = "Encoding";
|
|
14
|
+
VideoUploadStatus[VideoUploadStatus["EncodingFailed"] = 2] = "EncodingFailed";
|
|
15
|
+
VideoUploadStatus[VideoUploadStatus["Ready"] = 3] = "Ready";
|
|
16
|
+
})(VideoUploadStatus || (VideoUploadStatus = {}));
|
|
17
|
+
|
|
18
|
+
var VideoMimeType;
|
|
19
|
+
|
|
20
|
+
(function (VideoMimeType) {
|
|
21
|
+
/** `application/vnd.ms-sstr+xml` */
|
|
22
|
+
VideoMimeType["Smooth"] = "application/vnd.ms-sstr+xml";
|
|
23
|
+
/** `application/vnd.apple.mpegurl` */
|
|
24
|
+
|
|
25
|
+
VideoMimeType["Hls"] = "application/vnd.apple.mpegurl";
|
|
26
|
+
/** `application/dash+xml` */
|
|
27
|
+
|
|
28
|
+
VideoMimeType["Mpeg"] = "application/dash+xml";
|
|
29
|
+
})(VideoMimeType || (VideoMimeType = {}));
|
|
30
|
+
|
|
31
|
+
const ELICE_VIDEO_PLAYER_MESSAGE_EVENT = 'elice-video-player';
|
|
32
|
+
const ELICE_VIDEO_PLAYER_MESSAGE_TYPE = 'navigate';
|
|
33
|
+
|
|
34
|
+
const MaterialVideoFilePlayer = ({
|
|
35
|
+
className,
|
|
36
|
+
materialVideoFile,
|
|
37
|
+
materialVideoFileStatus = 'idle',
|
|
38
|
+
materialVideoFileTrackerDisabled = false,
|
|
39
|
+
mainLecturePageId,
|
|
40
|
+
orgNameShort,
|
|
41
|
+
lms = false,
|
|
42
|
+
lmsOrganizationBusinessType = null,
|
|
43
|
+
autoPlay = false,
|
|
44
|
+
autoPlayNext = false,
|
|
45
|
+
endControl = false,
|
|
46
|
+
locale,
|
|
47
|
+
eliceVideoPlayerUrl,
|
|
48
|
+
emptyComponent = null,
|
|
49
|
+
title = 'elice-video-player',
|
|
50
|
+
onNavigatePreviousLecturePage,
|
|
51
|
+
onNavigateNextLecturePage
|
|
52
|
+
}) => {
|
|
53
|
+
const prefixCls = 'em-video-player';
|
|
54
|
+
const [playerFrameSrc, setPlayerFrameSrc] = React.useState(null);
|
|
55
|
+
/**
|
|
56
|
+
* Current video status.
|
|
57
|
+
*/
|
|
58
|
+
|
|
59
|
+
const materialVideoFileUploadStatus = React.useMemo(() => {
|
|
60
|
+
var _a, _b, _c, _d;
|
|
61
|
+
|
|
62
|
+
switch (true) {
|
|
63
|
+
case typeof ((_a = materialVideoFile === null || materialVideoFile === void 0 ? void 0 : materialVideoFile.azureMediaVideo) === null || _a === void 0 ? void 0 : _a.status) === 'undefined':
|
|
64
|
+
return VideoUploadStatus.Empty;
|
|
65
|
+
|
|
66
|
+
case ((_b = materialVideoFile === null || materialVideoFile === void 0 ? void 0 : materialVideoFile.azureMediaVideo) === null || _b === void 0 ? void 0 : _b.status) === enums.AzureMediaVideoStatus.Encoding:
|
|
67
|
+
return VideoUploadStatus.Encoding;
|
|
68
|
+
|
|
69
|
+
case ((_c = materialVideoFile === null || materialVideoFile === void 0 ? void 0 : materialVideoFile.azureMediaVideo) === null || _c === void 0 ? void 0 : _c.status) === enums.AzureMediaVideoStatus.Error:
|
|
70
|
+
return VideoUploadStatus.EncodingFailed;
|
|
71
|
+
|
|
72
|
+
case ((_d = materialVideoFile === null || materialVideoFile === void 0 ? void 0 : materialVideoFile.azureMediaVideo) === null || _d === void 0 ? void 0 : _d.status) === enums.AzureMediaVideoStatus.Done && typeof materialVideoFile.azureMediaVideo.videoStreamingUrl === 'string':
|
|
73
|
+
return VideoUploadStatus.Ready;
|
|
74
|
+
|
|
75
|
+
default:
|
|
76
|
+
return VideoUploadStatus.Empty;
|
|
77
|
+
}
|
|
78
|
+
}, [materialVideoFile]); //
|
|
79
|
+
// Get video iframe src.
|
|
80
|
+
//
|
|
81
|
+
|
|
82
|
+
React.useEffect(() => {
|
|
83
|
+
if (!eliceVideoPlayerUrl || !materialVideoFile) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const abortCtrl = new AbortController();
|
|
88
|
+
postGlobalAuthOtpKeyMake({
|
|
89
|
+
signal: abortCtrl.signal
|
|
90
|
+
}) // issue otp key
|
|
91
|
+
.then(res => res.otpKey) // create search params
|
|
92
|
+
.then(otp => ({
|
|
93
|
+
org: orgNameShort,
|
|
94
|
+
mid: materialVideoFile.id,
|
|
95
|
+
lmid: mainLecturePageId,
|
|
96
|
+
lms,
|
|
97
|
+
lmstype: lms ? lmsOrganizationBusinessType !== null && lmsOrganizationBusinessType !== void 0 ? lmsOrganizationBusinessType : undefined : undefined,
|
|
98
|
+
codec: VideoMimeType.Smooth,
|
|
99
|
+
autoplay: autoPlay,
|
|
100
|
+
autoplaynext: autoPlayNext,
|
|
101
|
+
endctrl: endControl,
|
|
102
|
+
notrack: materialVideoFileTrackerDisabled,
|
|
103
|
+
origin: window.location.origin,
|
|
104
|
+
locale,
|
|
105
|
+
otp
|
|
106
|
+
})) // create url from search params
|
|
107
|
+
.then(params => {
|
|
108
|
+
const url = new URL(eliceVideoPlayerUrl);
|
|
109
|
+
Object.entries(params).forEach(([key, value]) => {
|
|
110
|
+
if (value) {
|
|
111
|
+
url.searchParams.set(key, value);
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
return url;
|
|
115
|
+
}).then(url => url.href).then(setPlayerFrameSrc).catch(err => {
|
|
116
|
+
if (err.name !== 'AbortError') {
|
|
117
|
+
setPlayerFrameSrc(null);
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
return () => {
|
|
121
|
+
abortCtrl.abort();
|
|
122
|
+
};
|
|
123
|
+
}, [orgNameShort, materialVideoFile, materialVideoFileTrackerDisabled, mainLecturePageId, lms, lmsOrganizationBusinessType, eliceVideoPlayerUrl, autoPlay, autoPlayNext, endControl, locale]); //
|
|
124
|
+
// Add event listener for navigating prev and next lecture page.
|
|
125
|
+
//
|
|
126
|
+
|
|
127
|
+
React.useEffect(() => {
|
|
128
|
+
const _handle = event => {
|
|
129
|
+
var _a, _b, _c;
|
|
130
|
+
|
|
131
|
+
try {
|
|
132
|
+
const edata = JSON.parse(event.data);
|
|
133
|
+
|
|
134
|
+
if (edata.key !== ELICE_VIDEO_PLAYER_MESSAGE_EVENT || ((_a = edata.event) === null || _a === void 0 ? void 0 : _a.type) !== ELICE_VIDEO_PLAYER_MESSAGE_TYPE) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
switch ((_c = (_b = edata.event) === null || _b === void 0 ? void 0 : _b.args) === null || _c === void 0 ? void 0 : _c.direction) {
|
|
139
|
+
case 'previous':
|
|
140
|
+
if (typeof onNavigatePreviousLecturePage === 'function') {
|
|
141
|
+
onNavigatePreviousLecturePage();
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
break;
|
|
145
|
+
|
|
146
|
+
case 'next':
|
|
147
|
+
if (typeof onNavigateNextLecturePage === 'function') {
|
|
148
|
+
onNavigateNextLecturePage === null || onNavigateNextLecturePage === void 0 ? void 0 : onNavigateNextLecturePage();
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
} catch (_) {//
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
window.addEventListener('message', _handle);
|
|
158
|
+
return () => {
|
|
159
|
+
window.removeEventListener('message', _handle);
|
|
160
|
+
};
|
|
161
|
+
}, // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
162
|
+
[]); //
|
|
163
|
+
//
|
|
164
|
+
//
|
|
165
|
+
// pending
|
|
166
|
+
|
|
167
|
+
if (materialVideoFileStatus === 'idle' || materialVideoFileStatus === 'pending' || materialVideoFileStatus === 'resolved' && !playerFrameSrc) {
|
|
168
|
+
return React.createElement(StyledVideoPlayerLoading, null, React.createElement(Spinner, null));
|
|
169
|
+
} // rejected / empty video
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
if (materialVideoFileStatus === 'rejected' || materialVideoFileUploadStatus === VideoUploadStatus.Empty) {
|
|
173
|
+
return React.createElement(React.Fragment, {
|
|
174
|
+
children: emptyComponent
|
|
175
|
+
});
|
|
176
|
+
} // encoding
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
if (materialVideoFileUploadStatus === VideoUploadStatus.Encoding) {
|
|
180
|
+
return React.createElement(StyledVideoPlayerLoading, null, React.createElement(Spinner, null), React.createElement(Text, {
|
|
181
|
+
role: "gray3",
|
|
182
|
+
lineHeight: 1.5,
|
|
183
|
+
textAlign: "center",
|
|
184
|
+
preWrap: true
|
|
185
|
+
}, React.createElement(FormattedMessage, {
|
|
186
|
+
id: "videoFile.player.encoding"
|
|
187
|
+
})));
|
|
188
|
+
} // encoding failed
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
if (materialVideoFileUploadStatus === VideoUploadStatus.EncodingFailed) {
|
|
192
|
+
return React.createElement(StyledVideoPlayerLoading, null, React.createElement(Text, {
|
|
193
|
+
role: "gray3",
|
|
194
|
+
lineHeight: 1.5,
|
|
195
|
+
textAlign: "center",
|
|
196
|
+
preWrap: true
|
|
197
|
+
}, React.createElement(FormattedMessage, {
|
|
198
|
+
id: "videoFile.player.encodingFailed"
|
|
199
|
+
})));
|
|
200
|
+
} // resolved
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
return React.createElement(StyledVideoPlayerWrap, {
|
|
204
|
+
className: classnames(prefixCls, className),
|
|
205
|
+
src: playerFrameSrc,
|
|
206
|
+
title: title,
|
|
207
|
+
allow: "autoplay",
|
|
208
|
+
allowFullScreen: true
|
|
209
|
+
});
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
var MaterialVideoFilePlayer$1 = Object.assign(MaterialVideoFilePlayer, {
|
|
213
|
+
MimeType: VideoMimeType
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
export { MaterialVideoFilePlayer$1 as default };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
2
|
|
|
3
3
|
const StyledVideoPlayerWrap = styled.iframe.withConfig({
|
|
4
|
-
componentId: "sc-
|
|
4
|
+
componentId: "sc-1ocq3lp-0"
|
|
5
5
|
})(["width:100%;height:100%;border:0;"]);
|
|
6
6
|
const StyledVideoPlayerLoading = styled.div.withConfig({
|
|
7
|
-
componentId: "sc-
|
|
8
|
-
})(["
|
|
7
|
+
componentId: "sc-1ocq3lp-1"
|
|
8
|
+
})(["display:flex;flex-direction:column;align-items:center;justify-content:center;width:100%;height:100%;"]);
|
|
9
9
|
|
|
10
10
|
export { StyledVideoPlayerLoading, StyledVideoPlayerWrap };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export declare const en: {
|
|
2
2
|
'videoFile.player.preparing': string;
|
|
3
3
|
'videoFile.player.uploadVideoBtn': string;
|
|
4
|
-
'videoFile.player.
|
|
4
|
+
'videoFile.player.encoding': string;
|
|
5
|
+
'videoFile.player.encodingFailed': string;
|
|
5
6
|
'videoFile.player.noVideo': string;
|
|
6
7
|
};
|
|
7
8
|
export declare const ko: typeof en;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
const en = {
|
|
2
2
|
'videoFile.player.preparing': 'Material on preparing.',
|
|
3
3
|
'videoFile.player.uploadVideoBtn': 'Upload File',
|
|
4
|
-
'videoFile.player.
|
|
4
|
+
'videoFile.player.encoding': 'A video is being prepared.\nPlease check back later.',
|
|
5
|
+
'videoFile.player.encodingFailed': 'There was a problem processing the video.\nIf the problem persists, please contact customer service.',
|
|
5
6
|
'videoFile.player.noVideo': 'This file does not exist.'
|
|
6
7
|
};
|
|
7
8
|
const ko = {
|
|
8
9
|
'videoFile.player.preparing': '자료를 준비 중입니다.',
|
|
9
10
|
'videoFile.player.uploadVideoBtn': '파일 업로드',
|
|
10
|
-
'videoFile.player.
|
|
11
|
+
'videoFile.player.encoding': '동영상을 준비 중 입니다.\n잠시 후 다시 확인해주세요.',
|
|
12
|
+
'videoFile.player.encodingFailed': '동영상 준비 중 문제가 발생하였습니다.\n문제가 지속될 경우 고객센터에 문의해주세요.',
|
|
11
13
|
'videoFile.player.noVideo': '존재하지 않는 파일입니다.'
|
|
12
14
|
};
|
|
13
15
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elice/material-video-file",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.221028.0",
|
|
4
4
|
"description": "User view and editing components of Elice material video file",
|
|
5
5
|
"repository": "https://git.elicer.io/elice/frontend/library/elice-material",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
"@elice/blocks": "^1.220803.0",
|
|
34
34
|
"@elice/design-tokens": "^1.220803.0",
|
|
35
35
|
"@elice/icons": "^1.220803.0",
|
|
36
|
-
"@elice/material-shared-types": "
|
|
37
|
-
"@elice/material-shared-utils": "
|
|
38
|
-
"@elice/types": "^1.
|
|
36
|
+
"@elice/material-shared-types": "*",
|
|
37
|
+
"@elice/material-shared-utils": "*",
|
|
38
|
+
"@elice/types": "^1.221027.0",
|
|
39
39
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
|
40
40
|
"react-intl": "^5.0.0",
|
|
41
41
|
"react-use": "^17.0.0",
|
|
@@ -52,9 +52,9 @@
|
|
|
52
52
|
"@elice/design-tokens": "^1.220803.0",
|
|
53
53
|
"@elice/icons": "^1.220803.0",
|
|
54
54
|
"@elice/icons-legacy": "npm:@elice/icons@0.220803.1",
|
|
55
|
-
"@elice/material-shared-types": "1.
|
|
56
|
-
"@elice/material-shared-utils": "1.
|
|
57
|
-
"@elice/types": "^1.
|
|
55
|
+
"@elice/material-shared-types": "1.221028.0",
|
|
56
|
+
"@elice/material-shared-utils": "1.221028.0",
|
|
57
|
+
"@elice/types": "^1.221027.0",
|
|
58
58
|
"@types/classnames": "^2.3.1",
|
|
59
59
|
"@types/query-string": "^6.3.0",
|
|
60
60
|
"@types/react": "~17.0.9",
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"react-use": "^17.2.4",
|
|
65
65
|
"styled-components": "^5.3.0"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "42d019e0696f3ae6e782ba038b1bd5ff1c163c0b"
|
|
68
68
|
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { APIStatus } from '@elice/material-shared-types';
|
|
3
|
-
import type { EliceVideoPlayerSearchParams } from '@elice/types';
|
|
4
|
-
import type { GetOrgMaterialVideoFileGetResponses } from '@elice/types';
|
|
5
|
-
declare type PickedEliceVideoPlayerSearchParams = Pick<EliceVideoPlayerSearchParams, 'isLmsCourse' | 'userId' | 'lmsOrganizationBusinessType'>;
|
|
6
|
-
export interface VideoPlayerProps extends PickedEliceVideoPlayerSearchParams {
|
|
7
|
-
/** Material video file data */
|
|
8
|
-
material: null | GetOrgMaterialVideoFileGetResponses['materialVideoFile'];
|
|
9
|
-
/** Elice organization name short. */
|
|
10
|
-
orgNameShort: string;
|
|
11
|
-
/** The page that shows when the video is not uploaded */
|
|
12
|
-
videoNotUploadedPage: React.ReactNode;
|
|
13
|
-
/** Play videos automatically */
|
|
14
|
-
autoPlay?: boolean;
|
|
15
|
-
/** Video api server */
|
|
16
|
-
azureVideoPlayerUrl?: string;
|
|
17
|
-
/** Classname for the element. */
|
|
18
|
-
className?: string;
|
|
19
|
-
/** Check supplement */
|
|
20
|
-
isSupplement?: boolean;
|
|
21
|
-
/** Video get api status */
|
|
22
|
-
videoGetStatus?: APIStatus;
|
|
23
|
-
/** Video iframe title */
|
|
24
|
-
videoTitle?: string;
|
|
25
|
-
/** Get Otp callback */
|
|
26
|
-
onOtpRequest: () => Promise<string>;
|
|
27
|
-
}
|
|
28
|
-
declare enum VideoMimeType {
|
|
29
|
-
/** `application/vnd.ms-sstr+xml` */
|
|
30
|
-
Smooth = "application/vnd.ms-sstr+xml",
|
|
31
|
-
/** `application/vnd.apple.mpegurl` */
|
|
32
|
-
Hls = "application/vnd.apple.mpegurl",
|
|
33
|
-
/** `application/dash+xml` */
|
|
34
|
-
Mpeg = "application/dash+xml"
|
|
35
|
-
}
|
|
36
|
-
declare const _default: React.FC<VideoPlayerProps> & {
|
|
37
|
-
MimeType: typeof VideoMimeType;
|
|
38
|
-
};
|
|
39
|
-
export default _default;
|
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var React = require('react');
|
|
4
|
-
var reactIntl = require('react-intl');
|
|
5
|
-
var reactUse = require('react-use');
|
|
6
|
-
var blocks = require('@elice/blocks');
|
|
7
|
-
var designTokens = require('@elice/design-tokens');
|
|
8
|
-
var icons = require('@elice/icons');
|
|
9
|
-
var types = require('@elice/types');
|
|
10
|
-
var classnames = require('classnames');
|
|
11
|
-
var QueryString = require('query-string');
|
|
12
|
-
var VideoPlayer_styled = require('./VideoPlayer.styled.js');
|
|
13
|
-
|
|
14
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
15
|
-
|
|
16
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
17
|
-
var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
|
|
18
|
-
var QueryString__default = /*#__PURE__*/_interopDefaultLegacy(QueryString);
|
|
19
|
-
|
|
20
|
-
var VideoMimeType;
|
|
21
|
-
|
|
22
|
-
(function (VideoMimeType) {
|
|
23
|
-
/** `application/vnd.ms-sstr+xml` */
|
|
24
|
-
VideoMimeType["Smooth"] = "application/vnd.ms-sstr+xml";
|
|
25
|
-
/** `application/vnd.apple.mpegurl` */
|
|
26
|
-
|
|
27
|
-
VideoMimeType["Hls"] = "application/vnd.apple.mpegurl";
|
|
28
|
-
/** `application/dash+xml` */
|
|
29
|
-
|
|
30
|
-
VideoMimeType["Mpeg"] = "application/dash+xml";
|
|
31
|
-
})(VideoMimeType || (VideoMimeType = {}));
|
|
32
|
-
|
|
33
|
-
const VideoPlayer = ({
|
|
34
|
-
material,
|
|
35
|
-
orgNameShort,
|
|
36
|
-
videoNotUploadedPage,
|
|
37
|
-
autoPlay = true,
|
|
38
|
-
azureVideoPlayerUrl,
|
|
39
|
-
className,
|
|
40
|
-
isLmsCourse = false,
|
|
41
|
-
isSupplement,
|
|
42
|
-
userId,
|
|
43
|
-
videoTitle,
|
|
44
|
-
videoGetStatus,
|
|
45
|
-
lmsOrganizationBusinessType,
|
|
46
|
-
onOtpRequest
|
|
47
|
-
}) => {
|
|
48
|
-
var _a, _b;
|
|
49
|
-
|
|
50
|
-
const prefixCls = 'em-video-player';
|
|
51
|
-
const [otp, setOtp] = React__default["default"].useState();
|
|
52
|
-
/**
|
|
53
|
-
* Get user otp
|
|
54
|
-
*
|
|
55
|
-
* Every time `material` changes, `otp` is called.
|
|
56
|
-
* Using the previous `otp` result in the following error:
|
|
57
|
-
*"EliceApiClientError: [invalid_otp_key] logic - the otp key is invalid"
|
|
58
|
-
*/
|
|
59
|
-
|
|
60
|
-
reactUse.useDeepCompareEffect(() => {
|
|
61
|
-
onOtpRequest().then(setOtp).catch(() =>
|
|
62
|
-
/**
|
|
63
|
-
* When Otp is undefined, appear error dialog.
|
|
64
|
-
* Them message is "OTP 세션정보가 없습니다."
|
|
65
|
-
*/
|
|
66
|
-
setOtp(undefined));
|
|
67
|
-
}, [material]);
|
|
68
|
-
/**
|
|
69
|
-
* Make video search params
|
|
70
|
-
*/
|
|
71
|
-
|
|
72
|
-
const makeEncodedUri = () => {
|
|
73
|
-
var _a, _b;
|
|
74
|
-
|
|
75
|
-
const serverUrl = azureVideoPlayerUrl !== null && azureVideoPlayerUrl !== void 0 ? azureVideoPlayerUrl : '';
|
|
76
|
-
const videoFileUrl = (_b = (_a = material === null || material === void 0 ? void 0 : material.azureMediaVideo) === null || _a === void 0 ? void 0 : _a.videoStreamingUrl) !== null && _b !== void 0 ? _b : '';
|
|
77
|
-
const videoSearchParams = {
|
|
78
|
-
src: videoFileUrl,
|
|
79
|
-
type: VideoMimeType.Smooth,
|
|
80
|
-
orgNameShort,
|
|
81
|
-
courseId: material === null || material === void 0 ? void 0 : material.courseId,
|
|
82
|
-
lectureId: material === null || material === void 0 ? void 0 : material.lectureId,
|
|
83
|
-
materialId: material === null || material === void 0 ? void 0 : material.id,
|
|
84
|
-
mainOrderNo: !isSupplement ? material === null || material === void 0 ? void 0 : material.mainOrderNo : 0,
|
|
85
|
-
isLmsCourse,
|
|
86
|
-
autoplay: autoPlay,
|
|
87
|
-
userId,
|
|
88
|
-
location: window.location.hash,
|
|
89
|
-
otp
|
|
90
|
-
}; // When only lms, add `lmsOrganizationBusinessType` to search params.
|
|
91
|
-
|
|
92
|
-
if (isLmsCourse && typeof lmsOrganizationBusinessType !== undefined) {
|
|
93
|
-
videoSearchParams.lmsOrganizationBusinessType = lmsOrganizationBusinessType;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
const encodedUri = `${serverUrl}/?${QueryString__default["default"].stringify(videoSearchParams)}`;
|
|
97
|
-
return encodedUri;
|
|
98
|
-
};
|
|
99
|
-
/**
|
|
100
|
-
* Check video streaming url
|
|
101
|
-
*/
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
const isVideoUploaded = Boolean((_a = material === null || material === void 0 ? void 0 : material.azureMediaVideo) === null || _a === void 0 ? void 0 : _a.videoStreamingUrl);
|
|
105
|
-
/**
|
|
106
|
-
* Check video encoding
|
|
107
|
-
*/
|
|
108
|
-
|
|
109
|
-
const isVideoOnEncoding = Boolean(((_b = material === null || material === void 0 ? void 0 : material.azureMediaVideo) === null || _b === void 0 ? void 0 : _b.status) === types.enums.AzureMediaVideoStatus.Encoding);
|
|
110
|
-
|
|
111
|
-
if (videoGetStatus === 'pending') {
|
|
112
|
-
return React__default["default"].createElement(blocks.Spinner, null);
|
|
113
|
-
} // When Video file not found
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
if (videoGetStatus === 'rejected' || !material) {
|
|
117
|
-
return React__default["default"].createElement(React__default["default"].Fragment, null, React__default["default"].createElement(blocks.Icon, {
|
|
118
|
-
icon: icons.eilStatusWarn,
|
|
119
|
-
color: designTokens.base.color.white,
|
|
120
|
-
style: {
|
|
121
|
-
width: '4rem',
|
|
122
|
-
height: '4rem'
|
|
123
|
-
}
|
|
124
|
-
}), React__default["default"].createElement(blocks.Vspace, {
|
|
125
|
-
height: 1
|
|
126
|
-
}), React__default["default"].createElement(blocks.Text, {
|
|
127
|
-
role: "gray3"
|
|
128
|
-
}, React__default["default"].createElement(reactIntl.FormattedMessage, {
|
|
129
|
-
id: "videoFile.player.noVideo"
|
|
130
|
-
})));
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
if (isVideoOnEncoding) {
|
|
134
|
-
return React__default["default"].createElement(React__default["default"].Fragment, null, React__default["default"].createElement(blocks.Spinner, null), React__default["default"].createElement(blocks.Text, {
|
|
135
|
-
role: "gray3"
|
|
136
|
-
}, React__default["default"].createElement(reactIntl.FormattedMessage, {
|
|
137
|
-
id: "videoFile.player.onEncoding"
|
|
138
|
-
})));
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
if (!isVideoUploaded) {
|
|
142
|
-
return React__default["default"].createElement(React__default["default"].Fragment, null, videoNotUploadedPage);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
return otp ? React__default["default"].createElement(VideoPlayer_styled.StyledVideoPlayerWrap, {
|
|
146
|
-
allowFullScreen: true,
|
|
147
|
-
className: classnames__default["default"](prefixCls, className),
|
|
148
|
-
title: videoTitle !== null && videoTitle !== void 0 ? videoTitle : 'video-player',
|
|
149
|
-
src: makeEncodedUri(),
|
|
150
|
-
allow: "autoplay"
|
|
151
|
-
}) : React__default["default"].createElement(VideoPlayer_styled.StyledVideoPlayerLoading, null, React__default["default"].createElement(blocks.Spinner, null));
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
var VideoPlayer$1 = Object.assign(VideoPlayer, {
|
|
155
|
-
MimeType: VideoMimeType
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
module.exports = VideoPlayer$1;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { APIStatus } from '@elice/material-shared-types';
|
|
3
|
-
import type { EliceVideoPlayerSearchParams } from '@elice/types';
|
|
4
|
-
import type { GetOrgMaterialVideoFileGetResponses } from '@elice/types';
|
|
5
|
-
declare type PickedEliceVideoPlayerSearchParams = Pick<EliceVideoPlayerSearchParams, 'isLmsCourse' | 'userId' | 'lmsOrganizationBusinessType'>;
|
|
6
|
-
export interface VideoPlayerProps extends PickedEliceVideoPlayerSearchParams {
|
|
7
|
-
/** Material video file data */
|
|
8
|
-
material: null | GetOrgMaterialVideoFileGetResponses['materialVideoFile'];
|
|
9
|
-
/** Elice organization name short. */
|
|
10
|
-
orgNameShort: string;
|
|
11
|
-
/** The page that shows when the video is not uploaded */
|
|
12
|
-
videoNotUploadedPage: React.ReactNode;
|
|
13
|
-
/** Play videos automatically */
|
|
14
|
-
autoPlay?: boolean;
|
|
15
|
-
/** Video api server */
|
|
16
|
-
azureVideoPlayerUrl?: string;
|
|
17
|
-
/** Classname for the element. */
|
|
18
|
-
className?: string;
|
|
19
|
-
/** Check supplement */
|
|
20
|
-
isSupplement?: boolean;
|
|
21
|
-
/** Video get api status */
|
|
22
|
-
videoGetStatus?: APIStatus;
|
|
23
|
-
/** Video iframe title */
|
|
24
|
-
videoTitle?: string;
|
|
25
|
-
/** Get Otp callback */
|
|
26
|
-
onOtpRequest: () => Promise<string>;
|
|
27
|
-
}
|
|
28
|
-
declare enum VideoMimeType {
|
|
29
|
-
/** `application/vnd.ms-sstr+xml` */
|
|
30
|
-
Smooth = "application/vnd.ms-sstr+xml",
|
|
31
|
-
/** `application/vnd.apple.mpegurl` */
|
|
32
|
-
Hls = "application/vnd.apple.mpegurl",
|
|
33
|
-
/** `application/dash+xml` */
|
|
34
|
-
Mpeg = "application/dash+xml"
|
|
35
|
-
}
|
|
36
|
-
declare const _default: React.FC<VideoPlayerProps> & {
|
|
37
|
-
MimeType: typeof VideoMimeType;
|
|
38
|
-
};
|
|
39
|
-
export default _default;
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { FormattedMessage } from 'react-intl';
|
|
3
|
-
import { useDeepCompareEffect } from 'react-use';
|
|
4
|
-
import { Spinner, Icon, Vspace, Text } from '@elice/blocks';
|
|
5
|
-
import { base } from '@elice/design-tokens';
|
|
6
|
-
import { eilStatusWarn } from '@elice/icons';
|
|
7
|
-
import { enums } from '@elice/types';
|
|
8
|
-
import classnames from 'classnames';
|
|
9
|
-
import QueryString from 'query-string';
|
|
10
|
-
import { StyledVideoPlayerWrap, StyledVideoPlayerLoading } from './VideoPlayer.styled.js';
|
|
11
|
-
|
|
12
|
-
var VideoMimeType;
|
|
13
|
-
|
|
14
|
-
(function (VideoMimeType) {
|
|
15
|
-
/** `application/vnd.ms-sstr+xml` */
|
|
16
|
-
VideoMimeType["Smooth"] = "application/vnd.ms-sstr+xml";
|
|
17
|
-
/** `application/vnd.apple.mpegurl` */
|
|
18
|
-
|
|
19
|
-
VideoMimeType["Hls"] = "application/vnd.apple.mpegurl";
|
|
20
|
-
/** `application/dash+xml` */
|
|
21
|
-
|
|
22
|
-
VideoMimeType["Mpeg"] = "application/dash+xml";
|
|
23
|
-
})(VideoMimeType || (VideoMimeType = {}));
|
|
24
|
-
|
|
25
|
-
const VideoPlayer = ({
|
|
26
|
-
material,
|
|
27
|
-
orgNameShort,
|
|
28
|
-
videoNotUploadedPage,
|
|
29
|
-
autoPlay = true,
|
|
30
|
-
azureVideoPlayerUrl,
|
|
31
|
-
className,
|
|
32
|
-
isLmsCourse = false,
|
|
33
|
-
isSupplement,
|
|
34
|
-
userId,
|
|
35
|
-
videoTitle,
|
|
36
|
-
videoGetStatus,
|
|
37
|
-
lmsOrganizationBusinessType,
|
|
38
|
-
onOtpRequest
|
|
39
|
-
}) => {
|
|
40
|
-
var _a, _b;
|
|
41
|
-
|
|
42
|
-
const prefixCls = 'em-video-player';
|
|
43
|
-
const [otp, setOtp] = React.useState();
|
|
44
|
-
/**
|
|
45
|
-
* Get user otp
|
|
46
|
-
*
|
|
47
|
-
* Every time `material` changes, `otp` is called.
|
|
48
|
-
* Using the previous `otp` result in the following error:
|
|
49
|
-
*"EliceApiClientError: [invalid_otp_key] logic - the otp key is invalid"
|
|
50
|
-
*/
|
|
51
|
-
|
|
52
|
-
useDeepCompareEffect(() => {
|
|
53
|
-
onOtpRequest().then(setOtp).catch(() =>
|
|
54
|
-
/**
|
|
55
|
-
* When Otp is undefined, appear error dialog.
|
|
56
|
-
* Them message is "OTP 세션정보가 없습니다."
|
|
57
|
-
*/
|
|
58
|
-
setOtp(undefined));
|
|
59
|
-
}, [material]);
|
|
60
|
-
/**
|
|
61
|
-
* Make video search params
|
|
62
|
-
*/
|
|
63
|
-
|
|
64
|
-
const makeEncodedUri = () => {
|
|
65
|
-
var _a, _b;
|
|
66
|
-
|
|
67
|
-
const serverUrl = azureVideoPlayerUrl !== null && azureVideoPlayerUrl !== void 0 ? azureVideoPlayerUrl : '';
|
|
68
|
-
const videoFileUrl = (_b = (_a = material === null || material === void 0 ? void 0 : material.azureMediaVideo) === null || _a === void 0 ? void 0 : _a.videoStreamingUrl) !== null && _b !== void 0 ? _b : '';
|
|
69
|
-
const videoSearchParams = {
|
|
70
|
-
src: videoFileUrl,
|
|
71
|
-
type: VideoMimeType.Smooth,
|
|
72
|
-
orgNameShort,
|
|
73
|
-
courseId: material === null || material === void 0 ? void 0 : material.courseId,
|
|
74
|
-
lectureId: material === null || material === void 0 ? void 0 : material.lectureId,
|
|
75
|
-
materialId: material === null || material === void 0 ? void 0 : material.id,
|
|
76
|
-
mainOrderNo: !isSupplement ? material === null || material === void 0 ? void 0 : material.mainOrderNo : 0,
|
|
77
|
-
isLmsCourse,
|
|
78
|
-
autoplay: autoPlay,
|
|
79
|
-
userId,
|
|
80
|
-
location: window.location.hash,
|
|
81
|
-
otp
|
|
82
|
-
}; // When only lms, add `lmsOrganizationBusinessType` to search params.
|
|
83
|
-
|
|
84
|
-
if (isLmsCourse && typeof lmsOrganizationBusinessType !== undefined) {
|
|
85
|
-
videoSearchParams.lmsOrganizationBusinessType = lmsOrganizationBusinessType;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
const encodedUri = `${serverUrl}/?${QueryString.stringify(videoSearchParams)}`;
|
|
89
|
-
return encodedUri;
|
|
90
|
-
};
|
|
91
|
-
/**
|
|
92
|
-
* Check video streaming url
|
|
93
|
-
*/
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
const isVideoUploaded = Boolean((_a = material === null || material === void 0 ? void 0 : material.azureMediaVideo) === null || _a === void 0 ? void 0 : _a.videoStreamingUrl);
|
|
97
|
-
/**
|
|
98
|
-
* Check video encoding
|
|
99
|
-
*/
|
|
100
|
-
|
|
101
|
-
const isVideoOnEncoding = Boolean(((_b = material === null || material === void 0 ? void 0 : material.azureMediaVideo) === null || _b === void 0 ? void 0 : _b.status) === enums.AzureMediaVideoStatus.Encoding);
|
|
102
|
-
|
|
103
|
-
if (videoGetStatus === 'pending') {
|
|
104
|
-
return React.createElement(Spinner, null);
|
|
105
|
-
} // When Video file not found
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
if (videoGetStatus === 'rejected' || !material) {
|
|
109
|
-
return React.createElement(React.Fragment, null, React.createElement(Icon, {
|
|
110
|
-
icon: eilStatusWarn,
|
|
111
|
-
color: base.color.white,
|
|
112
|
-
style: {
|
|
113
|
-
width: '4rem',
|
|
114
|
-
height: '4rem'
|
|
115
|
-
}
|
|
116
|
-
}), React.createElement(Vspace, {
|
|
117
|
-
height: 1
|
|
118
|
-
}), React.createElement(Text, {
|
|
119
|
-
role: "gray3"
|
|
120
|
-
}, React.createElement(FormattedMessage, {
|
|
121
|
-
id: "videoFile.player.noVideo"
|
|
122
|
-
})));
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
if (isVideoOnEncoding) {
|
|
126
|
-
return React.createElement(React.Fragment, null, React.createElement(Spinner, null), React.createElement(Text, {
|
|
127
|
-
role: "gray3"
|
|
128
|
-
}, React.createElement(FormattedMessage, {
|
|
129
|
-
id: "videoFile.player.onEncoding"
|
|
130
|
-
})));
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
if (!isVideoUploaded) {
|
|
134
|
-
return React.createElement(React.Fragment, null, videoNotUploadedPage);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
return otp ? React.createElement(StyledVideoPlayerWrap, {
|
|
138
|
-
allowFullScreen: true,
|
|
139
|
-
className: classnames(prefixCls, className),
|
|
140
|
-
title: videoTitle !== null && videoTitle !== void 0 ? videoTitle : 'video-player',
|
|
141
|
-
src: makeEncodedUri(),
|
|
142
|
-
allow: "autoplay"
|
|
143
|
-
}) : React.createElement(StyledVideoPlayerLoading, null, React.createElement(Spinner, null));
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
var VideoPlayer$1 = Object.assign(VideoPlayer, {
|
|
147
|
-
MimeType: VideoMimeType
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
export { VideoPlayer$1 as default };
|
|
File without changes
|