@vtx/player 1.1.6 → 1.2.1

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.
@@ -0,0 +1,36 @@
1
+ import React from 'react';
2
+ import { CloudControlPanelProps } from '../controls';
3
+ import { VideoType } from '../player';
4
+ interface VtxPlayerProps {
5
+ /** 视频流地址 */
6
+ url: string;
7
+ /** 是否使用代理播放 */
8
+ enableAgent?: boolean;
9
+ /** 宽度 */
10
+ width?: number;
11
+ /** 高度 */
12
+ height?: number;
13
+ /** 视频流格式,如果为空则根据url自行判断 */
14
+ type?: VideoType;
15
+ /** 截图文件名 */
16
+ captureName?: string;
17
+ /** 通道号 */
18
+ channelNum?: string;
19
+ /** 设备id */
20
+ deviceId?: string;
21
+ /** 云台控制 */
22
+ cloudParams?: CloudControlPanelProps;
23
+ /** 是否展示信息 */
24
+ showInfo?: boolean | 'leftTop' | 'leftBottom' | 'rightTop' | 'rightBottom';
25
+ /** 信息 */
26
+ info?: Array<Array<string>>;
27
+ /** 截图回调 */
28
+ screenshot?: (dataURL: string) => void;
29
+ /** 重置视频大小 */
30
+ resize?: () => void;
31
+ /** 加载结束回调 */
32
+ loaded?: () => void;
33
+ }
34
+ export declare const LivePlayerImage: (props: VtxPlayerProps, selfRef: any) => JSX.Element;
35
+ declare const _default: React.ForwardRefExoticComponent<VtxPlayerProps & React.RefAttributes<unknown>>;
36
+ export default _default;
@@ -0,0 +1,237 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = exports.LivePlayerImage = void 0;
7
+
8
+ var _jsxRuntime = require("react/jsx-runtime");
9
+
10
+ var _react = require("react");
11
+
12
+ var _controls = require("../controls");
13
+
14
+ var _icons = require("../icons");
15
+
16
+ var _player = _interopRequireDefault(require("../player"));
17
+
18
+ var _utils = require("../utils");
19
+
20
+ var _ahooks = require("ahooks");
21
+
22
+ var _space = _interopRequireDefault(require("antd/lib/space"));
23
+
24
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
25
+
26
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
27
+
28
+ 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."); }
29
+
30
+ 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); }
31
+
32
+ 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; }
33
+
34
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
35
+
36
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
37
+
38
+ var LivePlayerImage = function LivePlayerImage(props, selfRef) {
39
+ var url = props.url,
40
+ enableAgent = props.enableAgent,
41
+ _props$width = props.width,
42
+ width = _props$width === void 0 ? '100%' : _props$width,
43
+ _props$height = props.height,
44
+ height = _props$height === void 0 ? '100%' : _props$height,
45
+ captureName = props.captureName,
46
+ type = props.type,
47
+ channelNum = props.channelNum,
48
+ deviceId = props.deviceId,
49
+ cloudParams = props.cloudParams,
50
+ _props$showInfo = props.showInfo,
51
+ showInfo = _props$showInfo === void 0 ? false : _props$showInfo,
52
+ _props$info = props.info,
53
+ info = _props$info === void 0 ? [] : _props$info,
54
+ screenshot = props.screenshot,
55
+ loaded = props.loaded;
56
+ var ref = (0, _react.useRef)(null);
57
+ var wrapRef = (0, _react.useRef)(null);
58
+ var controlsRef = (0, _react.useRef)(null);
59
+ var playerRef = (0, _react.useRef)();
60
+
61
+ var _useFullscreen = (0, _ahooks.useFullscreen)(wrapRef),
62
+ _useFullscreen2 = _slicedToArray(_useFullscreen, 2),
63
+ isFullscreen = _useFullscreen2[0],
64
+ toggleFullscreen = _useFullscreen2[1].toggleFullscreen;
65
+
66
+ var _useSetState = (0, _ahooks.useSetState)({
67
+ play: false,
68
+ error: false,
69
+ loading: false,
70
+ id: 'vtx_hk_player_' + (0, _utils.guidGenerator)(),
71
+ volume: 0,
72
+ showCloudPanel: false
73
+ }),
74
+ _useSetState2 = _slicedToArray(_useSetState, 2),
75
+ state = _useSetState2[0],
76
+ setState = _useSetState2[1];
77
+
78
+ (0, _react.useImperativeHandle)(selfRef, function () {
79
+ return {
80
+ resize: function resize() {
81
+ var player = playerRef.current;
82
+ player && url && player.resize();
83
+ }
84
+ };
85
+ });
86
+ (0, _react.useEffect)(function () {
87
+ var container = ref.current;
88
+
89
+ if (!url || !container) {
90
+ playerRef.current && playerRef.current.destroy();
91
+ return;
92
+ }
93
+
94
+ var player = new _player["default"]({
95
+ url: url,
96
+ enableAgent: enableAgent,
97
+ container: container,
98
+ type: type
99
+ });
100
+ playerRef.current = player;
101
+ setState({
102
+ loading: true,
103
+ error: false
104
+ });
105
+ player.play().then(function () {
106
+ return setState({
107
+ play: true,
108
+ error: false
109
+ });
110
+ })["catch"](function () {
111
+ return setState({
112
+ error: true
113
+ });
114
+ })["finally"](function () {
115
+ setState({
116
+ loading: false
117
+ }), loaded && loaded();
118
+ });
119
+ return function () {
120
+ player.destroy();
121
+ setState({
122
+ error: false,
123
+ loading: false,
124
+ play: false
125
+ });
126
+ };
127
+ }, [url]);
128
+ (0, _react.useEffect)(function () {
129
+ var canvas = document.getElementById('canvas');
130
+ var ctx = canvas.getContext('2d');
131
+ var i = 0;
132
+ var timer = setInterval(function () {
133
+ ctx.beginPath();
134
+ var x = Math.random() * 300;
135
+ var x2 = Math.random() * 150;
136
+ var y = Math.random() * 300;
137
+ var y2 = Math.random() * 150;
138
+ ctx.strokeStyle = 'red';
139
+ ctx.lineWidth = 3;
140
+ ctx.rect(x, y, x2 > 20 ? x2 : 20, y2 > 20 ? y2 : 20);
141
+ i++;
142
+ ctx.stroke(); // ctx.closePath();
143
+
144
+ if (i > 5) {
145
+ timer && clearTimeout(timer);
146
+ }
147
+ }, 2000);
148
+ return function () {
149
+ timer && clearTimeout(timer);
150
+ };
151
+ }, []);
152
+
153
+ var handleCapture = function handleCapture(e) {
154
+ var player = playerRef.current;
155
+ player && player.capture(captureName, screenshot);
156
+ e.stopPropagation();
157
+ };
158
+
159
+ var handleFullScreen = function handleFullScreen(e) {
160
+ toggleFullscreen();
161
+ var player = playerRef.current;
162
+ player && player.resize();
163
+ e.stopPropagation();
164
+ };
165
+
166
+ return (0, _jsxRuntime.jsxs)("div", Object.assign({
167
+ className: "vtx-live-player",
168
+ ref: wrapRef,
169
+ style: {
170
+ width: width,
171
+ height: height,
172
+ position: 'relative'
173
+ }
174
+ }, {
175
+ children: [(0, _jsxRuntime.jsx)("div", {
176
+ ref: ref,
177
+ style: {
178
+ height: '100%',
179
+ width: '100%'
180
+ },
181
+ id: state.id
182
+ }), (0, _jsxRuntime.jsx)("canvas", {
183
+ id: "canvas",
184
+ width: width,
185
+ height: height,
186
+ style: {
187
+ position: 'absolute',
188
+ top: 0,
189
+ left: 0,
190
+ right: 0,
191
+ bottom: 0
192
+ }
193
+ }), state.error && (0, _jsxRuntime.jsx)(_controls.ErrorState, {}), state.loading && (0, _jsxRuntime.jsx)(_controls.LoadingState, {}), state.showCloudPanel && cloudParams && (0, _jsxRuntime.jsx)(_controls.CloudControlPanel, Object.assign({}, cloudParams)), (0, _jsxRuntime.jsx)(_controls.InfoPanel, {
194
+ showInfo: showInfo,
195
+ info: info
196
+ }), (0, _jsxRuntime.jsx)("div", Object.assign({
197
+ className: "controls",
198
+ ref: controlsRef
199
+ }, {
200
+ children: (0, _jsxRuntime.jsxs)(_space["default"], Object.assign({
201
+ className: "right",
202
+ size: 12,
203
+ align: "center"
204
+ }, {
205
+ children: [(0, _jsxRuntime.jsx)(_controls.VolumeControl, {
206
+ player: playerRef.current,
207
+ container: controlsRef.current
208
+ }), !!screenshot && (0, _jsxRuntime.jsx)(_icons.CaptureIcon, {
209
+ onClick: handleCapture
210
+ }), channelNum && deviceId && (0, _jsxRuntime.jsx)(_controls.TalkControl, {
211
+ player: playerRef.current,
212
+ channelNum: channelNum,
213
+ deviceId: deviceId
214
+ }), (cloudParams === null || cloudParams === void 0 ? void 0 : cloudParams.type) !== 'none' && (0, _jsxRuntime.jsx)(_icons.CloudControlIcon, {
215
+ active: state.showCloudPanel,
216
+ onClick: function onClick() {
217
+ return setState({
218
+ showCloudPanel: !state.showCloudPanel
219
+ });
220
+ }
221
+ }), isFullscreen ? (0, _jsxRuntime.jsx)(_icons.ExitFullScreenIcon, {
222
+ onClick: handleFullScreen
223
+ }) : (0, _jsxRuntime.jsx)(_icons.FullScreenIcon, {
224
+ onClick: handleFullScreen
225
+ })]
226
+ }))
227
+ }))]
228
+ }));
229
+ }; // LivePlayerImage.displayName = 'live-player';
230
+
231
+
232
+ exports.LivePlayerImage = LivePlayerImage;
233
+
234
+ var _default = /*#__PURE__*/(0, _react.forwardRef)(LivePlayerImage);
235
+
236
+ exports["default"] = _default;
237
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["LivePlayerImage","props","selfRef","url","enableAgent","width","height","captureName","type","channelNum","deviceId","cloudParams","showInfo","info","screenshot","loaded","ref","useRef","wrapRef","controlsRef","playerRef","useFullscreen","isFullscreen","toggleFullscreen","useSetState","play","error","loading","id","guidGenerator","volume","showCloudPanel","state","setState","useImperativeHandle","resize","player","current","useEffect","container","destroy","Player","then","canvas","document","getElementById","ctx","getContext","i","timer","setInterval","beginPath","x","Math","random","x2","y","y2","strokeStyle","lineWidth","rect","stroke","clearTimeout","handleCapture","e","capture","stopPropagation","handleFullScreen","_jsxs","Object","assign","className","style","position","children","_jsx","top","left","right","bottom","ErrorState","LoadingState","CloudControlPanel","InfoPanel","Space","size","align","VolumeControl","CaptureIcon","onClick","TalkControl","CloudControlIcon","active","ExitFullScreenIcon","FullScreenIcon","forwardRef"],"sources":["live-player-image/index.js"],"sourcesContent":["import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { forwardRef, useEffect, useImperativeHandle, useRef } from 'react';\nimport { CloudControlPanel, ErrorState, InfoPanel, LoadingState, TalkControl, VolumeControl, } from '../controls';\nimport { CaptureIcon, CloudControlIcon, ExitFullScreenIcon, FullScreenIcon } from '../icons';\nimport Player from '../player';\nimport { guidGenerator } from '../utils';\nimport { useFullscreen, useSetState } from 'ahooks';\n// import { Space } from 'antd';\nimport Space from 'antd/lib/space';\nexport const LivePlayerImage = (props, selfRef) => {\n const { url, enableAgent, width = '100%', height = '100%', captureName, type, channelNum, deviceId, cloudParams, showInfo = false, info = [], screenshot, loaded, } = props;\n const ref = useRef(null);\n const wrapRef = useRef(null);\n const controlsRef = useRef(null);\n const playerRef = useRef();\n const [isFullscreen, { toggleFullscreen }] = useFullscreen(wrapRef);\n const [state, setState] = useSetState({\n play: false,\n error: false,\n loading: false,\n id: 'vtx_hk_player_' + guidGenerator(),\n volume: 0,\n showCloudPanel: false,\n });\n useImperativeHandle(selfRef, () => {\n return {\n resize: () => {\n const player = playerRef.current;\n player && url && player.resize();\n },\n };\n });\n useEffect(() => {\n const container = ref.current;\n if (!url || !container) {\n playerRef.current && playerRef.current.destroy();\n return;\n }\n const player = new Player({ url, enableAgent, container, type });\n playerRef.current = player;\n setState({ loading: true, error: false });\n player\n .play()\n .then(() => setState({ play: true, error: false }))\n .catch(() => setState({ error: true }))\n .finally(() => {\n setState({ loading: false }), loaded && loaded();\n });\n return () => {\n player.destroy();\n setState({ error: false, loading: false, play: false });\n };\n }, [url]);\n useEffect(() => {\n const canvas = document.getElementById('canvas');\n const ctx = canvas.getContext('2d');\n let i = 0;\n const timer = setInterval(() => {\n ctx.beginPath();\n const x = Math.random() * 300;\n const x2 = Math.random() * 150;\n const y = Math.random() * 300;\n const y2 = Math.random() * 150;\n ctx.strokeStyle = 'red';\n ctx.lineWidth = 3;\n ctx.rect(x, y, x2 > 20 ? x2 : 20, y2 > 20 ? y2 : 20);\n i++;\n ctx.stroke();\n // ctx.closePath();\n if (i > 5) {\n timer && clearTimeout(timer);\n }\n }, 2000);\n return () => {\n timer && clearTimeout(timer);\n };\n }, []);\n const handleCapture = (e) => {\n const player = playerRef.current;\n player && player.capture(captureName, screenshot);\n e.stopPropagation();\n };\n const handleFullScreen = (e) => {\n toggleFullscreen();\n const player = playerRef.current;\n player && player.resize();\n e.stopPropagation();\n };\n return (_jsxs(\"div\", Object.assign({ className: \"vtx-live-player\", ref: wrapRef, style: { width, height, position: 'relative' } }, { children: [_jsx(\"div\", { ref: ref, style: { height: '100%', width: '100%' }, id: state.id }), _jsx(\"canvas\", { id: \"canvas\", width: width, height: height, style: {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n } }), state.error && _jsx(ErrorState, {}), state.loading && _jsx(LoadingState, {}), state.showCloudPanel && cloudParams && _jsx(CloudControlPanel, Object.assign({}, cloudParams)), _jsx(InfoPanel, { showInfo: showInfo, info: info }), _jsx(\"div\", Object.assign({ className: \"controls\", ref: controlsRef }, { children: _jsxs(Space, Object.assign({ className: \"right\", size: 12, align: \"center\" }, { children: [_jsx(VolumeControl, { player: playerRef.current, container: controlsRef.current }), !!screenshot && _jsx(CaptureIcon, { onClick: handleCapture }), channelNum && deviceId && (_jsx(TalkControl, { player: playerRef.current, channelNum: channelNum, deviceId: deviceId })), (cloudParams === null || cloudParams === void 0 ? void 0 : cloudParams.type) !== 'none' && (_jsx(CloudControlIcon, { active: state.showCloudPanel, onClick: () => setState({ showCloudPanel: !state.showCloudPanel }) })), isFullscreen ? (_jsx(ExitFullScreenIcon, { onClick: handleFullScreen })) : (_jsx(FullScreenIcon, { onClick: handleFullScreen }))] })) }))] })));\n};\n// LivePlayerImage.displayName = 'live-player';\nexport default forwardRef(LivePlayerImage);\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;;;;;;;;;;;;;AACO,IAAMA,eAAe,GAAG,SAAlBA,eAAkB,CAACC,KAAD,EAAQC,OAAR,EAAoB;EAC/C,IAAQC,GAAR,GAAsKF,KAAtK,CAAQE,GAAR;EAAA,IAAaC,WAAb,GAAsKH,KAAtK,CAAaG,WAAb;EAAA,mBAAsKH,KAAtK,CAA0BI,KAA1B;EAAA,IAA0BA,KAA1B,6BAAkC,MAAlC;EAAA,oBAAsKJ,KAAtK,CAA0CK,MAA1C;EAAA,IAA0CA,MAA1C,8BAAmD,MAAnD;EAAA,IAA2DC,WAA3D,GAAsKN,KAAtK,CAA2DM,WAA3D;EAAA,IAAwEC,IAAxE,GAAsKP,KAAtK,CAAwEO,IAAxE;EAAA,IAA8EC,UAA9E,GAAsKR,KAAtK,CAA8EQ,UAA9E;EAAA,IAA0FC,QAA1F,GAAsKT,KAAtK,CAA0FS,QAA1F;EAAA,IAAoGC,WAApG,GAAsKV,KAAtK,CAAoGU,WAApG;EAAA,sBAAsKV,KAAtK,CAAiHW,QAAjH;EAAA,IAAiHA,QAAjH,gCAA4H,KAA5H;EAAA,kBAAsKX,KAAtK,CAAmIY,IAAnI;EAAA,IAAmIA,IAAnI,4BAA0I,EAA1I;EAAA,IAA8IC,UAA9I,GAAsKb,KAAtK,CAA8Ia,UAA9I;EAAA,IAA0JC,MAA1J,GAAsKd,KA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+ {"version":3,"file":"css.js","names":[],"sources":["live-player-image/style/index.js"],"sourcesContent":["import \"antd/lib/space/style\";\nimport '../../controls/style';\nimport './index.less';\n"],"mappings":";;AAAA;;AACA;;AACA"}
@@ -0,0 +1,74 @@
1
+ .vtx-live-player {
2
+ position: relative;
3
+ background-color: #2b3d51;
4
+ border: 1px solid transparent;
5
+ }
6
+ .vtx-live-player .controls {
7
+ position: absolute;
8
+ bottom: 0;
9
+ display: -webkit-box;
10
+ display: -ms-flexbox;
11
+ display: flex;
12
+ -webkit-box-align: center;
13
+ -ms-flex-align: center;
14
+ align-items: center;
15
+ width: 100%;
16
+ height: 30px;
17
+ padding: 0 12px;
18
+ background-color: #131d27;
19
+ opacity: 0;
20
+ -webkit-transition: opacity 0.5s;
21
+ transition: opacity 0.5s;
22
+ }
23
+ .vtx-live-player .controls .right {
24
+ margin-left: auto;
25
+ }
26
+ .vtx-live-player .controls .right > div {
27
+ height: 24px;
28
+ }
29
+ .vtx-live-player:hover .controls {
30
+ opacity: 1;
31
+ }
32
+ .vtx-live-player video {
33
+ width: 100%;
34
+ height: 100%;
35
+ -o-object-fit: fill;
36
+ object-fit: fill;
37
+ }
38
+ .vtx-live-player .sub-wnd {
39
+ width: 100% !important;
40
+ height: 100% !important;
41
+ background-color: #2b3d51 !important;
42
+ border: 1px solid transparent !important;
43
+ }
44
+ .vtx-live-player .error-container {
45
+ position: absolute;
46
+ top: 50%;
47
+ left: 50%;
48
+ display: -webkit-box;
49
+ display: -ms-flexbox;
50
+ display: flex;
51
+ -webkit-box-orient: vertical;
52
+ -webkit-box-direction: normal;
53
+ -ms-flex-direction: column;
54
+ flex-direction: column;
55
+ -webkit-box-align: center;
56
+ -ms-flex-align: center;
57
+ align-items: center;
58
+ -webkit-transform: translate(-50%, -50%);
59
+ -ms-transform: translate(-50%, -50%);
60
+ transform: translate(-50%, -50%);
61
+ }
62
+ .vtx-live-player .error-container .text {
63
+ margin: 20px 0;
64
+ font-size: 14px;
65
+ color: rgba(255, 255, 255, 0.65);
66
+ }
67
+ .vtx-live-player .loading-container {
68
+ position: absolute;
69
+ top: 50%;
70
+ left: 50%;
71
+ -webkit-transform: translate(-50%, -50%);
72
+ -ms-transform: translate(-50%, -50%);
73
+ transform: translate(-50%, -50%);
74
+ }
@@ -0,0 +1,3 @@
1
+ import "antd/lib/space/style";
2
+ import '../../controls/style';
3
+ import './index.less';
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+
3
+ require("antd/lib/space/style");
4
+
5
+ require("../../controls/style");
6
+
7
+ require("./index.less");
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["live-player-image/style/index.js"],"sourcesContent":["import \"antd/lib/space/style\";\nimport '../../controls/style';\nimport './index.less';\n"],"mappings":";;AAAA;;AACA;;AACA"}
@@ -0,0 +1,70 @@
1
+ .vtx-live-player {
2
+ position: relative;
3
+ // display: flex;
4
+ // align-items: center;
5
+ // justify-content: center;
6
+ background-color: #2b3d51;
7
+ border: 1px solid transparent;
8
+ .controls {
9
+ position: absolute;
10
+ bottom: 0;
11
+ display: flex;
12
+ align-items: center;
13
+ width: 100%;
14
+ height: 30px;
15
+ padding: 0 12px;
16
+ background-color: #131d27;
17
+ opacity: 0;
18
+ transition: opacity 0.5s;
19
+
20
+ .right {
21
+ margin-left: auto;
22
+
23
+ > div {
24
+ height: 24px;
25
+ }
26
+ }
27
+ }
28
+
29
+ &:hover {
30
+ .controls {
31
+ opacity: 1;
32
+ }
33
+ }
34
+
35
+ video {
36
+ width: 100%;
37
+ height: 100%;
38
+ object-fit: fill;
39
+ }
40
+
41
+ .sub-wnd {
42
+ width: 100% !important;
43
+ height: 100% !important;
44
+ background-color: #2b3d51 !important;
45
+ border: 1px solid transparent !important;
46
+ }
47
+
48
+ .error-container {
49
+ position: absolute;
50
+ top: 50%;
51
+ left: 50%;
52
+ display: flex;
53
+ flex-direction: column;
54
+ align-items: center;
55
+ transform: translate(-50%, -50%);
56
+
57
+ .text {
58
+ margin: 20px 0;
59
+ font-size: 14px;
60
+ color: rgba(255, 255 ,255 , .65);
61
+ }
62
+ }
63
+
64
+ .loading-container {
65
+ position: absolute;
66
+ top: 50%;
67
+ left: 50%;
68
+ transform: translate(-50%, -50%);
69
+ }
70
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vtx/player",
3
- "version": "1.1.6",
3
+ "version": "1.2.1",
4
4
  "private": false,
5
5
  "description": "视频业务组件",
6
6
  "main": "./lib/index.js",