@elice/material-video-file 1.240614.0 → 1.240618.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 +1 -1
- package/cjs/components/material-video-file/MaterialVideoFilePlayer.d.ts +2 -14
- package/cjs/components/material-video-file/MaterialVideoFilePlayer.js +21 -108
- package/cjs/components/material-video-file/MaterialVideoFilePlayer.styled.d.ts +4 -1
- package/cjs/components/material-video-file/MaterialVideoFilePlayer.styled.js +3 -2
- package/es/components/material-video-file/MaterialVideoFile.d.ts +1 -1
- package/es/components/material-video-file/MaterialVideoFilePlayer.d.ts +2 -14
- package/es/components/material-video-file/MaterialVideoFilePlayer.js +22 -109
- package/es/components/material-video-file/MaterialVideoFilePlayer.styled.d.ts +4 -1
- package/es/components/material-video-file/MaterialVideoFilePlayer.styled.js +3 -2
- package/package.json +7 -5
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import type { WithIntlComponentBuilderProps } from '@elice/intl';
|
|
3
3
|
import type { MaterialVideoFilePlayerProps } from './MaterialVideoFilePlayer';
|
|
4
4
|
import type { UseMaterialVideoFileApiProps } from './useMaterialVideoFileApi';
|
|
5
|
-
type PickedVideoPlayerProps = Pick<MaterialVideoFilePlayerProps, 'materialVideoFileTrackerDisabled' | 'mainLecturePageId' | 'lms' | 'lmsOrganizationBusinessType' | 'emptyComponent' | 'autoPlay' | 'autoPlayNext' | 'endControl' | 'eliceVideoPlayerUrl' | 'onNavigatePreviousLecturePage' | 'onNavigateNextLecturePage'
|
|
5
|
+
type PickedVideoPlayerProps = Pick<MaterialVideoFilePlayerProps, 'materialVideoFileTrackerDisabled' | 'mainLecturePageId' | 'lms' | 'lmsOrganizationBusinessType' | 'emptyComponent' | 'autoPlay' | 'autoPlayNext' | 'endControl' | 'eliceVideoPlayerUrl' | 'onNavigatePreviousLecturePage' | 'onNavigateNextLecturePage'>;
|
|
6
6
|
export interface MaterialVideoFileProps extends PickedVideoPlayerProps, UseMaterialVideoFileApiProps {
|
|
7
7
|
materialVideoFileId: number;
|
|
8
8
|
className?: string;
|
|
@@ -28,8 +28,6 @@ export interface MaterialVideoFilePlayerProps extends UseMaterialVideoFileApiRet
|
|
|
28
28
|
autoPlayNext?: EliceVideoPlayerSearchParams['autoplaynext'];
|
|
29
29
|
/** End control overlay. */
|
|
30
30
|
endControl?: EliceVideoPlayerSearchParams['endctrl'];
|
|
31
|
-
/** Locale. */
|
|
32
|
-
locale?: EliceVideoPlayerSearchParams['locale'];
|
|
33
31
|
/** Elice video player url. */
|
|
34
32
|
eliceVideoPlayerUrl?: string;
|
|
35
33
|
/** Empty component. */
|
|
@@ -41,15 +39,5 @@ export interface MaterialVideoFilePlayerProps extends UseMaterialVideoFileApiRet
|
|
|
41
39
|
/** Navigate to next lecture page. */
|
|
42
40
|
onNavigateNextLecturePage?: () => void;
|
|
43
41
|
}
|
|
44
|
-
declare
|
|
45
|
-
|
|
46
|
-
Smooth = "application/vnd.ms-sstr+xml",
|
|
47
|
-
/** `application/vnd.apple.mpegurl` */
|
|
48
|
-
Hls = "application/vnd.apple.mpegurl",
|
|
49
|
-
/** `application/dash+xml` */
|
|
50
|
-
Mpeg = "application/dash+xml"
|
|
51
|
-
}
|
|
52
|
-
declare const _default: React.FC<MaterialVideoFilePlayerProps> & {
|
|
53
|
-
MimeType: typeof VideoMimeType;
|
|
54
|
-
};
|
|
55
|
-
export default _default;
|
|
42
|
+
declare const MaterialVideoFilePlayer: React.FC<MaterialVideoFilePlayerProps>;
|
|
43
|
+
export default MaterialVideoFilePlayer;
|
|
@@ -19,20 +19,6 @@ var VideoUploadStatus;
|
|
|
19
19
|
VideoUploadStatus[VideoUploadStatus["EncodingFailed"] = 2] = "EncodingFailed";
|
|
20
20
|
VideoUploadStatus[VideoUploadStatus["Ready"] = 3] = "Ready";
|
|
21
21
|
})(VideoUploadStatus || (VideoUploadStatus = {}));
|
|
22
|
-
var VideoMimeType;
|
|
23
|
-
(function (VideoMimeType) {
|
|
24
|
-
/** `application/vnd.ms-sstr+xml` */
|
|
25
|
-
VideoMimeType["Smooth"] = "application/vnd.ms-sstr+xml";
|
|
26
|
-
/** `application/vnd.apple.mpegurl` */
|
|
27
|
-
VideoMimeType["Hls"] = "application/vnd.apple.mpegurl";
|
|
28
|
-
/** `application/dash+xml` */
|
|
29
|
-
VideoMimeType["Mpeg"] = "application/dash+xml";
|
|
30
|
-
})(VideoMimeType || (VideoMimeType = {}));
|
|
31
|
-
//
|
|
32
|
-
//
|
|
33
|
-
//
|
|
34
|
-
const ELICE_VIDEO_PLAYER_MESSAGE_EVENT = 'elice-videoplayer';
|
|
35
|
-
const ELICE_VIDEO_PLAYER_MESSAGE_TYPE = 'navigate';
|
|
36
22
|
//
|
|
37
23
|
//
|
|
38
24
|
//
|
|
@@ -48,17 +34,15 @@ const MaterialVideoFilePlayer = ({
|
|
|
48
34
|
autoPlay = false,
|
|
49
35
|
autoPlayNext = false,
|
|
50
36
|
endControl = false,
|
|
51
|
-
locale,
|
|
52
37
|
eliceVideoPlayerUrl,
|
|
53
38
|
emptyComponent = null,
|
|
54
|
-
title = 'elice-videoplayer',
|
|
55
39
|
onNavigatePreviousLecturePage,
|
|
56
40
|
onNavigateNextLecturePage,
|
|
57
41
|
accountApi
|
|
58
42
|
}) => {
|
|
43
|
+
var _a;
|
|
59
44
|
const prefixCls = 'em-video-player';
|
|
60
45
|
const intl$1 = intl.useRawEliceIntl();
|
|
61
|
-
const [playerFrameSrc, setPlayerFrameSrc] = React.useState(null);
|
|
62
46
|
/**
|
|
63
47
|
* Current video status.
|
|
64
48
|
*/
|
|
@@ -78,91 +62,10 @@ const MaterialVideoFilePlayer = ({
|
|
|
78
62
|
}
|
|
79
63
|
}, [materialVideoFile]);
|
|
80
64
|
//
|
|
81
|
-
// Get video iframe src.
|
|
82
|
-
//
|
|
83
|
-
React.useEffect(() => {
|
|
84
|
-
if (!eliceVideoPlayerUrl || !materialVideoFile) {
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
const abortCtrl = new AbortController();
|
|
88
|
-
accountApi.auth.authOtpPost({
|
|
89
|
-
signal: abortCtrl.signal
|
|
90
|
-
})
|
|
91
|
-
// issue otp key
|
|
92
|
-
.then(res => res.otp)
|
|
93
|
-
// create search params
|
|
94
|
-
.then(otp => ({
|
|
95
|
-
org: orgNameShort,
|
|
96
|
-
mid: materialVideoFile.id,
|
|
97
|
-
lmid: mainLecturePageId,
|
|
98
|
-
lms,
|
|
99
|
-
lmstype: lms ? lmsOrganizationBusinessType !== null && lmsOrganizationBusinessType !== void 0 ? lmsOrganizationBusinessType : undefined : undefined,
|
|
100
|
-
codec: VideoMimeType.Smooth,
|
|
101
|
-
autoplay: autoPlay,
|
|
102
|
-
autoplaynext: autoPlayNext,
|
|
103
|
-
endctrl: endControl,
|
|
104
|
-
notrack: materialVideoFileTrackerDisabled,
|
|
105
|
-
origin: window.location.origin,
|
|
106
|
-
locale,
|
|
107
|
-
otp
|
|
108
|
-
}))
|
|
109
|
-
// create url from search params
|
|
110
|
-
.then(params => {
|
|
111
|
-
const url = new URL(eliceVideoPlayerUrl);
|
|
112
|
-
Object.entries(params).forEach(([key, value]) => {
|
|
113
|
-
if (value) {
|
|
114
|
-
url.searchParams.set(key, value);
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
return url;
|
|
118
|
-
}).then(url => url.href).then(setPlayerFrameSrc).catch(err => {
|
|
119
|
-
if (err.name !== 'AbortError') {
|
|
120
|
-
setPlayerFrameSrc(null);
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
return () => {
|
|
124
|
-
abortCtrl.abort();
|
|
125
|
-
};
|
|
126
|
-
}, [orgNameShort, materialVideoFile, materialVideoFileTrackerDisabled, mainLecturePageId, lms, lmsOrganizationBusinessType, eliceVideoPlayerUrl, autoPlay, autoPlayNext, endControl, locale, accountApi]);
|
|
127
|
-
//
|
|
128
|
-
// Add event listener for navigating prev and next lecture page.
|
|
129
|
-
//
|
|
130
|
-
React.useEffect(() => {
|
|
131
|
-
const _handle = event => {
|
|
132
|
-
var _a, _b, _c;
|
|
133
|
-
try {
|
|
134
|
-
const edata = JSON.parse(event.data);
|
|
135
|
-
if (edata.key !== ELICE_VIDEO_PLAYER_MESSAGE_EVENT || ((_a = edata.event) === null || _a === void 0 ? void 0 : _a.type) !== ELICE_VIDEO_PLAYER_MESSAGE_TYPE) {
|
|
136
|
-
return;
|
|
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
|
-
break;
|
|
144
|
-
case 'next':
|
|
145
|
-
if (typeof onNavigateNextLecturePage === 'function') {
|
|
146
|
-
onNavigateNextLecturePage === null || onNavigateNextLecturePage === void 0 ? void 0 : onNavigateNextLecturePage();
|
|
147
|
-
}
|
|
148
|
-
break;
|
|
149
|
-
}
|
|
150
|
-
} catch (_) {
|
|
151
|
-
//
|
|
152
|
-
}
|
|
153
|
-
};
|
|
154
|
-
window.addEventListener('message', _handle);
|
|
155
|
-
return () => {
|
|
156
|
-
window.removeEventListener('message', _handle);
|
|
157
|
-
};
|
|
158
|
-
},
|
|
159
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
160
|
-
[]);
|
|
161
|
-
//
|
|
162
65
|
//
|
|
163
66
|
//
|
|
164
67
|
// pending
|
|
165
|
-
if (materialVideoFileStatus === 'idle' || materialVideoFileStatus === 'pending'
|
|
68
|
+
if (materialVideoFileStatus === 'idle' || materialVideoFileStatus === 'pending') {
|
|
166
69
|
return React.createElement(MaterialVideoFilePlayer_styled.StyledVideoPlayerLoading, null, React.createElement(blocks.Spinner, null));
|
|
167
70
|
}
|
|
168
71
|
// rejected / empty video
|
|
@@ -194,16 +97,26 @@ const MaterialVideoFilePlayer = ({
|
|
|
194
97
|
})));
|
|
195
98
|
}
|
|
196
99
|
// resolved
|
|
197
|
-
return React.createElement(MaterialVideoFilePlayer_styled.
|
|
100
|
+
return React.createElement(MaterialVideoFilePlayer_styled.StyledVideoPlayer, {
|
|
198
101
|
className: classnames(prefixCls, className),
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
102
|
+
orgNameShort: orgNameShort !== null && orgNameShort !== void 0 ? orgNameShort : '',
|
|
103
|
+
materialVideoId: (_a = materialVideoFile === null || materialVideoFile === void 0 ? void 0 : materialVideoFile.id) !== null && _a !== void 0 ? _a : 0,
|
|
104
|
+
linkedMaterialId: mainLecturePageId,
|
|
105
|
+
lmsType: lms ? lmsOrganizationBusinessType !== null && lmsOrganizationBusinessType !== void 0 ? lmsOrganizationBusinessType : undefined : undefined,
|
|
106
|
+
noAutoplay: !autoPlay,
|
|
107
|
+
noAutoplayNext: !autoPlayNext,
|
|
108
|
+
noEndControl: !endControl,
|
|
109
|
+
noTracker: materialVideoFileTrackerDisabled,
|
|
110
|
+
playerBaseUrl: eliceVideoPlayerUrl,
|
|
111
|
+
otp: () => accountApi.auth.authOtpPost().then(res => res.otp),
|
|
112
|
+
onLecturePageNavigate: dir => {
|
|
113
|
+
if (dir === 'prev' && onNavigatePreviousLecturePage) {
|
|
114
|
+
onNavigatePreviousLecturePage();
|
|
115
|
+
} else if (dir === 'next' && onNavigateNextLecturePage) {
|
|
116
|
+
onNavigateNextLecturePage();
|
|
117
|
+
}
|
|
118
|
+
}
|
|
203
119
|
});
|
|
204
120
|
};
|
|
205
|
-
var MaterialVideoFilePlayer$1 = Object.assign(MaterialVideoFilePlayer, {
|
|
206
|
-
MimeType: VideoMimeType
|
|
207
|
-
});
|
|
208
121
|
|
|
209
|
-
exports.default = MaterialVideoFilePlayer
|
|
122
|
+
exports.default = MaterialVideoFilePlayer;
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const StyledVideoPlayer: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("@elice/intl").IntlComponentExtraProps & Omit<import("@elice/intl").IntlComponentExtraProps & Omit<import("@elice/videoplayer-client").EliceVideoplayerProps, keyof import("@elice/intl").IntlComponentExtraProps | "__intl"> & {
|
|
3
|
+
__intl: import("@elice/intl").EliceIntlShape;
|
|
4
|
+
}, keyof import("@elice/intl").IntlComponentExtraProps | "__intl"> & import("react").RefAttributes<any>>, any, {}, never>;
|
|
2
5
|
export declare const StyledVideoPlayerLoading: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var videoplayerClient = require('@elice/videoplayer-client');
|
|
3
4
|
var styled = require('styled-components');
|
|
4
5
|
|
|
5
|
-
const
|
|
6
|
+
const StyledVideoPlayer = styled(videoplayerClient.EliceVideoplayer).withConfig({
|
|
6
7
|
componentId: "sc-1ocq3lp-0"
|
|
7
8
|
})(["width:100%;height:100%;border:0;"]);
|
|
8
9
|
const StyledVideoPlayerLoading = styled.div.withConfig({
|
|
9
10
|
componentId: "sc-1ocq3lp-1"
|
|
10
11
|
})(["display:flex;flex-direction:column;align-items:center;justify-content:center;width:100%;height:100%;"]);
|
|
11
12
|
|
|
13
|
+
exports.StyledVideoPlayer = StyledVideoPlayer;
|
|
12
14
|
exports.StyledVideoPlayerLoading = StyledVideoPlayerLoading;
|
|
13
|
-
exports.StyledVideoPlayerWrap = StyledVideoPlayerWrap;
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import type { WithIntlComponentBuilderProps } from '@elice/intl';
|
|
3
3
|
import type { MaterialVideoFilePlayerProps } from './MaterialVideoFilePlayer';
|
|
4
4
|
import type { UseMaterialVideoFileApiProps } from './useMaterialVideoFileApi';
|
|
5
|
-
type PickedVideoPlayerProps = Pick<MaterialVideoFilePlayerProps, 'materialVideoFileTrackerDisabled' | 'mainLecturePageId' | 'lms' | 'lmsOrganizationBusinessType' | 'emptyComponent' | 'autoPlay' | 'autoPlayNext' | 'endControl' | 'eliceVideoPlayerUrl' | 'onNavigatePreviousLecturePage' | 'onNavigateNextLecturePage'
|
|
5
|
+
type PickedVideoPlayerProps = Pick<MaterialVideoFilePlayerProps, 'materialVideoFileTrackerDisabled' | 'mainLecturePageId' | 'lms' | 'lmsOrganizationBusinessType' | 'emptyComponent' | 'autoPlay' | 'autoPlayNext' | 'endControl' | 'eliceVideoPlayerUrl' | 'onNavigatePreviousLecturePage' | 'onNavigateNextLecturePage'>;
|
|
6
6
|
export interface MaterialVideoFileProps extends PickedVideoPlayerProps, UseMaterialVideoFileApiProps {
|
|
7
7
|
materialVideoFileId: number;
|
|
8
8
|
className?: string;
|
|
@@ -28,8 +28,6 @@ export interface MaterialVideoFilePlayerProps extends UseMaterialVideoFileApiRet
|
|
|
28
28
|
autoPlayNext?: EliceVideoPlayerSearchParams['autoplaynext'];
|
|
29
29
|
/** End control overlay. */
|
|
30
30
|
endControl?: EliceVideoPlayerSearchParams['endctrl'];
|
|
31
|
-
/** Locale. */
|
|
32
|
-
locale?: EliceVideoPlayerSearchParams['locale'];
|
|
33
31
|
/** Elice video player url. */
|
|
34
32
|
eliceVideoPlayerUrl?: string;
|
|
35
33
|
/** Empty component. */
|
|
@@ -41,15 +39,5 @@ export interface MaterialVideoFilePlayerProps extends UseMaterialVideoFileApiRet
|
|
|
41
39
|
/** Navigate to next lecture page. */
|
|
42
40
|
onNavigateNextLecturePage?: () => void;
|
|
43
41
|
}
|
|
44
|
-
declare
|
|
45
|
-
|
|
46
|
-
Smooth = "application/vnd.ms-sstr+xml",
|
|
47
|
-
/** `application/vnd.apple.mpegurl` */
|
|
48
|
-
Hls = "application/vnd.apple.mpegurl",
|
|
49
|
-
/** `application/dash+xml` */
|
|
50
|
-
Mpeg = "application/dash+xml"
|
|
51
|
-
}
|
|
52
|
-
declare const _default: React.FC<MaterialVideoFilePlayerProps> & {
|
|
53
|
-
MimeType: typeof VideoMimeType;
|
|
54
|
-
};
|
|
55
|
-
export default _default;
|
|
42
|
+
declare const MaterialVideoFilePlayer: React.FC<MaterialVideoFilePlayerProps>;
|
|
43
|
+
export default MaterialVideoFilePlayer;
|
|
@@ -3,7 +3,7 @@ import { Spinner, Text } from '@elice/blocks';
|
|
|
3
3
|
import { useRawEliceIntl } from '@elice/intl';
|
|
4
4
|
import { enums } from '@elice/types';
|
|
5
5
|
import classnames from 'classnames';
|
|
6
|
-
import { StyledVideoPlayerLoading,
|
|
6
|
+
import { StyledVideoPlayerLoading, StyledVideoPlayer } from './MaterialVideoFilePlayer.styled.js';
|
|
7
7
|
|
|
8
8
|
//
|
|
9
9
|
//
|
|
@@ -15,20 +15,6 @@ var VideoUploadStatus;
|
|
|
15
15
|
VideoUploadStatus[VideoUploadStatus["EncodingFailed"] = 2] = "EncodingFailed";
|
|
16
16
|
VideoUploadStatus[VideoUploadStatus["Ready"] = 3] = "Ready";
|
|
17
17
|
})(VideoUploadStatus || (VideoUploadStatus = {}));
|
|
18
|
-
var VideoMimeType;
|
|
19
|
-
(function (VideoMimeType) {
|
|
20
|
-
/** `application/vnd.ms-sstr+xml` */
|
|
21
|
-
VideoMimeType["Smooth"] = "application/vnd.ms-sstr+xml";
|
|
22
|
-
/** `application/vnd.apple.mpegurl` */
|
|
23
|
-
VideoMimeType["Hls"] = "application/vnd.apple.mpegurl";
|
|
24
|
-
/** `application/dash+xml` */
|
|
25
|
-
VideoMimeType["Mpeg"] = "application/dash+xml";
|
|
26
|
-
})(VideoMimeType || (VideoMimeType = {}));
|
|
27
|
-
//
|
|
28
|
-
//
|
|
29
|
-
//
|
|
30
|
-
const ELICE_VIDEO_PLAYER_MESSAGE_EVENT = 'elice-videoplayer';
|
|
31
|
-
const ELICE_VIDEO_PLAYER_MESSAGE_TYPE = 'navigate';
|
|
32
18
|
//
|
|
33
19
|
//
|
|
34
20
|
//
|
|
@@ -44,17 +30,15 @@ const MaterialVideoFilePlayer = ({
|
|
|
44
30
|
autoPlay = false,
|
|
45
31
|
autoPlayNext = false,
|
|
46
32
|
endControl = false,
|
|
47
|
-
locale,
|
|
48
33
|
eliceVideoPlayerUrl,
|
|
49
34
|
emptyComponent = null,
|
|
50
|
-
title = 'elice-videoplayer',
|
|
51
35
|
onNavigatePreviousLecturePage,
|
|
52
36
|
onNavigateNextLecturePage,
|
|
53
37
|
accountApi
|
|
54
38
|
}) => {
|
|
39
|
+
var _a;
|
|
55
40
|
const prefixCls = 'em-video-player';
|
|
56
41
|
const intl = useRawEliceIntl();
|
|
57
|
-
const [playerFrameSrc, setPlayerFrameSrc] = React.useState(null);
|
|
58
42
|
/**
|
|
59
43
|
* Current video status.
|
|
60
44
|
*/
|
|
@@ -74,91 +58,10 @@ const MaterialVideoFilePlayer = ({
|
|
|
74
58
|
}
|
|
75
59
|
}, [materialVideoFile]);
|
|
76
60
|
//
|
|
77
|
-
// Get video iframe src.
|
|
78
|
-
//
|
|
79
|
-
React.useEffect(() => {
|
|
80
|
-
if (!eliceVideoPlayerUrl || !materialVideoFile) {
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
const abortCtrl = new AbortController();
|
|
84
|
-
accountApi.auth.authOtpPost({
|
|
85
|
-
signal: abortCtrl.signal
|
|
86
|
-
})
|
|
87
|
-
// issue otp key
|
|
88
|
-
.then(res => res.otp)
|
|
89
|
-
// create search params
|
|
90
|
-
.then(otp => ({
|
|
91
|
-
org: orgNameShort,
|
|
92
|
-
mid: materialVideoFile.id,
|
|
93
|
-
lmid: mainLecturePageId,
|
|
94
|
-
lms,
|
|
95
|
-
lmstype: lms ? lmsOrganizationBusinessType !== null && lmsOrganizationBusinessType !== void 0 ? lmsOrganizationBusinessType : undefined : undefined,
|
|
96
|
-
codec: VideoMimeType.Smooth,
|
|
97
|
-
autoplay: autoPlay,
|
|
98
|
-
autoplaynext: autoPlayNext,
|
|
99
|
-
endctrl: endControl,
|
|
100
|
-
notrack: materialVideoFileTrackerDisabled,
|
|
101
|
-
origin: window.location.origin,
|
|
102
|
-
locale,
|
|
103
|
-
otp
|
|
104
|
-
}))
|
|
105
|
-
// create url from search params
|
|
106
|
-
.then(params => {
|
|
107
|
-
const url = new URL(eliceVideoPlayerUrl);
|
|
108
|
-
Object.entries(params).forEach(([key, value]) => {
|
|
109
|
-
if (value) {
|
|
110
|
-
url.searchParams.set(key, value);
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
return url;
|
|
114
|
-
}).then(url => url.href).then(setPlayerFrameSrc).catch(err => {
|
|
115
|
-
if (err.name !== 'AbortError') {
|
|
116
|
-
setPlayerFrameSrc(null);
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
return () => {
|
|
120
|
-
abortCtrl.abort();
|
|
121
|
-
};
|
|
122
|
-
}, [orgNameShort, materialVideoFile, materialVideoFileTrackerDisabled, mainLecturePageId, lms, lmsOrganizationBusinessType, eliceVideoPlayerUrl, autoPlay, autoPlayNext, endControl, locale, accountApi]);
|
|
123
|
-
//
|
|
124
|
-
// Add event listener for navigating prev and next lecture page.
|
|
125
|
-
//
|
|
126
|
-
React.useEffect(() => {
|
|
127
|
-
const _handle = event => {
|
|
128
|
-
var _a, _b, _c;
|
|
129
|
-
try {
|
|
130
|
-
const edata = JSON.parse(event.data);
|
|
131
|
-
if (edata.key !== ELICE_VIDEO_PLAYER_MESSAGE_EVENT || ((_a = edata.event) === null || _a === void 0 ? void 0 : _a.type) !== ELICE_VIDEO_PLAYER_MESSAGE_TYPE) {
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
switch ((_c = (_b = edata.event) === null || _b === void 0 ? void 0 : _b.args) === null || _c === void 0 ? void 0 : _c.direction) {
|
|
135
|
-
case 'previous':
|
|
136
|
-
if (typeof onNavigatePreviousLecturePage === 'function') {
|
|
137
|
-
onNavigatePreviousLecturePage();
|
|
138
|
-
}
|
|
139
|
-
break;
|
|
140
|
-
case 'next':
|
|
141
|
-
if (typeof onNavigateNextLecturePage === 'function') {
|
|
142
|
-
onNavigateNextLecturePage === null || onNavigateNextLecturePage === void 0 ? void 0 : onNavigateNextLecturePage();
|
|
143
|
-
}
|
|
144
|
-
break;
|
|
145
|
-
}
|
|
146
|
-
} catch (_) {
|
|
147
|
-
//
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
|
-
window.addEventListener('message', _handle);
|
|
151
|
-
return () => {
|
|
152
|
-
window.removeEventListener('message', _handle);
|
|
153
|
-
};
|
|
154
|
-
},
|
|
155
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
156
|
-
[]);
|
|
157
|
-
//
|
|
158
61
|
//
|
|
159
62
|
//
|
|
160
63
|
// pending
|
|
161
|
-
if (materialVideoFileStatus === 'idle' || materialVideoFileStatus === 'pending'
|
|
64
|
+
if (materialVideoFileStatus === 'idle' || materialVideoFileStatus === 'pending') {
|
|
162
65
|
return React.createElement(StyledVideoPlayerLoading, null, React.createElement(Spinner, null));
|
|
163
66
|
}
|
|
164
67
|
// rejected / empty video
|
|
@@ -190,16 +93,26 @@ const MaterialVideoFilePlayer = ({
|
|
|
190
93
|
})));
|
|
191
94
|
}
|
|
192
95
|
// resolved
|
|
193
|
-
return React.createElement(
|
|
96
|
+
return React.createElement(StyledVideoPlayer, {
|
|
194
97
|
className: classnames(prefixCls, className),
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
98
|
+
orgNameShort: orgNameShort !== null && orgNameShort !== void 0 ? orgNameShort : '',
|
|
99
|
+
materialVideoId: (_a = materialVideoFile === null || materialVideoFile === void 0 ? void 0 : materialVideoFile.id) !== null && _a !== void 0 ? _a : 0,
|
|
100
|
+
linkedMaterialId: mainLecturePageId,
|
|
101
|
+
lmsType: lms ? lmsOrganizationBusinessType !== null && lmsOrganizationBusinessType !== void 0 ? lmsOrganizationBusinessType : undefined : undefined,
|
|
102
|
+
noAutoplay: !autoPlay,
|
|
103
|
+
noAutoplayNext: !autoPlayNext,
|
|
104
|
+
noEndControl: !endControl,
|
|
105
|
+
noTracker: materialVideoFileTrackerDisabled,
|
|
106
|
+
playerBaseUrl: eliceVideoPlayerUrl,
|
|
107
|
+
otp: () => accountApi.auth.authOtpPost().then(res => res.otp),
|
|
108
|
+
onLecturePageNavigate: dir => {
|
|
109
|
+
if (dir === 'prev' && onNavigatePreviousLecturePage) {
|
|
110
|
+
onNavigatePreviousLecturePage();
|
|
111
|
+
} else if (dir === 'next' && onNavigateNextLecturePage) {
|
|
112
|
+
onNavigateNextLecturePage();
|
|
113
|
+
}
|
|
114
|
+
}
|
|
199
115
|
});
|
|
200
116
|
};
|
|
201
|
-
var MaterialVideoFilePlayer$1 = Object.assign(MaterialVideoFilePlayer, {
|
|
202
|
-
MimeType: VideoMimeType
|
|
203
|
-
});
|
|
204
117
|
|
|
205
|
-
export { MaterialVideoFilePlayer
|
|
118
|
+
export { MaterialVideoFilePlayer as default };
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const StyledVideoPlayer: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("@elice/intl").IntlComponentExtraProps & Omit<import("@elice/intl").IntlComponentExtraProps & Omit<import("@elice/videoplayer-client").EliceVideoplayerProps, keyof import("@elice/intl").IntlComponentExtraProps | "__intl"> & {
|
|
3
|
+
__intl: import("@elice/intl").EliceIntlShape;
|
|
4
|
+
}, keyof import("@elice/intl").IntlComponentExtraProps | "__intl"> & import("react").RefAttributes<any>>, any, {}, never>;
|
|
2
5
|
export declare const StyledVideoPlayerLoading: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { EliceVideoplayer } from '@elice/videoplayer-client';
|
|
1
2
|
import styled from 'styled-components';
|
|
2
3
|
|
|
3
|
-
const
|
|
4
|
+
const StyledVideoPlayer = styled(EliceVideoplayer).withConfig({
|
|
4
5
|
componentId: "sc-1ocq3lp-0"
|
|
5
6
|
})(["width:100%;height:100%;border:0;"]);
|
|
6
7
|
const StyledVideoPlayerLoading = styled.div.withConfig({
|
|
7
8
|
componentId: "sc-1ocq3lp-1"
|
|
8
9
|
})(["display:flex;flex-direction:column;align-items:center;justify-content:center;width:100%;height:100%;"]);
|
|
9
10
|
|
|
10
|
-
export {
|
|
11
|
+
export { StyledVideoPlayer, StyledVideoPlayerLoading };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elice/material-video-file",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.240618.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",
|
|
@@ -29,11 +29,12 @@
|
|
|
29
29
|
"@elice/blocks": "^1",
|
|
30
30
|
"@elice/design-tokens": "^1",
|
|
31
31
|
"@elice/icons": "^1",
|
|
32
|
-
"@elice/intl": "
|
|
32
|
+
"@elice/intl": "^0",
|
|
33
33
|
"@elice/material-shared-types": "*",
|
|
34
34
|
"@elice/material-shared-utils": "*",
|
|
35
35
|
"@elice/openapi-client-account": "^1",
|
|
36
36
|
"@elice/types": "^1",
|
|
37
|
+
"@elice/videoplayer-client": "^2",
|
|
37
38
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
|
38
39
|
"react-use": "^17.0.0",
|
|
39
40
|
"styled-components": "^5.2.0"
|
|
@@ -50,10 +51,11 @@
|
|
|
50
51
|
"@elice/icons": "^1.230814.0",
|
|
51
52
|
"@elice/icons-legacy": "npm:@elice/icons@0.230814.0",
|
|
52
53
|
"@elice/intl": "0.240425.0-rc.2",
|
|
53
|
-
"@elice/material-shared-types": "1.
|
|
54
|
-
"@elice/material-shared-utils": "1.
|
|
54
|
+
"@elice/material-shared-types": "1.240618.0",
|
|
55
|
+
"@elice/material-shared-utils": "1.240618.0",
|
|
55
56
|
"@elice/openapi-client-account": "^1.230814.0",
|
|
56
57
|
"@elice/types": "^1.240208.0",
|
|
58
|
+
"@elice/videoplayer-client": "^2.240618.0",
|
|
57
59
|
"@types/classnames": "^2.3.1",
|
|
58
60
|
"@types/query-string": "^6.3.0",
|
|
59
61
|
"@types/react": "~17.0.9",
|
|
@@ -62,5 +64,5 @@
|
|
|
62
64
|
"react-use": "^17.2.4",
|
|
63
65
|
"styled-components": "^5.3.0"
|
|
64
66
|
},
|
|
65
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "63d4bb89b897e3f211035a7b3c7d8677ab43e4ff"
|
|
66
68
|
}
|