@atlaskit/media-ui 28.5.2 → 28.5.3
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/CHANGELOG.md +9 -0
- package/dist/cjs/customMediaPlayer/index.js +1 -1
- package/dist/cjs/customMediaPlayer/mediaPlayer/mediaPlayer.js +21 -6
- package/dist/cjs/customMediaPlayer/mediaPlayer/mediaPlayerBase.js +81 -147
- package/dist/cjs/customMediaPlayer/mediaPlayer/types.js +5 -0
- package/dist/cjs/customMediaPlayer/mediaPlayer/useTextTracks.js +139 -66
- package/dist/es2019/customMediaPlayer/index.js +1 -1
- package/dist/es2019/customMediaPlayer/mediaPlayer/mediaPlayer.js +21 -6
- package/dist/es2019/customMediaPlayer/mediaPlayer/mediaPlayerBase.js +29 -111
- package/dist/es2019/customMediaPlayer/mediaPlayer/types.js +1 -0
- package/dist/es2019/customMediaPlayer/mediaPlayer/useTextTracks.js +129 -43
- package/dist/esm/customMediaPlayer/index.js +1 -1
- package/dist/esm/customMediaPlayer/mediaPlayer/mediaPlayer.js +21 -6
- package/dist/esm/customMediaPlayer/mediaPlayer/mediaPlayerBase.js +81 -147
- package/dist/esm/customMediaPlayer/mediaPlayer/types.js +1 -0
- package/dist/esm/customMediaPlayer/mediaPlayer/useTextTracks.js +140 -67
- package/dist/types/customMediaPlayer/mediaPlayer/index.d.ts +2 -1
- package/dist/types/customMediaPlayer/mediaPlayer/mediaPlayer.d.ts +2 -3
- package/dist/types/customMediaPlayer/mediaPlayer/mediaPlayerBase.d.ts +1 -34
- package/dist/types/customMediaPlayer/mediaPlayer/types.d.ts +38 -0
- package/dist/types/customMediaPlayer/mediaPlayer/useTextTracks.d.ts +8 -2
- package/dist/types/customMediaPlayer/react-video-renderer/text.d.ts +3 -2
- package/dist/types-ts4.5/customMediaPlayer/mediaPlayer/index.d.ts +2 -1
- package/dist/types-ts4.5/customMediaPlayer/mediaPlayer/mediaPlayer.d.ts +2 -3
- package/dist/types-ts4.5/customMediaPlayer/mediaPlayer/mediaPlayerBase.d.ts +1 -34
- package/dist/types-ts4.5/customMediaPlayer/mediaPlayer/types.d.ts +38 -0
- package/dist/types-ts4.5/customMediaPlayer/mediaPlayer/useTextTracks.d.ts +8 -2
- package/dist/types-ts4.5/customMediaPlayer/react-video-renderer/text.d.ts +3 -2
- package/package.json +2 -2
|
@@ -1,90 +1,163 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
-
|
|
4
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
6
|
import { hasArtifacts } from '@atlaskit/media-client';
|
|
5
|
-
import { useState, useEffect } from 'react';
|
|
7
|
+
import { useState, useEffect, useMemo, useCallback, useRef } from 'react';
|
|
8
|
+
import { useMediaClient, useMediaSettings } from '@atlaskit/media-client-react';
|
|
9
|
+
import { getUserCaptionsEnabled, getUserCaptionsLocale, findPreselectedTrackIndex, setUserCaptionsEnabled, setUserCaptionsLocale } from './captions';
|
|
10
|
+
import { useIntl } from 'react-intl-next';
|
|
6
11
|
var decodeMimetype = function decodeMimetype(mimeType) {
|
|
7
12
|
var keyValues = (mimeType === null || mimeType === void 0 ? void 0 : mimeType.split(';')) || [];
|
|
8
13
|
var captionsRawMetadata = Object.fromEntries(keyValues.map(function (keyValue) {
|
|
9
14
|
return keyValue.split('=');
|
|
10
15
|
}));
|
|
16
|
+
var fileName = captionsRawMetadata.n ? atob(captionsRawMetadata.n) : 'no-name';
|
|
17
|
+
var lang = captionsRawMetadata.l || 'en';
|
|
11
18
|
return {
|
|
12
|
-
lang:
|
|
13
|
-
fileName:
|
|
14
|
-
label:
|
|
19
|
+
lang: lang,
|
|
20
|
+
fileName: fileName,
|
|
21
|
+
label: lang
|
|
15
22
|
};
|
|
16
23
|
};
|
|
17
|
-
|
|
18
|
-
|
|
24
|
+
var NO_SELECTED_TRACKS_INDEX = -1;
|
|
25
|
+
export var useTextTracks = function useTextTracks(fileState, collectionName) {
|
|
26
|
+
var mediaClient = useMediaClient();
|
|
27
|
+
var isLoadingCaptionsObjectURLs = useRef(new Map());
|
|
28
|
+
var captionsObjectURLs = useRef(new Map());
|
|
29
|
+
var intl = useIntl();
|
|
30
|
+
var _ref = useMediaSettings() || {},
|
|
31
|
+
mediaUserPreferences = _ref.mediaUserPreferences;
|
|
32
|
+
var _useState = useState([]),
|
|
19
33
|
_useState2 = _slicedToArray(_useState, 2),
|
|
20
|
-
|
|
21
|
-
|
|
34
|
+
captionTracks = _useState2[0],
|
|
35
|
+
setCaptionTracks = _useState2[1];
|
|
36
|
+
var _useState3 = useState(mediaUserPreferences ? getUserCaptionsEnabled(mediaUserPreferences) : false),
|
|
37
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
38
|
+
areCaptionsEnabled = _useState4[0],
|
|
39
|
+
setAreCaptionsEnabled = _useState4[1];
|
|
40
|
+
var _useState5 = useState(NO_SELECTED_TRACKS_INDEX),
|
|
41
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
42
|
+
selectedTracksIndex = _useState6[0],
|
|
43
|
+
setSelectedTracksIndex = _useState6[1];
|
|
44
|
+
var resolvedSelectedTracksIndex = useMemo(function () {
|
|
45
|
+
return areCaptionsEnabled ? selectedTracksIndex : NO_SELECTED_TRACKS_INDEX;
|
|
46
|
+
}, [areCaptionsEnabled, selectedTracksIndex]);
|
|
47
|
+
|
|
48
|
+
// When video starts playing, user settings might have changed
|
|
49
|
+
var verifyUserCaptionsEnabled = useCallback(function () {
|
|
50
|
+
if (mediaUserPreferences) {
|
|
51
|
+
setAreCaptionsEnabled(getUserCaptionsEnabled(mediaUserPreferences));
|
|
52
|
+
}
|
|
53
|
+
}, [mediaUserPreferences]);
|
|
54
|
+
|
|
55
|
+
// Converts file artifacts to base text tracks, i.e. text tracks with a source creator function.
|
|
56
|
+
// The src is resolved on every selected track change.
|
|
22
57
|
useEffect(function () {
|
|
23
58
|
if (!fileState || !hasArtifacts(fileState)) {
|
|
59
|
+
setCaptionTracks([]);
|
|
24
60
|
return;
|
|
25
61
|
}
|
|
26
|
-
var
|
|
62
|
+
var captionsArtifacts = Object.entries(fileState.artifacts || {}).filter(function (caption) {
|
|
27
63
|
var _caption = _slicedToArray(caption, 2),
|
|
28
64
|
key = _caption[0],
|
|
29
65
|
value = _caption[1];
|
|
30
66
|
return key.includes('ugc_caption') && !!value;
|
|
31
67
|
});
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
68
|
+
setCaptionTracks(captionsArtifacts.map(function (_ref2) {
|
|
69
|
+
var _ref3 = _slicedToArray(_ref2, 2),
|
|
70
|
+
artifactName = _ref3[0],
|
|
71
|
+
mimeType = _ref3[1].mimeType;
|
|
72
|
+
var _decodeMimetype = decodeMimetype(mimeType),
|
|
73
|
+
lang = _decodeMimetype.lang,
|
|
74
|
+
label = _decodeMimetype.label;
|
|
75
|
+
var src = captionsObjectURLs.current.get(artifactName);
|
|
76
|
+
return {
|
|
77
|
+
lang: lang,
|
|
78
|
+
label: label,
|
|
79
|
+
artifactName: artifactName,
|
|
80
|
+
src: src
|
|
81
|
+
};
|
|
82
|
+
})
|
|
83
|
+
// Sort based on current locale
|
|
84
|
+
.sort(function (a, b) {
|
|
85
|
+
return a.lang.localeCompare(b.lang, intl.locale);
|
|
86
|
+
}));
|
|
87
|
+
}, [fileState, intl.locale]);
|
|
88
|
+
|
|
89
|
+
// Update the user caption enabled preferences
|
|
90
|
+
useEffect(function () {
|
|
91
|
+
if (mediaUserPreferences) {
|
|
92
|
+
setUserCaptionsEnabled(mediaUserPreferences, areCaptionsEnabled);
|
|
93
|
+
}
|
|
94
|
+
}, [mediaUserPreferences, areCaptionsEnabled]);
|
|
95
|
+
|
|
96
|
+
// Update the user locale preferences
|
|
97
|
+
useEffect(function () {
|
|
98
|
+
var _ref4 = captionTracks[resolvedSelectedTracksIndex] || {},
|
|
99
|
+
lang = _ref4.lang;
|
|
100
|
+
if (mediaUserPreferences && lang) {
|
|
101
|
+
setUserCaptionsLocale(mediaUserPreferences, lang);
|
|
102
|
+
}
|
|
103
|
+
}, [mediaUserPreferences, captionTracks, resolvedSelectedTracksIndex]);
|
|
104
|
+
|
|
105
|
+
// Reset the selected track index when the locale or text tracks change
|
|
106
|
+
useEffect(function () {
|
|
107
|
+
var preselectedTrackIndex = findPreselectedTrackIndex(captionTracks, intl.locale, mediaUserPreferences && getUserCaptionsLocale(mediaUserPreferences));
|
|
108
|
+
setSelectedTracksIndex(preselectedTrackIndex || 0);
|
|
109
|
+
}, [mediaUserPreferences, intl.locale, captionTracks]);
|
|
110
|
+
useEffect(function () {
|
|
111
|
+
if (fileState && hasArtifacts(fileState)) {
|
|
112
|
+
var _ref5 = captionTracks[resolvedSelectedTracksIndex] || {},
|
|
113
|
+
artifactName = _ref5.artifactName,
|
|
114
|
+
src = _ref5.src;
|
|
115
|
+
if (artifactName && !src && !isLoadingCaptionsObjectURLs.current.get(artifactName)) {
|
|
116
|
+
isLoadingCaptionsObjectURLs.current.set(artifactName, true);
|
|
117
|
+
mediaClient.mediaStore.getArtifactBinary(fileState.artifacts, artifactName, {
|
|
118
|
+
collectionName: collectionName
|
|
119
|
+
}).then(function (blob) {
|
|
120
|
+
var objectUrl = URL.createObjectURL(blob);
|
|
121
|
+
captionsObjectURLs.current.set(artifactName, objectUrl);
|
|
122
|
+
setCaptionTracks(function (prevCaptionTracks) {
|
|
123
|
+
var newCaptionTracks = _toConsumableArray(prevCaptionTracks);
|
|
124
|
+
newCaptionTracks[resolvedSelectedTracksIndex] = _objectSpread(_objectSpread({}, newCaptionTracks[resolvedSelectedTracksIndex]), {}, {
|
|
125
|
+
src: objectUrl
|
|
126
|
+
});
|
|
127
|
+
return newCaptionTracks;
|
|
128
|
+
});
|
|
129
|
+
}).catch(function (error) {
|
|
130
|
+
// TODO: Handle this error
|
|
131
|
+
// https://product-fabric.atlassian.net/browse/BMPT-6929
|
|
132
|
+
}).finally(function () {
|
|
133
|
+
isLoadingCaptionsObjectURLs.current.set(artifactName, false);
|
|
83
134
|
});
|
|
84
|
-
}
|
|
85
|
-
} else {
|
|
86
|
-
setTextTracks(undefined);
|
|
135
|
+
}
|
|
87
136
|
}
|
|
88
|
-
}, [
|
|
89
|
-
|
|
137
|
+
}, [resolvedSelectedTracksIndex, captionTracks, mediaClient, fileState, collectionName]);
|
|
138
|
+
|
|
139
|
+
// Revokes the object urls when the component unmounts.
|
|
140
|
+
useEffect(function () {
|
|
141
|
+
var currentCaptionsObjectURLs = captionsObjectURLs.current;
|
|
142
|
+
return function () {
|
|
143
|
+
currentCaptionsObjectURLs.forEach(function (objectUrl) {
|
|
144
|
+
URL.revokeObjectURL(objectUrl);
|
|
145
|
+
});
|
|
146
|
+
};
|
|
147
|
+
}, []);
|
|
148
|
+
var textTracks = useMemo(function () {
|
|
149
|
+
return {
|
|
150
|
+
captions: {
|
|
151
|
+
selectedTrackIndex: resolvedSelectedTracksIndex,
|
|
152
|
+
tracks: captionTracks
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
}, [captionTracks, resolvedSelectedTracksIndex]);
|
|
156
|
+
return {
|
|
157
|
+
textTracks: textTracks,
|
|
158
|
+
verifyUserCaptionsEnabled: verifyUserCaptionsEnabled,
|
|
159
|
+
areCaptionsEnabled: areCaptionsEnabled,
|
|
160
|
+
setSelectedTracksIndex: setSelectedTracksIndex,
|
|
161
|
+
setAreCaptionsEnabled: setAreCaptionsEnabled
|
|
162
|
+
};
|
|
90
163
|
};
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { MediaPlayer
|
|
1
|
+
export { MediaPlayer } from './mediaPlayer';
|
|
2
|
+
export { type MediaPlayerProps } from './types';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { type
|
|
3
|
-
export
|
|
4
|
-
export declare const MediaPlayerWihtoutContext: (props: MediaPlayerProps) => React.JSX.Element;
|
|
2
|
+
import { type MediaPlayerProps } from './types';
|
|
3
|
+
export declare const MediaPlayerWihtoutContext: ({ onPlay, ...props }: MediaPlayerProps) => React.JSX.Element;
|
|
5
4
|
export declare const MediaPlayer: React.ForwardRefExoticComponent<MediaPlayerProps & React.RefAttributes<any>>;
|
|
@@ -1,42 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
3
|
-
import { type MediaFeatureFlags, type NumericalCardDimensions } from '@atlaskit/media-common';
|
|
4
|
-
import { type VideoTextTracks } from '../react-video-renderer';
|
|
5
|
-
import { type WithPlaybackProps } from '../analytics';
|
|
6
3
|
import { type WrappedComponentProps } from 'react-intl-next';
|
|
7
|
-
import { type
|
|
8
|
-
import { type CustomMediaPlayerType } from '../types';
|
|
9
|
-
import { type WithShowControlMethodProp } from '../../types';
|
|
10
|
-
import { type FileIdentifier, type FileState } from '@atlaskit/media-client';
|
|
11
|
-
import { type MediaParsedSettings } from '@atlaskit/media-client-react';
|
|
12
|
-
export interface MediaPlayerBaseProps extends WithPlaybackProps, WithShowControlMethodProp {
|
|
13
|
-
readonly type: CustomMediaPlayerType;
|
|
14
|
-
readonly src: string;
|
|
15
|
-
readonly identifier: FileIdentifier;
|
|
16
|
-
readonly fileState?: FileState;
|
|
17
|
-
readonly onHDToggleClick?: () => void;
|
|
18
|
-
readonly isShortcutEnabled?: boolean;
|
|
19
|
-
readonly lastWatchTimeConfig?: TimeSaverConfig;
|
|
20
|
-
readonly onCanPlay?: () => void;
|
|
21
|
-
readonly onPlay?: () => void;
|
|
22
|
-
readonly onPause?: () => void;
|
|
23
|
-
readonly onTimeChanged?: () => void;
|
|
24
|
-
readonly onError?: () => void;
|
|
25
|
-
readonly onDownloadClick?: () => void;
|
|
26
|
-
readonly onFirstPlay?: () => void;
|
|
27
|
-
readonly onFullscreenChange?: (fullscreen: boolean) => void;
|
|
28
|
-
readonly originalDimensions?: NumericalCardDimensions;
|
|
29
|
-
readonly featureFlags?: MediaFeatureFlags;
|
|
30
|
-
readonly poster?: string;
|
|
31
|
-
readonly videoControlsWrapperRef?: React.Ref<HTMLDivElement>;
|
|
32
|
-
readonly textTracks?: VideoTextTracks;
|
|
33
|
-
readonly areControlsVisible?: boolean;
|
|
34
|
-
readonly mediaSettings?: MediaParsedSettings;
|
|
35
|
-
}
|
|
4
|
+
import { type MediaPlayerBaseProps } from './types';
|
|
36
5
|
export interface CustomMediaPlayerState {
|
|
37
6
|
playerWidth: number;
|
|
38
|
-
selectedTracksIndex: number;
|
|
39
|
-
areCaptionsEnabled?: boolean;
|
|
40
7
|
isArtifactUploaderOpen: boolean;
|
|
41
8
|
artifactToDelete?: string;
|
|
42
9
|
isFullScreenEnabled: boolean;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type MediaFeatureFlags, type NumericalCardDimensions } from '@atlaskit/media-common';
|
|
3
|
+
import { type VideoTextTracks } from '../react-video-renderer';
|
|
4
|
+
import { type WithPlaybackProps } from '../analytics';
|
|
5
|
+
import { type TimeSaverConfig } from '../timeSaver';
|
|
6
|
+
import { type CustomMediaPlayerType } from '../types';
|
|
7
|
+
import { type WithShowControlMethodProp } from '../../types';
|
|
8
|
+
import { type FileIdentifier, type FileState } from '@atlaskit/media-client';
|
|
9
|
+
import { type MediaParsedSettings } from '@atlaskit/media-client-react';
|
|
10
|
+
export interface MediaPlayerProps extends WithPlaybackProps, WithShowControlMethodProp {
|
|
11
|
+
readonly type: CustomMediaPlayerType;
|
|
12
|
+
readonly src: string;
|
|
13
|
+
readonly identifier: FileIdentifier;
|
|
14
|
+
readonly onHDToggleClick?: () => void;
|
|
15
|
+
readonly isShortcutEnabled?: boolean;
|
|
16
|
+
readonly lastWatchTimeConfig?: TimeSaverConfig;
|
|
17
|
+
readonly onCanPlay?: () => void;
|
|
18
|
+
readonly onPlay?: () => void;
|
|
19
|
+
readonly onPause?: () => void;
|
|
20
|
+
readonly onTimeChanged?: () => void;
|
|
21
|
+
readonly onError?: () => void;
|
|
22
|
+
readonly onDownloadClick?: () => void;
|
|
23
|
+
readonly onFirstPlay?: () => void;
|
|
24
|
+
readonly onFullscreenChange?: (fullscreen: boolean) => void;
|
|
25
|
+
readonly originalDimensions?: NumericalCardDimensions;
|
|
26
|
+
readonly featureFlags?: MediaFeatureFlags;
|
|
27
|
+
readonly poster?: string;
|
|
28
|
+
readonly videoControlsWrapperRef?: React.Ref<HTMLDivElement>;
|
|
29
|
+
readonly areControlsVisible?: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface MediaPlayerBaseProps extends MediaPlayerProps {
|
|
32
|
+
readonly textTracks?: VideoTextTracks;
|
|
33
|
+
readonly mediaSettings?: MediaParsedSettings;
|
|
34
|
+
readonly fileState?: FileState;
|
|
35
|
+
readonly areCaptionsEnabled: boolean;
|
|
36
|
+
readonly onTextTracksSelected?: (selectedTracksIndex: number) => void;
|
|
37
|
+
readonly onCaptionsEnabledChange?: (areCaptionsEnabled: boolean) => void;
|
|
38
|
+
}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { type FileState } from '@atlaskit/media-state';
|
|
2
|
-
import { type MediaClient } from '@atlaskit/media-client';
|
|
3
3
|
import { type VideoTextTracks } from '../react-video-renderer';
|
|
4
|
-
export declare const useTextTracks: (fileState?: FileState,
|
|
4
|
+
export declare const useTextTracks: (fileState?: FileState, collectionName?: string) => {
|
|
5
|
+
textTracks: VideoTextTracks;
|
|
6
|
+
verifyUserCaptionsEnabled: () => void;
|
|
7
|
+
areCaptionsEnabled: boolean;
|
|
8
|
+
setSelectedTracksIndex: import("react").Dispatch<import("react").SetStateAction<number>>;
|
|
9
|
+
setAreCaptionsEnabled: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
10
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type MediaUserArtifactCaptionKey } from '@atlaskit/media-state';
|
|
1
2
|
export type VideoTextTracks = {
|
|
2
3
|
subtitles?: VideoTextTracksProps;
|
|
3
4
|
captions?: VideoTextTracksProps;
|
|
@@ -10,10 +11,10 @@ export type VideoTextTracksProps = {
|
|
|
10
11
|
tracks: VideoTextTrack[];
|
|
11
12
|
};
|
|
12
13
|
export type VideoTextTrack = {
|
|
13
|
-
src
|
|
14
|
+
src?: string;
|
|
14
15
|
lang: string;
|
|
15
16
|
label: string;
|
|
16
|
-
artifactName:
|
|
17
|
+
artifactName: MediaUserArtifactCaptionKey;
|
|
17
18
|
};
|
|
18
19
|
export type VideoTextTrackKind = keyof VideoTextTracks;
|
|
19
20
|
export declare const getVideoTextTrackId: (kind: VideoTextTrackKind, lang: string) => string;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { MediaPlayer
|
|
1
|
+
export { MediaPlayer } from './mediaPlayer';
|
|
2
|
+
export { type MediaPlayerProps } from './types';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { type
|
|
3
|
-
export
|
|
4
|
-
export declare const MediaPlayerWihtoutContext: (props: MediaPlayerProps) => React.JSX.Element;
|
|
2
|
+
import { type MediaPlayerProps } from './types';
|
|
3
|
+
export declare const MediaPlayerWihtoutContext: ({ onPlay, ...props }: MediaPlayerProps) => React.JSX.Element;
|
|
5
4
|
export declare const MediaPlayer: React.ForwardRefExoticComponent<MediaPlayerProps & React.RefAttributes<any>>;
|
|
@@ -1,42 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
3
|
-
import { type MediaFeatureFlags, type NumericalCardDimensions } from '@atlaskit/media-common';
|
|
4
|
-
import { type VideoTextTracks } from '../react-video-renderer';
|
|
5
|
-
import { type WithPlaybackProps } from '../analytics';
|
|
6
3
|
import { type WrappedComponentProps } from 'react-intl-next';
|
|
7
|
-
import { type
|
|
8
|
-
import { type CustomMediaPlayerType } from '../types';
|
|
9
|
-
import { type WithShowControlMethodProp } from '../../types';
|
|
10
|
-
import { type FileIdentifier, type FileState } from '@atlaskit/media-client';
|
|
11
|
-
import { type MediaParsedSettings } from '@atlaskit/media-client-react';
|
|
12
|
-
export interface MediaPlayerBaseProps extends WithPlaybackProps, WithShowControlMethodProp {
|
|
13
|
-
readonly type: CustomMediaPlayerType;
|
|
14
|
-
readonly src: string;
|
|
15
|
-
readonly identifier: FileIdentifier;
|
|
16
|
-
readonly fileState?: FileState;
|
|
17
|
-
readonly onHDToggleClick?: () => void;
|
|
18
|
-
readonly isShortcutEnabled?: boolean;
|
|
19
|
-
readonly lastWatchTimeConfig?: TimeSaverConfig;
|
|
20
|
-
readonly onCanPlay?: () => void;
|
|
21
|
-
readonly onPlay?: () => void;
|
|
22
|
-
readonly onPause?: () => void;
|
|
23
|
-
readonly onTimeChanged?: () => void;
|
|
24
|
-
readonly onError?: () => void;
|
|
25
|
-
readonly onDownloadClick?: () => void;
|
|
26
|
-
readonly onFirstPlay?: () => void;
|
|
27
|
-
readonly onFullscreenChange?: (fullscreen: boolean) => void;
|
|
28
|
-
readonly originalDimensions?: NumericalCardDimensions;
|
|
29
|
-
readonly featureFlags?: MediaFeatureFlags;
|
|
30
|
-
readonly poster?: string;
|
|
31
|
-
readonly videoControlsWrapperRef?: React.Ref<HTMLDivElement>;
|
|
32
|
-
readonly textTracks?: VideoTextTracks;
|
|
33
|
-
readonly areControlsVisible?: boolean;
|
|
34
|
-
readonly mediaSettings?: MediaParsedSettings;
|
|
35
|
-
}
|
|
4
|
+
import { type MediaPlayerBaseProps } from './types';
|
|
36
5
|
export interface CustomMediaPlayerState {
|
|
37
6
|
playerWidth: number;
|
|
38
|
-
selectedTracksIndex: number;
|
|
39
|
-
areCaptionsEnabled?: boolean;
|
|
40
7
|
isArtifactUploaderOpen: boolean;
|
|
41
8
|
artifactToDelete?: string;
|
|
42
9
|
isFullScreenEnabled: boolean;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type MediaFeatureFlags, type NumericalCardDimensions } from '@atlaskit/media-common';
|
|
3
|
+
import { type VideoTextTracks } from '../react-video-renderer';
|
|
4
|
+
import { type WithPlaybackProps } from '../analytics';
|
|
5
|
+
import { type TimeSaverConfig } from '../timeSaver';
|
|
6
|
+
import { type CustomMediaPlayerType } from '../types';
|
|
7
|
+
import { type WithShowControlMethodProp } from '../../types';
|
|
8
|
+
import { type FileIdentifier, type FileState } from '@atlaskit/media-client';
|
|
9
|
+
import { type MediaParsedSettings } from '@atlaskit/media-client-react';
|
|
10
|
+
export interface MediaPlayerProps extends WithPlaybackProps, WithShowControlMethodProp {
|
|
11
|
+
readonly type: CustomMediaPlayerType;
|
|
12
|
+
readonly src: string;
|
|
13
|
+
readonly identifier: FileIdentifier;
|
|
14
|
+
readonly onHDToggleClick?: () => void;
|
|
15
|
+
readonly isShortcutEnabled?: boolean;
|
|
16
|
+
readonly lastWatchTimeConfig?: TimeSaverConfig;
|
|
17
|
+
readonly onCanPlay?: () => void;
|
|
18
|
+
readonly onPlay?: () => void;
|
|
19
|
+
readonly onPause?: () => void;
|
|
20
|
+
readonly onTimeChanged?: () => void;
|
|
21
|
+
readonly onError?: () => void;
|
|
22
|
+
readonly onDownloadClick?: () => void;
|
|
23
|
+
readonly onFirstPlay?: () => void;
|
|
24
|
+
readonly onFullscreenChange?: (fullscreen: boolean) => void;
|
|
25
|
+
readonly originalDimensions?: NumericalCardDimensions;
|
|
26
|
+
readonly featureFlags?: MediaFeatureFlags;
|
|
27
|
+
readonly poster?: string;
|
|
28
|
+
readonly videoControlsWrapperRef?: React.Ref<HTMLDivElement>;
|
|
29
|
+
readonly areControlsVisible?: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface MediaPlayerBaseProps extends MediaPlayerProps {
|
|
32
|
+
readonly textTracks?: VideoTextTracks;
|
|
33
|
+
readonly mediaSettings?: MediaParsedSettings;
|
|
34
|
+
readonly fileState?: FileState;
|
|
35
|
+
readonly areCaptionsEnabled: boolean;
|
|
36
|
+
readonly onTextTracksSelected?: (selectedTracksIndex: number) => void;
|
|
37
|
+
readonly onCaptionsEnabledChange?: (areCaptionsEnabled: boolean) => void;
|
|
38
|
+
}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { type FileState } from '@atlaskit/media-state';
|
|
2
|
-
import { type MediaClient } from '@atlaskit/media-client';
|
|
3
3
|
import { type VideoTextTracks } from '../react-video-renderer';
|
|
4
|
-
export declare const useTextTracks: (fileState?: FileState,
|
|
4
|
+
export declare const useTextTracks: (fileState?: FileState, collectionName?: string) => {
|
|
5
|
+
textTracks: VideoTextTracks;
|
|
6
|
+
verifyUserCaptionsEnabled: () => void;
|
|
7
|
+
areCaptionsEnabled: boolean;
|
|
8
|
+
setSelectedTracksIndex: import("react").Dispatch<import("react").SetStateAction<number>>;
|
|
9
|
+
setAreCaptionsEnabled: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
10
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type MediaUserArtifactCaptionKey } from '@atlaskit/media-state';
|
|
1
2
|
export type VideoTextTracks = {
|
|
2
3
|
subtitles?: VideoTextTracksProps;
|
|
3
4
|
captions?: VideoTextTracksProps;
|
|
@@ -10,10 +11,10 @@ export type VideoTextTracksProps = {
|
|
|
10
11
|
tracks: VideoTextTrack[];
|
|
11
12
|
};
|
|
12
13
|
export type VideoTextTrack = {
|
|
13
|
-
src
|
|
14
|
+
src?: string;
|
|
14
15
|
lang: string;
|
|
15
16
|
label: string;
|
|
16
|
-
artifactName:
|
|
17
|
+
artifactName: MediaUserArtifactCaptionKey;
|
|
17
18
|
};
|
|
18
19
|
export type VideoTextTrackKind = keyof VideoTextTracks;
|
|
19
20
|
export declare const getVideoTextTrackId: (kind: VideoTextTrackKind, lang: string) => string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-ui",
|
|
3
|
-
"version": "28.5.
|
|
3
|
+
"version": "28.5.3",
|
|
4
4
|
"description": "Includes common components and utilities used by other media packages",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@atlaskit/media-client": "^34.2.0",
|
|
40
40
|
"@atlaskit/media-client-react": "^4.1.0",
|
|
41
41
|
"@atlaskit/media-common": "^12.3.0",
|
|
42
|
-
"@atlaskit/media-state": "^1.
|
|
42
|
+
"@atlaskit/media-state": "^1.7.0",
|
|
43
43
|
"@atlaskit/modal-dialog": "^14.2.0",
|
|
44
44
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
45
45
|
"@atlaskit/primitives": "^14.10.0",
|