@cloud-app-dev/vidc 3.1.5 → 3.1.7

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.
@@ -21,6 +21,11 @@ interface IFrontendPlayerWithExtProps extends Omit<ILivePlayerWithExtProps, 'url
21
21
  segments?: ISegmentType[];
22
22
  begin?: number;
23
23
  httpLoading: boolean;
24
+ getLocalRecordUrl?: (options: {
25
+ url: URL;
26
+ begin: number;
27
+ end: number;
28
+ }) => string;
24
29
  }
25
- export declare function FrontendPlayerWithExt({ mode, style, className, segments, updatePlayer, onClick, pluginDownloadUrl, httpLoading, }: IFrontendPlayerWithExtProps): JSX.Element;
30
+ export declare function FrontendPlayerWithExt({ mode, style, className, segments, updatePlayer, onClick, pluginDownloadUrl, httpLoading, getLocalRecordUrl, }: IFrontendPlayerWithExtProps): JSX.Element;
26
31
  export {};
@@ -121,7 +121,8 @@ export function FrontendPlayerWithExt(_ref) {
121
121
  updatePlayer = _ref.updatePlayer,
122
122
  onClick = _ref.onClick,
123
123
  pluginDownloadUrl = _ref.pluginDownloadUrl,
124
- httpLoading = _ref.httpLoading;
124
+ httpLoading = _ref.httpLoading,
125
+ getLocalRecordUrl = _ref.getLocalRecordUrl;
125
126
 
126
127
  var _a;
127
128
 
@@ -143,30 +144,55 @@ export function FrontendPlayerWithExt(_ref) {
143
144
  begin = _ref2[0],
144
145
  end = _ref2[1];
145
146
  var videoUrl = new URL(segments[0].url);
146
- videoUrl.searchParams.set('begin', "".concat(moment(begin).unix()));
147
- videoUrl.searchParams.set('end', "".concat(moment(end).unix()));
147
+ var url;
148
+
149
+ if (getLocalRecordUrl) {
150
+ url = getLocalRecordUrl({
151
+ url: videoUrl,
152
+ begin: begin,
153
+ end: end
154
+ });
155
+ } else {
156
+ videoUrl.searchParams.set('begin', "".concat(moment(begin).unix()));
157
+ videoUrl.searchParams.set('end', "".concat(moment(end).unix()));
158
+ url = videoUrl.toString();
159
+ }
160
+
148
161
  setState({
149
162
  begin: begin,
150
163
  end: end,
151
- url: videoUrl.toString()
152
- });
164
+ url: url
165
+ }); // eslint-disable-next-line react-hooks/exhaustive-deps
153
166
  }, [segments]);
154
167
  var seekTo = useCallback(function (time) {
155
168
  if (!state.url) {
156
169
  return;
157
170
  }
158
171
 
159
- var endTime = moment().unix();
160
- var beginTime = moment(time).unix();
172
+ var end = moment().unix();
173
+ var begin = moment(time).unix();
161
174
  var videoUrl = new URL(state.url);
162
- videoUrl.searchParams.set('begin', "".concat(beginTime));
163
- videoUrl.searchParams.set('end', "".concat(endTime));
175
+ var url;
176
+
177
+ if (getLocalRecordUrl) {
178
+ url = getLocalRecordUrl({
179
+ url: videoUrl,
180
+ begin: begin,
181
+ end: end
182
+ });
183
+ } else {
184
+ videoUrl.searchParams.set('begin', "".concat(moment(begin).unix()));
185
+ videoUrl.searchParams.set('end', "".concat(moment(end).unix()));
186
+ url = videoUrl.toString();
187
+ }
188
+
164
189
  setState(function (old) {
165
190
  return Object.assign(Object.assign({}, old), {
166
- url: videoUrl.toString()
191
+ url: url
167
192
  });
168
193
  });
169
- }, [state.url]);
194
+ }, // eslint-disable-next-line react-hooks/exhaustive-deps
195
+ [state.url]);
170
196
 
171
197
  var forceUpdate = _useUpdate();
172
198
 
@@ -6,5 +6,5 @@ import './index.less';
6
6
  * @param param0
7
7
  * @returns
8
8
  */
9
- declare function RecordPlayer({ list, children, queryRecord, onIndexChange, onClose, onCloseAll, download, snapshot, defaultScreen, screenChange, defaultSelectIndex, oneWinExtTools, allWinExtTools, fpsDelay, fps, queryRecordErrorHandle, ...options }: IRecordPlayerProps): JSX.Element;
9
+ declare function RecordPlayer({ list, children, queryRecord, onIndexChange, onClose, onCloseAll, download, snapshot, defaultScreen, screenChange, defaultSelectIndex, oneWinExtTools, allWinExtTools, fpsDelay, fps, queryRecordErrorHandle, getLocalRecordUrl, ...options }: IRecordPlayerProps): JSX.Element;
10
10
  export default RecordPlayer;
@@ -76,7 +76,8 @@ function RecordPlayer(_a) {
76
76
  fpsDelay = _a.fpsDelay,
77
77
  fps = _a.fps,
78
78
  queryRecordErrorHandle = _a.queryRecordErrorHandle,
79
- options = __rest(_a, ["list", "children", "queryRecord", "onIndexChange", "onClose", "onCloseAll", "download", "snapshot", "defaultScreen", "screenChange", "defaultSelectIndex", "oneWinExtTools", "allWinExtTools", "fpsDelay", "fps", "queryRecordErrorHandle"]);
79
+ getLocalRecordUrl = _a.getLocalRecordUrl,
80
+ options = __rest(_a, ["list", "children", "queryRecord", "onIndexChange", "onClose", "onCloseAll", "download", "snapshot", "defaultScreen", "screenChange", "defaultSelectIndex", "oneWinExtTools", "allWinExtTools", "fpsDelay", "fps", "queryRecordErrorHandle", "getLocalRecordUrl"]);
80
81
 
81
82
  var _useState = useState(Object.assign(Object.assign({}, cloneDeep(defaultState)), {
82
83
  screenNum: defaultScreen !== null && defaultScreen !== void 0 ? defaultScreen : defaultState.screenNum
@@ -453,7 +454,8 @@ function RecordPlayer(_a) {
453
454
  width: screenType.width,
454
455
  height: screenType.height
455
456
  },
456
- httpLoading: state.winLoadingStatus[index]
457
+ httpLoading: state.winLoadingStatus[index],
458
+ getLocalRecordUrl: getLocalRecordUrl
457
459
  }));
458
460
  })), /*#__PURE__*/React.createElement("div", {
459
461
  className: "player-tools-group"
@@ -82,6 +82,8 @@ export interface IRecordPlayerProps {
82
82
 
83
83
  fpsDelay?: number;
84
84
  fps?: number;
85
+
86
+ getLocalRecordUrl?: (options: { url: URL; begin: number; end: number }) => string;
85
87
  }
86
88
 
87
89
  export interface IRecordPlayerState {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "private": false,
3
3
  "name": "@cloud-app-dev/vidc",
4
4
  "description": "Video Image Data Componennts",
5
- "version": "3.1.5",
5
+ "version": "3.1.7",
6
6
  "scripts": {
7
7
  "start": "dumi dev",
8
8
  "docs:build": "dumi build",