@cloud-app-dev/vidc 3.0.1 → 3.0.4

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.
Files changed (45) hide show
  1. package/.umirc.ts +1 -1
  2. package/es/LoaderApp/utils.d.ts +1 -1
  3. package/es/Map/AMap.d.ts +6839 -1319
  4. package/es/Map/BasicMap/AMapInstance.d.ts +4 -3
  5. package/es/Map/BasicMap/AMapInstance.js +3 -4
  6. package/es/Map/BasicMap/LeafletInstance.d.ts +3 -3
  7. package/es/Map/ClusterLayer/hook.d.ts +4 -4
  8. package/es/Map/ClusterLayer/hook.js +20 -24
  9. package/es/Map/ClusterLayer/index.d.ts +1 -0
  10. package/es/Map/ClusterLayer/index.js +1 -0
  11. package/es/Map/InfoWindow/MakerLikeWindow.d.ts +4 -0
  12. package/es/Map/InfoWindow/MakerLikeWindow.js +103 -0
  13. package/es/Map/InfoWindow/demo.js +48 -21
  14. package/es/Map/InfoWindow/index.d.ts +7 -5
  15. package/es/Map/InfoWindow/index.js +7 -6
  16. package/es/Map/interface.d.ts +1 -1
  17. package/es/Map/useMarker/index.d.ts +2 -2
  18. package/es/Map/useMarker/index.js +3 -19
  19. package/es/Player/api/index.d.ts +1 -0
  20. package/es/Player/api/index.js +2 -0
  21. package/es/Player/demo.js +8 -3
  22. package/es/Player/event/errorEvent.js +3 -8
  23. package/es/Player/frontend_player.d.ts +1 -2
  24. package/es/Player/frontend_player.js +27 -57
  25. package/es/Player/frontend_timeline.d.ts +2 -1
  26. package/es/Player/frontend_timeline.js +14 -4
  27. package/es/Player/player.d.ts +7 -9
  28. package/es/Player/segment_player.d.ts +1 -1
  29. package/es/Player/segment_player.js +74 -36
  30. package/es/Player/single_player.d.ts +2 -2
  31. package/es/Player/single_player.js +20 -11
  32. package/es/ScreenPlayer/Live.js +9 -1
  33. package/es/ScreenPlayer/LiveTools.d.ts +3 -1
  34. package/es/ScreenPlayer/LiveTools.js +8 -1
  35. package/es/ScreenPlayer/PlayerWithExt.js +48 -27
  36. package/es/ScreenPlayer/Record.d.ts +5 -0
  37. package/es/ScreenPlayer/Record.js +7 -19
  38. package/es/ScreenPlayer/TimeSlider.d.ts +1 -1
  39. package/es/ScreenPlayer/TimeSlider.js +39 -35
  40. package/es/ScreenPlayer/demo2.js +1 -1
  41. package/es/ScreenPlayer/index.css +2 -3
  42. package/es/ScreenPlayer/useVideoFit.d.ts +1 -1
  43. package/es/ScreenPlayer/useVideoFit.js +4 -2
  44. package/package.json +1 -1
  45. package/release-build.sh +29 -4
