@cloud-app-dev/vidc 3.0.3 → 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.
- package/es/Map/AMap.d.ts +6839 -1319
- package/es/Map/BasicMap/AMapInstance.d.ts +4 -3
- package/es/Map/BasicMap/AMapInstance.js +3 -4
- package/es/Map/BasicMap/LeafletInstance.d.ts +3 -3
- package/es/Map/ClusterLayer/hook.d.ts +4 -4
- package/es/Map/ClusterLayer/hook.js +20 -24
- package/es/Map/ClusterLayer/index.d.ts +1 -0
- package/es/Map/ClusterLayer/index.js +1 -0
- package/es/Map/InfoWindow/MakerLikeWindow.d.ts +4 -0
- package/es/Map/InfoWindow/MakerLikeWindow.js +103 -0
- package/es/Map/InfoWindow/demo.js +48 -21
- package/es/Map/InfoWindow/index.d.ts +7 -5
- package/es/Map/InfoWindow/index.js +7 -6
- package/es/Map/interface.d.ts +1 -1
- package/es/Map/useMarker/index.d.ts +2 -2
- package/es/Map/useMarker/index.js +3 -19
- package/es/Player/api/index.js +0 -1
- package/es/Player/event/errorEvent.js +3 -8
- package/es/Player/single_player.js +6 -1
- package/es/ScreenPlayer/Live.js +9 -1
- package/es/ScreenPlayer/LiveTools.d.ts +3 -1
- package/es/ScreenPlayer/LiveTools.js +8 -1
- package/es/ScreenPlayer/PlayerWithExt.js +32 -4
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
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():
|
|
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
|
-
|
|
22
|
-
|
|
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:
|
|
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):
|
|
12
|
-
setCenter(center: [number, number] | LatLng):
|
|
13
|
-
getZoom():
|
|
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
|
-
|
|
2
|
-
import {
|
|
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 &
|
|
5
|
-
export declare function useMarkers(points?: MapPoint[]):
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
81
|
-
|
|
82
|
-
|
|
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
|
|
|
@@ -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
|
|
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
|
-
},
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
|
|
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
|
|
62
|
+
var map = instance.map;
|
|
62
63
|
|
|
63
64
|
var lnglat = _construct(AMap.LngLat, _toConsumableArray(center));
|
|
64
65
|
|
|
65
|
-
|
|
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
|
package/es/Map/interface.d.ts
CHANGED
|
@@ -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?:
|
|
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(
|
|
60
|
+
state.marker.setPosition(center);
|
|
77
61
|
} else {
|
|
78
62
|
var _marker = new AMap.Marker(Object.assign({
|
|
79
|
-
position:
|
|
63
|
+
position: center
|
|
80
64
|
}, options));
|
|
81
65
|
|
|
82
66
|
map.add(_marker);
|
package/es/Player/api/index.js
CHANGED
|
@@ -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
|
-
//
|
|
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
|
}
|
|
@@ -16,6 +16,7 @@ import { __rest } from "tslib";
|
|
|
16
16
|
import React, { useEffect, useMemo, useRef, useState, useImperativeHandle } from 'react';
|
|
17
17
|
import { usePlayerApi } from './api';
|
|
18
18
|
import { usePlayerEvent, useRegisterPlayerEvents, useVideoEvents } from './event';
|
|
19
|
+
import EventName from './event/eventName';
|
|
19
20
|
import ContrallerBar from './contraller_bar';
|
|
20
21
|
import ContrallerEvent from './contraller_bar/contraller_event';
|
|
21
22
|
import LiveHeart from './live_heart';
|
|
@@ -99,7 +100,11 @@ var SinglePlayer = /*#__PURE__*/React.forwardRef(function (_a, ref) {
|
|
|
99
100
|
container: domRef.current
|
|
100
101
|
});
|
|
101
102
|
});
|
|
102
|
-
}, []); //
|
|
103
|
+
}, []); // url 变化清理错误次数
|
|
104
|
+
|
|
105
|
+
useEffect(function () {
|
|
106
|
+
event && event.emit(EventName.CLEAR_ERROR_TIMER); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
107
|
+
}, [url]); // 特殊接口实现 reload是可能被重写的,但是API只暴露原生的方法
|
|
103
108
|
|
|
104
109
|
var reload = function reload() {
|
|
105
110
|
return playReload(video, event, flv, hls, url);
|
package/es/ScreenPlayer/Live.js
CHANGED
|
@@ -14,6 +14,7 @@ import React, { useMemo, useRef, useState } from 'react';
|
|
|
14
14
|
import { ScreenType, mergeFill } from './utils';
|
|
15
15
|
import { LivePlayerWithExt } from './PlayerWithExt';
|
|
16
16
|
import Tools from './LiveTools';
|
|
17
|
+
import useVideoFit from './useVideoFit';
|
|
17
18
|
import "./index.css";
|
|
18
19
|
|
|
19
20
|
function LivePlayer(_ref) {
|
|
@@ -30,7 +31,12 @@ function LivePlayer(_ref) {
|
|
|
30
31
|
state = _useState2[0],
|
|
31
32
|
setState = _useState2[1];
|
|
32
33
|
|
|
33
|
-
var domRef = useRef(null);
|
|
34
|
+
var domRef = useRef(null);
|
|
35
|
+
|
|
36
|
+
var _useVideoFit = useVideoFit(domRef, []),
|
|
37
|
+
fit = _useVideoFit.fit,
|
|
38
|
+
toggleFit = _useVideoFit.toggleFit; // 缓存所有player对象
|
|
39
|
+
|
|
34
40
|
|
|
35
41
|
var playerRef = useRef([]);
|
|
36
42
|
var screenType = useMemo(function () {
|
|
@@ -96,6 +102,8 @@ function LivePlayer(_ref) {
|
|
|
96
102
|
}
|
|
97
103
|
}));
|
|
98
104
|
})), /*#__PURE__*/React.createElement(Tools, {
|
|
105
|
+
fit: fit,
|
|
106
|
+
toggleFit: toggleFit,
|
|
99
107
|
getPlayerItem: getPlayerItem,
|
|
100
108
|
screenNum: state.screenNum,
|
|
101
109
|
mode: state.mode,
|
|
@@ -10,6 +10,8 @@ interface IToolsProps {
|
|
|
10
10
|
screenNum: number;
|
|
11
11
|
mode: PlayModeType;
|
|
12
12
|
getPlayerItem: () => ExportPlayerType | undefined;
|
|
13
|
+
fit?: string;
|
|
14
|
+
toggleFit?: () => void;
|
|
13
15
|
}
|
|
14
|
-
declare function LiveTools({ containerRef, updateState, screenNum, getPlayerItem, mode }: IToolsProps): JSX.Element;
|
|
16
|
+
declare function LiveTools({ containerRef, updateState, screenNum, getPlayerItem, mode, toggleFit, fit }: IToolsProps): JSX.Element;
|
|
15
17
|
export default LiveTools;
|
|
@@ -20,7 +20,9 @@ function LiveTools(_ref) {
|
|
|
20
20
|
updateState = _ref.updateState,
|
|
21
21
|
screenNum = _ref.screenNum,
|
|
22
22
|
getPlayerItem = _ref.getPlayerItem,
|
|
23
|
-
mode = _ref.mode
|
|
23
|
+
mode = _ref.mode,
|
|
24
|
+
toggleFit = _ref.toggleFit,
|
|
25
|
+
fit = _ref.fit;
|
|
24
26
|
|
|
25
27
|
var _useFullscreen = _useFullscreen3(containerRef),
|
|
26
28
|
_useFullscreen2 = _slicedToArray(_useFullscreen, 2),
|
|
@@ -85,6 +87,11 @@ function LiveTools(_ref) {
|
|
|
85
87
|
},
|
|
86
88
|
onClick: reload
|
|
87
89
|
}, "\u91CD\u8FDE"), /*#__PURE__*/React.createElement("span", {
|
|
90
|
+
style: {
|
|
91
|
+
padding: 6
|
|
92
|
+
},
|
|
93
|
+
onClick: toggleFit
|
|
94
|
+
}, fit === 'fill' ? '自适应' : '填充'), /*#__PURE__*/React.createElement("span", {
|
|
88
95
|
style: {
|
|
89
96
|
padding: 6
|
|
90
97
|
},
|