@@ -1,6 +1,7 @@
1
- import { Map, IMapInstance, IMapOptions } from '../interface';
1
+ /// <reference types="src/map/amap" />
2
+ import { IMapInstance, IMapOptions } from '../interface';
2
3
  declare class AMapInstance implements IMapInstance {
3
- map: Map;
4
+ map: AMap.Map;
4
5
  config: IMapOptions;
5
6
  mapContainer: HTMLDivElement;
6
7
  constructor(ele: HTMLDivElement, config: IMapOptions);
@@ -8,7 +9,7 @@ declare class AMapInstance implements IMapInstance {
8
9
  destoryMap(): void;
9
10
  mapReset(): void;
10
11
  setZoom(zoom: number): void;
11
- getZoom(): any;
12
+ getZoom(): number;
12
13
  setCenter(center: [number, number]): void;
13
14
  setZoomAndCenter(zoom: number, center: [number, number]): void;
14
15
  }
@@ -18,12 +18,11 @@ var AMapInstance = /*#__PURE__*/function () {
18
18
  value: function createMap() {
19
19
  var _a;
20
20
 
21
- var _global = window;
22
- this.map = new _global.AMap.Map(this.mapContainer, {
23
- viewMode: '3D',
21
+ this.map = new AMap.Map(this.mapContainer, {
22
+ viewMode: '2D',
24
23
  zoom: this.config.zoom,
25
24
  center: this.config.center,
26
- pitch: 72,
25
+ // pitch: 30,
27
26
  resizeEnable: true,
28
27
  mapStyle: "amap://styles/".concat((_a = this.config.amapStyle) !== null && _a !== void 0 ? _a : 'normal')
29
28
  });
@@ -8,8 +8,8 @@ declare class LeafletInstance implements IMapInstance {
8
8
  destoryMap(): void;
9
9
  setZoomAndCenter(zoom: number, center: [number, number] | LatLng): void;
10
10
  mapReset(): void;
11
- setZoom(zoom: number): any;
12
- setCenter(center: [number, number] | LatLng): any;
13
- getZoom(): any;
11
+ setZoom(zoom: number): Map;
12
+ setCenter(center: [number, number] | LatLng): void;
13
+ getZoom(): number;
14
14
  }
15
15
  export default LeafletInstance;
@@ -1,5 +1,5 @@
1
- import { MapPoint, LClusterInterface } from '../interface';
2
- import { AMap as AMapType } from '../AMap';
1
+ /// <reference types="src/map/amap" />
2
+ import { MapPoint, Marker, LClusterInterface } from '../interface';
3
3
  import './index.less';
4
- export declare function useMarkerCluster(onPointClick?: (point: MapPoint) => void): LClusterInterface & AMapType.MarkerCluster;
5
- export declare function useMarkers(points?: MapPoint[]): any[];
4
+ export declare function useMarkerCluster(onPointClick?: (point: MapPoint) => void): LClusterInterface & AMap.MarkerCluster;
5
+ export declare function useMarkers(points?: MapPoint[]): Marker[];
@@ -1,3 +1,4 @@
1
+ import _useUnmount from "ahooks/es/useUnmount";
1
2
  import _useUpdate from "ahooks/es/useUpdate";
2
3
 
3
4
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
@@ -12,12 +13,12 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
12
13
 
13
14
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
14
15
 
16
+ /// <reference path="../AMap.d.ts" />
15
17
  import { useContext, useEffect, useRef, useState } from 'react';
16
18
  import useMapType from '../hook/useMapType';
17
19
  import { mapContext } from '../Context';
18
20
  import { createMapCenterIcon } from '../icon';
19
21
  import "./index.css";
20
- var _global = window;
21
22
  var clusterOptions = {
22
23
  showCoverageOnHover: false,
23
24
  maxClusterRadius: 80,
@@ -44,24 +45,19 @@ export function useMarkerCluster(onPointClick) {
44
45
  }
45
46
 
46
47
  if (type.AMap) {
47
- var renderMarker = function renderMarker(context) {
48
- var data = context.data[0];
49
- context.marker.setLabel({
50
- content: data.deviceName,
51
- direction: 'top',
52
- offset: [0, -2]
53
- });
54
- onPointClick && context.marker.on('click', function () {
55
- return onPointClick(data);
56
- });
57
- };
58
-
59
- instance.map.plugin(['AMap.MarkerCluster'], function () {
60
- var AMap = _global.AMap;
48
+ AMap.plugin(['AMap.MarkerCluster'], function () {
61
49
  var cluster = new AMap.MarkerCluster(instance.map, [], {
62
50
  gridSize: 40,
63
- renderMarker: renderMarker,
64
- clusterByZoomChange: true
51
+ renderMarker: function renderMarker(context) {
52
+ var data = context.data[0];
53
+ context.marker.setLabel({
54
+ content: data.deviceName,
55
+ direction: 'top'
56
+ });
57
+ onPointClick && context.marker.on('click', function () {
58
+ return onPointClick(data);
59
+ });
60
+ }
65
61
  });
66
62
  cluster.on('click', function (e) {
67
63
  if (e.clusterData.length === 1) {
@@ -77,11 +73,13 @@ export function useMarkerCluster(onPointClick) {
77
73
 
78
74
  update(); // eslint-disable-next-line react-hooks/exhaustive-deps
79
75
  }, []);
80
- useEffect(function () {
81
- return function () {
82
- return clusterRef.current && clusterRef.current.remove && clusterRef.current.remove();
83
- };
84
- }, []);
76
+
77
+ _useUnmount(function () {
78
+ try {
79
+ instance.map.remove(clusterRef.current);
80
+ } catch (_) {}
81
+ });
82
+
85
83
  return clusterRef.current;
86
84
  }
87
85
  export function useMarkers(points) {
@@ -120,8 +118,6 @@ export function useMarkers(points) {
120
118
  }
121
119
 
122
120
  if (type.AMap) {
123
- var AMap = _global.AMap;
124
-
125
121
  for (var _i2 = 0, _l = points.length; _i2 < _l; _i2++) {
126
122
  var _point = points[_i2];
127
123
 
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ /// <reference types="src/map/amap" />
2
3
  import { IClusterLayerProps } from './props';
3
4
  import './index.less';
4
5
  declare function ClusterLayer({ points, onPointClick, children }: IClusterLayerProps): JSX.Element;
@@ -1,3 +1,4 @@
1
+ /// <reference path="../AMap.d.ts" />
1
2
  import React, { useEffect } from 'react';
2
3
  import { useMarkerCluster, useMarkers } from './hook';
3
4
  import useMapType from '../hook/useMapType';
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ /// <reference types="src/map/amap" />
3
+ import { InfoWindowProps } from '.';
4
+ export default function MakerLikeWindow({ children, visible, center, width, height }: InfoWindowProps): JSX.Element;
@@ -0,0 +1,103 @@
1
+ import _useUnmount from "ahooks/es/useUnmount";
2
+
3
+ function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct.bind(); } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
4
+
5
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
6
+
7
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
8
+
9
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
10
+
11
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
12
+
13
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
14
+
15
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
16
+
17
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
18
+
19
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
20
+
21
+ /// <reference path="../AMap.d.ts" />
22
+ import React, { useContext, useEffect, useRef } from 'react';
23
+ import ReactDOM from 'react-dom';
24
+ import { mapContext } from '../Context';
25
+ import useMapType from '../hook/useMapType';
26
+ var maxIndex = 20;
27
+ export default function MakerLikeWindow(_ref) {
28
+ var children = _ref.children,
29
+ visible = _ref.visible,
30
+ center = _ref.center,
31
+ width = _ref.width,
32
+ height = _ref.height;
33
+
34
+ var _useContext = useContext(mapContext),
35
+ instance = _useContext.instance;
36
+
37
+ var domref = useRef(null);
38
+ var markerRef = useRef(null);
39
+ var type = useMapType();
40
+ useEffect(function () {
41
+ if (!instance.map) {
42
+ return;
43
+ } // leaflet下还未实现
44
+
45
+
46
+ if (type.AMap && !markerRef.current) {
47
+ var marker = new AMap.Marker({
48
+ content: domref.current,
49
+ visible: false,
50
+ zIndex: maxIndex,
51
+ map: instance.map,
52
+ offset: [-width * 0.5, -height - 32]
53
+ });
54
+ markerRef.current = marker;
55
+ marker.on('click', function () {
56
+ maxIndex++;
57
+
58
+ if (marker.getzIndex() !== maxIndex) {
59
+ marker.setzIndex(maxIndex);
60
+ }
61
+ });
62
+ }
63
+ }, [instance.map, visible, center]);
64
+ useEffect(function () {
65
+ var marker = markerRef.current;
66
+
67
+ if (!marker || !center) {
68
+ return undefined;
69
+ }
70
+
71
+ if (type.AMap) {
72
+ var lnglat = _construct(AMap.LngLat, _toConsumableArray(center));
73
+
74
+ if (visible) {
75
+ marker.setPosition(lnglat);
76
+ marker.setContent(domref.current);
77
+ ReactDOM.render(children, domref.current);
78
+ marker.show();
79
+ } else {
80
+ marker.hide();
81
+ ReactDOM.unmountComponentAtNode(domref.current);
82
+ instance.map.remove(markerRef.current);
83
+ markerRef.current = null;
84
+ }
85
+ } // eslint-disable-next-line react-hooks/exhaustive-deps
86
+
87
+ }, [visible, center, instance.map]);
88
+
89
+ _useUnmount(function () {
90
+ try {
91
+ instance.map.remove(markerRef.current);
92
+ markerRef.current = null;
93
+ } catch (_) {}
94
+ });
95
+
96
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
97
+ ref: domref,
98
+ style: {
99
+ width: width,
100
+ height: height
101
+ }
102
+ }));
103
+ }
@@ -1,3 +1,11 @@
1
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
2
+
3
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
+
5
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
6
+
7
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
8
+
1
9
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
10
 
3
11
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -13,19 +21,41 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
21
  import React, { useState } from 'react';
14
22
  import Map from '../BasicMap';
15
23
  import ClusterLayer from '../ClusterLayer';
16
- import InfoWindow from '.';
24
+ import InfoWindow from './MakerLikeWindow';
17
25
  import deviceList from '../points.json';
18
26
  import Player from '../../Player';
19
27
 
20
28
  var App = function App() {
21
- var _useState = useState({
22
- visible: false,
23
- center: undefined
24
- }),
29
+ var _useState = useState([]),
25
30
  _useState2 = _slicedToArray(_useState, 2),
26
31
  state = _useState2[0],
27
32
  setState = _useState2[1];
28
33
 
34
+ var addDeviceInfoWindow = function addDeviceInfoWindow(item) {
35
+ var longitude = item.longitude,
36
+ latitude = item.latitude,
37
+ cid = item.cid;
38
+ var arr = state;
39
+ var index = arr.findIndex(function (v) {
40
+ return v.cid === cid;
41
+ });
42
+
43
+ if (index === -1) {
44
+ arr.push({
45
+ visible: true,
46
+ center: [longitude, latitude],
47
+ cid: cid,
48
+ url: 'http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4'
49
+ });
50
+ }
51
+
52
+ if (index > -1 && !arr[index].visible) {
53
+ arr[index].visible = true;
54
+ }
55
+
56
+ setState(_toConsumableArray(arr));
57
+ };
58
+
29
59
  return /*#__PURE__*/React.createElement("div", {
30
60
  style: {
31
61
  width: '100%',
@@ -34,23 +64,20 @@ var App = function App() {
34
64
  }, /*#__PURE__*/React.createElement(Map, null, /*#__PURE__*/React.createElement(ClusterLayer, {
35
65
  points: deviceList,
36
66
  onPointClick: function onPointClick(point) {
37
- return setState(function (old) {
38
- return Object.assign(Object.assign({}, old), {
39
- visible: true,
40
- center: [point.longitude, point.latitude]
41
- });
42
- });
43
- }
44
- }), /*#__PURE__*/React.createElement(InfoWindow, {
45
- visible: state.visible,
46
- center: state.center
47
- }, /*#__PURE__*/React.createElement("div", {
48
- style: {
49
- width: 560,
50
- height: 360,
51
- background: '#fff'
67
+ return addDeviceInfoWindow(point);
52
68
  }
53
- }, /*#__PURE__*/React.createElement(Player, null)))));
69
+ }), state.map(function (item) {
70
+ return /*#__PURE__*/React.createElement(InfoWindow, {
71
+ visible: item.visible,
72
+ center: item.center,
73
+ key: item.cid,
74
+ width: 200,
75
+ height: 100
76
+ }, /*#__PURE__*/React.createElement(Player, {
77
+ url: item.url,
78
+ hideContrallerBar: true
79
+ }));
80
+ })));
54
81
  };
55
82
 
56
83
  export default App;
@@ -1,8 +1,10 @@
1
- import React from 'react';
2
- interface InfoWindowProps {
3
- children: React.ReactNode;
1
+ /// <reference types="react" />
2
+ /// <reference types="src/map/amap" />
3
+ export interface InfoWindowProps {
4
+ children: JSX.Element;
4
5
  visible?: boolean;
5
6
  center?: [number, number];
7
+ width: number;
8
+ height: number;
6
9
  }
7
- export default function InfoWindow({ children, visible, center }: InfoWindowProps): JSX.Element;
8
- export {};
10
+ export default function InfoWindow({ children, visible, center, width, height }: InfoWindowProps): JSX.Element;
@@ -16,15 +16,17 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
16
16
 
17
17
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
18
18
 
19
+ /// <reference path="../AMap.d.ts" />
19
20
  import React, { useContext, useEffect, useRef } from 'react';
20
21
  import ReactDOM from 'react-dom';
21
22
  import { mapContext } from '../Context';
22
23
  import useMapType from '../hook/useMapType';
23
- var _global = window;
24
24
  export default function InfoWindow(_ref) {
25
25
  var children = _ref.children,
26
26
  visible = _ref.visible,
27
- center = _ref.center;
27
+ center = _ref.center,
28
+ width = _ref.width,
29
+ height = _ref.height;
28
30
 
29
31
  var _useContext = useContext(mapContext),
30
32
  instance = _useContext.instance;
@@ -39,9 +41,8 @@ export default function InfoWindow(_ref) {
39
41
 
40
42
 
41
43
  if (type.AMap && !infoWindowRef.current) {
42
- var AMap = _global.AMap;
43
44
  var infoWindow = new AMap.InfoWindow({
44
- isCustom: true,
45
+ size: [width, height],
45
46
  content: domref.current,
46
47
  autoMove: false,
47
48
  offset: [0, -32]
@@ -58,11 +59,11 @@ export default function InfoWindow(_ref) {
58
59
  }
59
60
 
60
61
  if (type.AMap) {
61
- var AMap = _global.AMap;
62
+ var map = instance.map;
62
63
 
63
64
  var lnglat = _construct(AMap.LngLat, _toConsumableArray(center));
64
65
 
65
- instance.map.setCenter(lnglat); // eslint-disable-next-line @typescript-eslint/no-unused-expressions
66
+ map.setCenter(lnglat); // eslint-disable-next-line @typescript-eslint/no-unused-expressions
66
67
 
67
68
  visible ? !infoWindow.getIsOpen() ? (infoWindow.close(), infoWindow.open(instance.map, lnglat)) : infoWindow.open(instance.map, lnglat) : infoWindow.close();
68
69
  } // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -23,7 +23,7 @@ export interface IMapOptions {
23
23
  }
24
24
  export class IMapInstance {
25
25
  constructor(ele: HTMLDivElement, options?: IMapOptions);
26
- map: Map;
26
+ map: AMap.Map | LMap.Map;
27
27
  config: IMapOptions;
28
28
  createMap(): void;
29
29
  destoryMap(): void;
@@ -1,11 +1,11 @@
1
+ /// <reference types="src/map/amap" />
1
2
  import { Map } from '../interface';
2
- import { AMap as AMapType } from '../AMap';
3
3
  import './index.less';
4
4
  export interface IUseMarkerProps {
5
5
  map: Map;
6
6
  center: [number, number];
7
7
  createIcon: (options?: any) => any;
8
- options?: AMapType.MarkerOptions;
8
+ options?: AMap.MarkerOptions;
9
9
  }
10
10
  declare function useMarker({ map, center, createIcon, options }: IUseMarkerProps): any;
11
11
  export default useMarker;
@@ -1,17 +1,3 @@
1
- function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct.bind(); } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
2
-
3
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
4
-
5
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
6
-
7
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
8
-
9
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
10
-
11
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
12
-
13
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
14
-
15
1
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
16
2
 
17
3
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -24,10 +10,10 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
24
10
 
25
11
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
26
12
 
13
+ /// <reference path="../AMap.d.ts" />
27
14
  import { useEffect, useRef, useState } from 'react';
28
15
  import useMapType from '../hook/useMapType';
29
16
  import "./index.css";
30
- var _global = window;
31
17
 
32
18
  function useMarker(_ref) {
33
19
  var map = _ref.map,
@@ -70,13 +56,11 @@ function useMarker(_ref) {
70
56
  }
71
57
 
72
58
  if (type.AMap) {
73
- var AMap = _global.AMap;
74
-
75
59
  if (inMap.current) {
76
- state.marker.setPosition(_construct(AMap.LngLat, _toConsumableArray(center)));
60
+ state.marker.setPosition(center);
77
61
  } else {
78
62
  var _marker = new AMap.Marker(Object.assign({
79
- position: _construct(AMap.LngLat, _toConsumableArray(center))
63
+ position: center
80
64
  }, options));
81
65
 
82
66
  map.add(_marker);
@@ -52,6 +52,7 @@ declare class Api {
52
52
  unload: () => void;
53
53
  reload: () => void;
54
54
  toggleFit: () => void;
55
+ setIndex: (i: number) => void;
55
56
  destroy: () => void;
56
57
  }
57
58
  export declare type TypeAndPlay = {
@@ -165,6 +165,8 @@ var Api = /*#__PURE__*/function () {
165
165
 
166
166
  this.toggleFit = function () {};
167
167
 
168
+ this.setIndex = function (i) {};
169
+
168
170
  this.destroy = function () {
169
171
  _this.container = null;
170
172
  };
package/es/Player/demo.js CHANGED
@@ -197,7 +197,7 @@ function Demo2() {
197
197
 
198
198
  function Demo3() {
199
199
  var _useState5 = useState({
200
- url: 'http://192.168.101.161:18090/flv/vod/2b9cb54836e136630_34/187981bd526bdf548.flv?origin_url=sdk%3A%2F%2Fadmin%3Aabc12345%40192.168.14.3%3A8000%2Fcam%2Fplayback%3Ffactory%3Dhikvision%26channel%3D34%26subType%3D0%26startTime%3D1652889636%26endTime%3D1652890200',
200
+ url: 'http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4',
201
201
  tempUrl: '',
202
202
  begin: 1652889636,
203
203
  end: 1652890200
@@ -208,7 +208,8 @@ function Demo3() {
208
208
 
209
209
  return /*#__PURE__*/React.createElement("div", {
210
210
  style: {
211
- width: '100%',
211
+ width: '600px',
212
+ height: '400px',
212
213
  marginTop: 20
213
214
  }
214
215
  }, /*#__PURE__*/React.createElement("h3", null, " \u524D\u7AEF\u5F55\u50CF\u89C6\u9891\u64AD\u653E"), /*#__PURE__*/React.createElement("div", {
@@ -247,7 +248,11 @@ function Demo3() {
247
248
  end: state.end,
248
249
  url: state.url,
249
250
  onSeek: function onSeek(time) {
250
- return console.log(time);
251
+ return setState(function (old) {
252
+ return Object.assign(Object.assign({}, old), {
253
+ url: "".concat(old.url, "?").concat(time)
254
+ });
255
+ });
251
256
  }
252
257
  }));
253
258
  }
@@ -78,17 +78,12 @@ function ErrorEvent(_ref) {
78
78
  }
79
79
 
80
80
  event.on(EventName.ERROR, errorHandle);
81
+ event.on(EventName.CLEAR_ERROR_TIMER, clearErrorTimer);
81
82
  event.addEventListener('error', errorHandle); //获取video状态清除错误状态
82
83
 
83
84
  event.addEventListener('canplay', reloadSuccess);
84
85
  return function () {
85
- //PS 对象销毁时事件自动回收
86
- // if (flv) {
87
- // flv.off(flvjs.Events.ERROR, errorHandle);
88
- // }
89
- // if (hls) {
90
- // hls.off(Hls.Events.ERROR, errorHandle);
91
- // }
86
+ // flv, hls事件不用主动销毁,库内部自己处理
92
87
  event.off(EventName.ERROR, errorHandle);
93
88
  event.removeEventListener('error', errorHandle);
94
89
  event.removeEventListener('canplay', reloadSuccess);
@@ -112,7 +107,7 @@ function ErrorEvent(_ref) {
112
107
  }, 2 * 1000);
113
108
  return function () {
114
109
  clearTimeout(reloadTimer.current);
115
- };
110
+ }; // eslint-disable-next-line react-hooks/exhaustive-deps
116
111
  }, [errorTimer, api, event, flv, hls]);
117
112
  return /*#__PURE__*/React.createElement(React.Fragment, null);
118
113
  }
@@ -2,8 +2,7 @@
2
2
  import type { IFrontendPlayerProps } from './player';
3
3
  /**
4
4
  * @desc 主组件,负责片段整体逻辑控制
5
- * @param param0
6
- * @returns
5
+ * @return JSX.Element
7
6
  */
8
7
  declare function FrontendPlayer({ url, begin, end, onSeek, forwordRef, customTimeLine, onCanPlayerInit, ...props }: IFrontendPlayerProps): JSX.Element;
9
8
  export default FrontendPlayer;