@vtx/player 1.4.17 → 1.5.0
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/lib/bd/PlayerManager.d.ts +1 -0
- package/lib/bd/PlayerManager.js +41 -1
- package/lib/bd/PlayerManager.js.map +1 -1
- package/lib/history-player/index.js +1 -1
- package/lib/history-player/index.js.map +1 -1
- package/lib/new/PlayerManager.d.ts +79 -0
- package/lib/new/PlayerManager.js +283 -0
- package/lib/new/PlayerManager.js.map +1 -0
- package/lib/new/api.d.ts +5 -0
- package/lib/new/api.js +32 -0
- package/lib/new/api.js.map +1 -0
- package/lib/player/index.js +56 -40
- package/lib/player/index.js.map +1 -1
- package/lib/utils/index.js +7 -0
- package/lib/utils/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
9
|
+
|
|
10
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
11
|
+
|
|
12
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
13
|
+
|
|
14
|
+
var PlayerManager = /*#__PURE__*/function () {
|
|
15
|
+
function PlayerManager(opt) {
|
|
16
|
+
_classCallCheck(this, PlayerManager);
|
|
17
|
+
|
|
18
|
+
// 播放器所在的容器ID
|
|
19
|
+
this.el = opt.el;
|
|
20
|
+
this.url = opt.url; // 实时预览播放器
|
|
21
|
+
|
|
22
|
+
this.realPlayer = null; // 录像回放播放器
|
|
23
|
+
|
|
24
|
+
this.recordPlayer = null;
|
|
25
|
+
this.player = null; // 实时预览还是录像回放播放器
|
|
26
|
+
|
|
27
|
+
this.type = opt.type; // 窗口的数量
|
|
28
|
+
|
|
29
|
+
this.playNum = 1; // 当前选中的窗口的索引
|
|
30
|
+
|
|
31
|
+
this.playIndex = 0;
|
|
32
|
+
this.dp = null; // this.initPlayer();
|
|
33
|
+
} //初始化视频插件
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
_createClass(PlayerManager, [{
|
|
37
|
+
key: "initPlayer",
|
|
38
|
+
value: function initPlayer() {// var param = {
|
|
39
|
+
// simNum: 40357902315,
|
|
40
|
+
// channelId: 0,
|
|
41
|
+
// totalChannel: 1,
|
|
42
|
+
// chanelNumInfo: '1,通道1|2,通道2',
|
|
43
|
+
// avDataType: 0,
|
|
44
|
+
// bitStreamType: 1,
|
|
45
|
+
// playerId: this.el,
|
|
46
|
+
// };
|
|
47
|
+
// var _srvVideoUrl = location.origin + '/TopJtbVideo/VideoCmd/';
|
|
48
|
+
// API.postData(_srvVideoUrl + 'RealTimeAVTransRequest', param, callback, error);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* 播放实时预览视频
|
|
52
|
+
* @param opt.streamType: {Number|String} 选填,码流类型,不填默认播放辅码流1,若不存在辅码流1,则自动切换到主码流 1-主码流 2-辅码流1 3-辅码流2
|
|
53
|
+
* @param opt.selectIndex: {Number} 选填,指定从哪个窗口开始播放。不填默认从选中的窗口开始播放
|
|
54
|
+
*/
|
|
55
|
+
|
|
56
|
+
}, {
|
|
57
|
+
key: "playRealVideo",
|
|
58
|
+
value: function playRealVideo() {
|
|
59
|
+
console.log(window);
|
|
60
|
+
window.ConfirmConn(this.el, 40357902315, 0, '47.99.88.129', '18020', 1, {
|
|
61
|
+
srcType: 'ws-flv'
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* 播放录像回放
|
|
66
|
+
* @param opt.channelList {Array<Object>} 通道集合 必填
|
|
67
|
+
* @param opt.startTime {String|Number} 开始时间 必选 timestamp到秒
|
|
68
|
+
* @param opt.endTime {String|Number} 结束时间 必选 timestamp到秒
|
|
69
|
+
* @param opt.recordSource {String|Number} 录像来源 必选 2表示设备录像 3表示中心录像
|
|
70
|
+
* @param opt.streamType {String|Number} 码流类型 可选
|
|
71
|
+
* @param opt.recordType {String|Number} 录像类型 可选
|
|
72
|
+
*/
|
|
73
|
+
// channelList: [{
|
|
74
|
+
// id: channelCode, // {String} 通道编码 -- 用于回放,必填
|
|
75
|
+
// }]
|
|
76
|
+
|
|
77
|
+
}, {
|
|
78
|
+
key: "playRecordVideo",
|
|
79
|
+
value: function playRecordVideo(opt) {
|
|
80
|
+
this.recordPlayer && this.recordPlayer.getRecordList(opt);
|
|
81
|
+
}
|
|
82
|
+
}, {
|
|
83
|
+
key: "setVideoFrame",
|
|
84
|
+
value: function setVideoFrame(viewSize) {
|
|
85
|
+
this.winDom.find('video').each(function (i, obj) {
|
|
86
|
+
var _obj = $(obj);
|
|
87
|
+
|
|
88
|
+
_obj.css('width', '100%').css('height', '100%');
|
|
89
|
+
|
|
90
|
+
var width = _obj.width();
|
|
91
|
+
|
|
92
|
+
var height = _obj.height();
|
|
93
|
+
|
|
94
|
+
if (viewSize === '4:3') {
|
|
95
|
+
if (width / height > 4 / 3) {
|
|
96
|
+
_obj.css('width', height * 4 / 3);
|
|
97
|
+
} else {
|
|
98
|
+
_obj.css('height', width * 3 / 4);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (viewSize === '16:9') {
|
|
103
|
+
if (width / height > 16 / 9) {
|
|
104
|
+
_obj.css('width', height * 16 / 9);
|
|
105
|
+
} else {
|
|
106
|
+
_obj.css('height', width * 9 / 16);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
}, {
|
|
112
|
+
key: "stopVideo",
|
|
113
|
+
value: function stopVideo(index) {
|
|
114
|
+
var that = this;
|
|
115
|
+
|
|
116
|
+
if (index >= this.playNum) {
|
|
117
|
+
return;
|
|
118
|
+
} // this.reSetVideo(index)
|
|
119
|
+
// var video = this.playVideos[index];
|
|
120
|
+
// if (video) {
|
|
121
|
+
// if (that.options.isTtx) {
|
|
122
|
+
// video.ttxplayer.stop();
|
|
123
|
+
// video.ttxplayer.setPlayTime(0);
|
|
124
|
+
// } else {
|
|
125
|
+
// video.pause();
|
|
126
|
+
// video.video.currentTime = 0;
|
|
127
|
+
// }
|
|
128
|
+
// try {
|
|
129
|
+
// var url = video.options.video.url;
|
|
130
|
+
// var devidno = url.split('DevIDNO=')[1].split('&')[0];
|
|
131
|
+
// that.timeMap808[devidno] = new Date().getTime();
|
|
132
|
+
// } catch (e) {}
|
|
133
|
+
// }
|
|
134
|
+
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* 录像暂停
|
|
138
|
+
* 只有正在播放的录像调用才有效
|
|
139
|
+
*/
|
|
140
|
+
|
|
141
|
+
}, {
|
|
142
|
+
key: "pause",
|
|
143
|
+
value: function pause() {
|
|
144
|
+
this.player && this.player.toggleVideo(0);
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* 录像暂停后播放
|
|
148
|
+
* 只有暂停后的录像调用才有效
|
|
149
|
+
*/
|
|
150
|
+
|
|
151
|
+
}, {
|
|
152
|
+
key: "play",
|
|
153
|
+
value: function play() {
|
|
154
|
+
this.player && this.player.toggleVideo(0);
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* 倍速播放
|
|
158
|
+
* @param {number} speed 速率 0.125 0.25 0.5 1 2 4 8 共7种速率
|
|
159
|
+
*/
|
|
160
|
+
|
|
161
|
+
}, {
|
|
162
|
+
key: "playSpeed",
|
|
163
|
+
value: function playSpeed(speed) {
|
|
164
|
+
this.recordPlayer && this.recordPlayer.playSpeed(speed);
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* 关闭播放器
|
|
168
|
+
* @param {number} index 可选,关闭指定索引的窗口的播放器,不传则表示关闭所有播放器
|
|
169
|
+
*/
|
|
170
|
+
|
|
171
|
+
}, {
|
|
172
|
+
key: "close",
|
|
173
|
+
value: function close(index) {
|
|
174
|
+
this.player && this.player.reSetVideo(index);
|
|
175
|
+
|
|
176
|
+
if (this.dp) {
|
|
177
|
+
this.dp.ttxplayer.destroy();
|
|
178
|
+
this.dp.destroy();
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}, {
|
|
182
|
+
key: "resize",
|
|
183
|
+
value: function resize() {
|
|
184
|
+
this.player && this.player.setSize();
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* 设置全屏
|
|
188
|
+
*/
|
|
189
|
+
|
|
190
|
+
}, {
|
|
191
|
+
key: "setFullScreen",
|
|
192
|
+
value: function setFullScreen() {
|
|
193
|
+
this.player.fullScreen();
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* 设置窗口自适应还是拉伸
|
|
197
|
+
* @param {string} playerAdapter selfAdaption 自适应 | stretching 拉伸
|
|
198
|
+
*/
|
|
199
|
+
|
|
200
|
+
}, {
|
|
201
|
+
key: "setPlayerAdapter",
|
|
202
|
+
value: function setPlayerAdapter(playerAdapter) {
|
|
203
|
+
this.player.setPlayerAdapter(playerAdapter);
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* 控制视频播放器显示的路数: 1 4 9 16 25,不会超过最大显示路数
|
|
207
|
+
* @param {number} number
|
|
208
|
+
*/
|
|
209
|
+
|
|
210
|
+
}, {
|
|
211
|
+
key: "setPlayerNum",
|
|
212
|
+
value: function setPlayerNum(number) {
|
|
213
|
+
this.player.setPlayerNum(number);
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* 设置选中的播放器的索引
|
|
217
|
+
* @param {number} index
|
|
218
|
+
*/
|
|
219
|
+
|
|
220
|
+
}, {
|
|
221
|
+
key: "setSelectIndex",
|
|
222
|
+
value: function setSelectIndex(index) {
|
|
223
|
+
this.player.setSelectIndex(index);
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* 录像跳转播放
|
|
227
|
+
* @param {number} time HH:mm:ss格式
|
|
228
|
+
*/
|
|
229
|
+
|
|
230
|
+
}, {
|
|
231
|
+
key: "jumpPlayByTime",
|
|
232
|
+
value: function jumpPlayByTime(time) {
|
|
233
|
+
this.player.seekVideo(0, time);
|
|
234
|
+
} // ----------------- 播放器事件 ------------------------
|
|
235
|
+
|
|
236
|
+
}, {
|
|
237
|
+
key: "__receiveMessageFromWSPlayer",
|
|
238
|
+
value: function __receiveMessageFromWSPlayer(method, data) {
|
|
239
|
+
switch (method) {
|
|
240
|
+
// ------------- 公共事件 ---------------------
|
|
241
|
+
case 'selectWindowChanged':
|
|
242
|
+
// 选中的窗口发生改变
|
|
243
|
+
this.currentChannelId = data.channelId;
|
|
244
|
+
this.playIndex = data.playIndex;
|
|
245
|
+
break;
|
|
246
|
+
|
|
247
|
+
case 'windowNumChanged':
|
|
248
|
+
// 播放器显示的路数发生改变
|
|
249
|
+
this.playNum = data;
|
|
250
|
+
break;
|
|
251
|
+
|
|
252
|
+
case 'closeVideo':
|
|
253
|
+
// 视频关闭
|
|
254
|
+
// 点击关闭按钮引发的视频关闭进行提示
|
|
255
|
+
// 切换视频引发的视频关闭不进行提示
|
|
256
|
+
if (!data.changeVideoFlag) {
|
|
257
|
+
console.log("\u7A97\u53E3".concat(data.selectIndex, "\u7684\u89C6\u9891\u5DF2\u5173\u95ED"));
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
break;
|
|
261
|
+
|
|
262
|
+
case 'statusChanged':
|
|
263
|
+
// 视频状态发生改变
|
|
264
|
+
break;
|
|
265
|
+
|
|
266
|
+
case 'errorInfo':
|
|
267
|
+
// 错误信息提示
|
|
268
|
+
// data = {
|
|
269
|
+
// errorCode: xxx,
|
|
270
|
+
// errorMsg: "",
|
|
271
|
+
// channelList: [],
|
|
272
|
+
// }
|
|
273
|
+
break;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}]);
|
|
277
|
+
|
|
278
|
+
return PlayerManager;
|
|
279
|
+
}();
|
|
280
|
+
|
|
281
|
+
var _default = PlayerManager;
|
|
282
|
+
exports["default"] = _default;
|
|
283
|
+
//# sourceMappingURL=PlayerManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlayerManager.js","names":["PlayerManager","opt","el","url","realPlayer","recordPlayer","player","type","playNum","playIndex","dp","console","log","window","ConfirmConn","srcType","getRecordList","viewSize","winDom","find","each","i","obj","_obj","$","css","width","height","index","that","toggleVideo","speed","playSpeed","reSetVideo","ttxplayer","destroy","setSize","fullScreen","playerAdapter","setPlayerAdapter","number","setPlayerNum","setSelectIndex","time","seekVideo","method","data","currentChannelId","channelId","changeVideoFlag","selectIndex"],"sources":["new/PlayerManager.js"],"sourcesContent":["class PlayerManager {\n constructor(opt) {\n // 播放器所在的容器ID\n this.el = opt.el;\n this.url = opt.url;\n // 实时预览播放器\n this.realPlayer = null;\n // 录像回放播放器\n this.recordPlayer = null;\n this.player = null;\n // 实时预览还是录像回放播放器\n this.type = opt.type;\n // 窗口的数量\n this.playNum = 1;\n // 当前选中的窗口的索引\n this.playIndex = 0;\n this.dp = null;\n // this.initPlayer();\n }\n //初始化视频插件\n initPlayer() {\n // var param = {\n // simNum: 40357902315,\n // channelId: 0,\n // totalChannel: 1,\n // chanelNumInfo: '1,通道1|2,通道2',\n // avDataType: 0,\n // bitStreamType: 1,\n // playerId: this.el,\n // };\n // var _srvVideoUrl = location.origin + '/TopJtbVideo/VideoCmd/';\n // API.postData(_srvVideoUrl + 'RealTimeAVTransRequest', param, callback, error);\n }\n /**\n * 播放实时预览视频\n * @param opt.streamType: {Number|String} 选填,码流类型,不填默认播放辅码流1,若不存在辅码流1,则自动切换到主码流 1-主码流 2-辅码流1 3-辅码流2\n * @param opt.selectIndex: {Number} 选填,指定从哪个窗口开始播放。不填默认从选中的窗口开始播放\n */\n playRealVideo() {\n console.log(window);\n window.ConfirmConn(this.el, 40357902315, 0, '47.99.88.129', '18020', 1, { srcType: 'ws-flv' });\n }\n /**\n * 播放录像回放\n * @param opt.channelList {Array<Object>} 通道集合 必填\n * @param opt.startTime {String|Number} 开始时间 必选 timestamp到秒\n * @param opt.endTime {String|Number} 结束时间 必选 timestamp到秒\n * @param opt.recordSource {String|Number} 录像来源 必选 2表示设备录像 3表示中心录像\n * @param opt.streamType {String|Number} 码流类型 可选\n * @param opt.recordType {String|Number} 录像类型 可选\n */\n // channelList: [{\n // id: channelCode, // {String} 通道编码 -- 用于回放,必填\n // }]\n playRecordVideo(opt) {\n this.recordPlayer && this.recordPlayer.getRecordList(opt);\n }\n setVideoFrame(viewSize) {\n this.winDom.find('video').each(function (i, obj) {\n var _obj = $(obj);\n _obj.css('width', '100%').css('height', '100%');\n var width = _obj.width();\n var height = _obj.height();\n if (viewSize === '4:3') {\n if (width / height > 4 / 3) {\n _obj.css('width', (height * 4) / 3);\n }\n else {\n _obj.css('height', (width * 3) / 4);\n }\n }\n if (viewSize === '16:9') {\n if (width / height > 16 / 9) {\n _obj.css('width', (height * 16) / 9);\n }\n else {\n _obj.css('height', (width * 9) / 16);\n }\n }\n });\n }\n stopVideo(index) {\n var that = this;\n if (index >= this.playNum) {\n return;\n }\n // this.reSetVideo(index)\n // var video = this.playVideos[index];\n // if (video) {\n // if (that.options.isTtx) {\n // video.ttxplayer.stop();\n // video.ttxplayer.setPlayTime(0);\n // } else {\n // video.pause();\n // video.video.currentTime = 0;\n // }\n // try {\n // var url = video.options.video.url;\n // var devidno = url.split('DevIDNO=')[1].split('&')[0];\n // that.timeMap808[devidno] = new Date().getTime();\n // } catch (e) {}\n // }\n }\n /**\n * 录像暂停\n * 只有正在播放的录像调用才有效\n */\n pause() {\n this.player && this.player.toggleVideo(0);\n }\n /**\n * 录像暂停后播放\n * 只有暂停后的录像调用才有效\n */\n play() {\n this.player && this.player.toggleVideo(0);\n }\n /**\n * 倍速播放\n * @param {number} speed 速率 0.125 0.25 0.5 1 2 4 8 共7种速率\n */\n playSpeed(speed) {\n this.recordPlayer && this.recordPlayer.playSpeed(speed);\n }\n /**\n * 关闭播放器\n * @param {number} index 可选,关闭指定索引的窗口的播放器,不传则表示关闭所有播放器\n */\n close(index) {\n this.player && this.player.reSetVideo(index);\n if (this.dp) {\n this.dp.ttxplayer.destroy();\n this.dp.destroy();\n }\n }\n resize() {\n this.player && this.player.setSize();\n }\n /**\n * 设置全屏\n */\n setFullScreen() {\n this.player.fullScreen();\n }\n /**\n * 设置窗口自适应还是拉伸\n * @param {string} playerAdapter selfAdaption 自适应 | stretching 拉伸\n */\n setPlayerAdapter(playerAdapter) {\n this.player.setPlayerAdapter(playerAdapter);\n }\n /**\n * 控制视频播放器显示的路数: 1 4 9 16 25,不会超过最大显示路数\n * @param {number} number\n */\n setPlayerNum(number) {\n this.player.setPlayerNum(number);\n }\n /**\n * 设置选中的播放器的索引\n * @param {number} index\n */\n setSelectIndex(index) {\n this.player.setSelectIndex(index);\n }\n /**\n * 录像跳转播放\n * @param {number} time HH:mm:ss格式\n */\n jumpPlayByTime(time) {\n this.player.seekVideo(0, time);\n }\n // ----------------- 播放器事件 ------------------------\n __receiveMessageFromWSPlayer(method, data) {\n switch (method) {\n // ------------- 公共事件 ---------------------\n case 'selectWindowChanged': // 选中的窗口发生改变\n this.currentChannelId = data.channelId;\n this.playIndex = data.playIndex;\n break;\n case 'windowNumChanged': // 播放器显示的路数发生改变\n this.playNum = data;\n break;\n case 'closeVideo': // 视频关闭\n // 点击关闭按钮引发的视频关闭进行提示\n // 切换视频引发的视频关闭不进行提示\n if (!data.changeVideoFlag) {\n console.log(`窗口${data.selectIndex}的视频已关闭`);\n }\n break;\n case 'statusChanged': // 视频状态发生改变\n break;\n case 'errorInfo': // 错误信息提示\n // data = {\n // errorCode: xxx,\n // errorMsg: \"\",\n // channelList: [],\n // }\n break;\n }\n }\n}\nexport default PlayerManager;\n"],"mappings":";;;;;;;;;;;;;IAAMA,a;EACF,uBAAYC,GAAZ,EAAiB;IAAA;;IACb;IACA,KAAKC,EAAL,GAAUD,GAAG,CAACC,EAAd;IACA,KAAKC,GAAL,GAAWF,GAAG,CAACE,GAAf,CAHa,CAIb;;IACA,KAAKC,UAAL,GAAkB,IAAlB,CALa,CAMb;;IACA,KAAKC,YAAL,GAAoB,IAApB;IACA,KAAKC,MAAL,GAAc,IAAd,CARa,CASb;;IACA,KAAKC,IAAL,GAAYN,GAAG,CAACM,IAAhB,CAVa,CAWb;;IACA,KAAKC,OAAL,GAAe,CAAf,CAZa,CAab;;IACA,KAAKC,SAAL,GAAiB,CAAjB;IACA,KAAKC,EAAL,GAAU,IAAV,CAfa,CAgBb;EACH,C,CACD;;;;;WACA,sBAAa,CACT;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;IACH;IACD;AACJ;AACA;AACA;AACA;;;;WACI,yBAAgB;MACZC,OAAO,CAACC,GAAR,CAAYC,MAAZ;MACAA,MAAM,CAACC,WAAP,CAAmB,KAAKZ,EAAxB,EAA4B,WAA5B,EAAyC,CAAzC,EAA4C,cAA5C,EAA4D,OAA5D,EAAqE,CAArE,EAAwE;QAAEa,OAAO,EAAE;MAAX,CAAxE;IACH;IACD;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACI;IACA;IACA;;;;WACA,yBAAgBd,GAAhB,EAAqB;MACjB,KAAKI,YAAL,IAAqB,KAAKA,YAAL,CAAkBW,aAAlB,CAAgCf,GAAhC,CAArB;IACH;;;WACD,uBAAcgB,QAAd,EAAwB;MACpB,KAAKC,MAAL,CAAYC,IAAZ,CAAiB,OAAjB,EAA0BC,IAA1B,CAA+B,UAAUC,CAAV,EAAaC,GAAb,EAAkB;QAC7C,IAAIC,IAAI,GAAGC,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AAyB;UACrB,KAAKD,OAAL,GAAesC,IAAf;UACA;;QACJ,KAAK,YAAL;UAAmB;UACf;UACA;UACA,IAAI,CAACA,IAAI,CAACG,eAAV,EAA2B;YACvBtC,OAAO,CAACC,GAAR,uBAAiBkC,IAAI,CAACI,WAAtB;UACH;;UACD;;QACJ,KAAK,eAAL;UAAsB;UAClB;;QACJ,KAAK,WAAL;UAAkB;UACd;UACA;UACA;UACA;UACA;UACA;MAxBR;IA0BH;;;;;;eAEUlD,a"}
|
package/lib/new/api.d.ts
ADDED
package/lib/new/api.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
// 跟平台相关的业务JS
|
|
8
|
+
var API = {
|
|
9
|
+
postData: function postData(url, param, _success, _error, isAsync) {
|
|
10
|
+
if (isAsync == undefined) isAsync = true;
|
|
11
|
+
$.ajax({
|
|
12
|
+
url: url,
|
|
13
|
+
type: 'post',
|
|
14
|
+
data: param,
|
|
15
|
+
async: isAsync,
|
|
16
|
+
dataType: 'json',
|
|
17
|
+
success: function success(data) {
|
|
18
|
+
if (_success != null && typeof _success == 'function') {
|
|
19
|
+
_success(data);
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
error: function error(e) {
|
|
23
|
+
if (_error != null && typeof _error == 'function') {
|
|
24
|
+
_error(e.responseText);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
var _default = API;
|
|
31
|
+
exports["default"] = _default;
|
|
32
|
+
//# sourceMappingURL=api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","names":["API","postData","url","param","success","error","isAsync","undefined","$","ajax","type","data","async","dataType","e","responseText"],"sources":["new/api.js"],"sourcesContent":["// 跟平台相关的业务JS\nconst API = {\n postData(url, param, success, error, isAsync) {\n if (isAsync == undefined)\n isAsync = true;\n $.ajax({\n url: url,\n type: 'post',\n data: param,\n async: isAsync,\n dataType: 'json',\n success: function (data) {\n if (success != null && typeof success == 'function') {\n success(data);\n }\n },\n error: function (e) {\n if (error != null && typeof error == 'function') {\n error(e.responseText);\n }\n },\n });\n },\n};\nexport default API;\n"],"mappings":";;;;;;AAAA;AACA,IAAMA,GAAG,GAAG;EACRC,QADQ,oBACCC,GADD,EACMC,KADN,EACaC,QADb,EACsBC,MADtB,EAC6BC,OAD7B,EACsC;IAC1C,IAAIA,OAAO,IAAIC,SAAf,EACID,OAAO,GAAG,IAAV;IACJE,CAAC,CAACC,IAAF,CAAO;MACHP,GAAG,EAAEA,GADF;MAEHQ,IAAI,EAAE,MAFH;MAGHC,IAAI,EAAER,KAHH;MAIHS,KAAK,EAAEN,OAJJ;MAKHO,QAAQ,EAAE,MALP;MAMHT,OAAO,EAAE,iBAAUO,IAAV,EAAgB;QACrB,IAAIP,QAAO,IAAI,IAAX,IAAmB,OAAOA,QAAP,IAAkB,UAAzC,EAAqD;UACjDA,QAAO,CAACO,IAAD,CAAP;QACH;MACJ,CAVE;MAWHN,KAAK,EAAE,eAAUS,CAAV,EAAa;QAChB,IAAIT,MAAK,IAAI,IAAT,IAAiB,OAAOA,MAAP,IAAgB,UAArC,EAAiD;UAC7CA,MAAK,CAACS,CAAC,CAACC,YAAH,CAAL;QACH;MACJ;IAfE,CAAP;EAiBH;AArBO,CAAZ;eAuBef,G"}
|
package/lib/player/index.js
CHANGED
|
@@ -213,10 +213,14 @@ var Player = /*#__PURE__*/function () {
|
|
|
213
213
|
}
|
|
214
214
|
|
|
215
215
|
if (this.type === 'bd') {
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
216
|
+
this.player = new _PlayerManager["default"]({
|
|
217
|
+
el: container.id,
|
|
218
|
+
type: live,
|
|
219
|
+
url: this.url
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
if (this.type === 'mp4') {
|
|
220
224
|
this.player = new _PlayerManager["default"]({
|
|
221
225
|
el: container.id,
|
|
222
226
|
type: live,
|
|
@@ -275,6 +279,12 @@ var Player = /*#__PURE__*/function () {
|
|
|
275
279
|
_player4.playRealVideo();
|
|
276
280
|
}
|
|
277
281
|
|
|
282
|
+
if (this.type === 'mp4') {
|
|
283
|
+
var _player5 = this.player;
|
|
284
|
+
|
|
285
|
+
_player5.playMp4();
|
|
286
|
+
}
|
|
287
|
+
|
|
278
288
|
return Promise.resolve();
|
|
279
289
|
}
|
|
280
290
|
/** 回放 */
|
|
@@ -293,9 +303,9 @@ var Player = /*#__PURE__*/function () {
|
|
|
293
303
|
this.windowIndex = 1;
|
|
294
304
|
return result;
|
|
295
305
|
} else if (this.type === 'icc_ws') {
|
|
296
|
-
var
|
|
306
|
+
var _player6 = this.player;
|
|
297
307
|
return new Promise(function (resolve) {
|
|
298
|
-
|
|
308
|
+
_player6.playRecordVideo({
|
|
299
309
|
channelList: [{
|
|
300
310
|
id: _this.deviceCode + '$1$0$' + _this.channelNum
|
|
301
311
|
}],
|
|
@@ -324,27 +334,27 @@ var Player = /*#__PURE__*/function () {
|
|
|
324
334
|
}
|
|
325
335
|
|
|
326
336
|
if (this.type === 'hls') {
|
|
327
|
-
var
|
|
337
|
+
var _player7 = this.player;
|
|
328
338
|
|
|
329
|
-
|
|
339
|
+
_player7.destroy();
|
|
330
340
|
|
|
331
341
|
this.player = null;
|
|
332
342
|
this.video.remove();
|
|
333
343
|
}
|
|
334
344
|
|
|
335
345
|
if (this.type === 'hk_ws') {
|
|
336
|
-
var
|
|
346
|
+
var _player8 = this.player;
|
|
337
347
|
|
|
338
|
-
|
|
348
|
+
_player8.JS_Stop(1);
|
|
339
349
|
|
|
340
350
|
var dd = document.getElementById(this.containerId);
|
|
341
351
|
dd && dd.childNodes && dd.childNodes[0] && dd.removeChild(dd.childNodes[0]);
|
|
342
352
|
}
|
|
343
353
|
|
|
344
354
|
if (this.type === 'hkcar_ws') {
|
|
345
|
-
var
|
|
355
|
+
var _player9 = this.player;
|
|
346
356
|
|
|
347
|
-
|
|
357
|
+
_player9.JS_DestroyWorker();
|
|
348
358
|
|
|
349
359
|
var _dd3 = document.getElementById(this.containerId);
|
|
350
360
|
|
|
@@ -352,27 +362,33 @@ var Player = /*#__PURE__*/function () {
|
|
|
352
362
|
}
|
|
353
363
|
|
|
354
364
|
if (this.type === 'icc_ws') {
|
|
355
|
-
var
|
|
365
|
+
var _player10 = this.player;
|
|
356
366
|
|
|
357
|
-
|
|
367
|
+
_player10.close();
|
|
358
368
|
}
|
|
359
369
|
|
|
360
370
|
if (this.type === 'webrtc') {
|
|
361
|
-
var
|
|
371
|
+
var _player11 = this.player;
|
|
362
372
|
|
|
363
|
-
|
|
373
|
+
_player11.close();
|
|
364
374
|
}
|
|
365
375
|
|
|
366
376
|
if (this.type === 'h264') {
|
|
367
|
-
var
|
|
377
|
+
var _player12 = this.player;
|
|
368
378
|
|
|
369
|
-
|
|
379
|
+
_player12.close();
|
|
370
380
|
}
|
|
371
381
|
|
|
372
382
|
if (this.type === 'bd') {
|
|
373
|
-
var
|
|
383
|
+
var _player13 = this.player;
|
|
384
|
+
|
|
385
|
+
_player13.close(0);
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
if (this.type === 'mp4') {
|
|
389
|
+
var _player14 = this.player;
|
|
374
390
|
|
|
375
|
-
|
|
391
|
+
_player14.close(0);
|
|
376
392
|
}
|
|
377
393
|
}
|
|
378
394
|
/** 截图 */
|
|
@@ -417,9 +433,9 @@ var Player = /*#__PURE__*/function () {
|
|
|
417
433
|
player.JS_Resize();
|
|
418
434
|
}, 500);
|
|
419
435
|
} else if (this.type === 'icc_ws') {
|
|
420
|
-
var
|
|
436
|
+
var _player15 = this.player;
|
|
421
437
|
|
|
422
|
-
|
|
438
|
+
_player15.setPlayerAdapter('selfAdaption');
|
|
423
439
|
}
|
|
424
440
|
}
|
|
425
441
|
/**
|
|
@@ -440,20 +456,20 @@ var Player = /*#__PURE__*/function () {
|
|
|
440
456
|
}
|
|
441
457
|
|
|
442
458
|
if (this.type === 'hk_ws' || this.type === 'hkcar_ws') {
|
|
443
|
-
var
|
|
459
|
+
var _player16 = this.player;
|
|
444
460
|
|
|
445
|
-
if (
|
|
446
|
-
|
|
461
|
+
if (_player16.iCurrentSoundWnd !== this.windowIndex) {
|
|
462
|
+
_player16.JS_OpenSound(this.windowIndex);
|
|
447
463
|
}
|
|
448
464
|
|
|
449
|
-
|
|
465
|
+
_player16.JS_SetVolume(this.windowIndex, value);
|
|
450
466
|
}
|
|
451
467
|
|
|
452
468
|
if (this.type === 'bd') {
|
|
453
|
-
var
|
|
454
|
-
if (!
|
|
469
|
+
var _player17 = this.player.dp;
|
|
470
|
+
if (!_player17.ttxplayer.enableAudio) _player17.ttxplayer.openAudio();
|
|
455
471
|
|
|
456
|
-
|
|
472
|
+
_player17.ttxplayer.setVolume(value);
|
|
457
473
|
}
|
|
458
474
|
}
|
|
459
475
|
/**
|
|
@@ -525,9 +541,9 @@ var Player = /*#__PURE__*/function () {
|
|
|
525
541
|
|
|
526
542
|
this.preSpeed = speed;
|
|
527
543
|
} else if (this.type === 'icc_ws') {
|
|
528
|
-
var
|
|
544
|
+
var _player18 = this.player;
|
|
529
545
|
|
|
530
|
-
|
|
546
|
+
_player18.playSpeed(speed);
|
|
531
547
|
} else if (this.type === 'bd') {// todo
|
|
532
548
|
} else {
|
|
533
549
|
this.video.playbackRate = speed;
|
|
@@ -570,7 +586,7 @@ var Player = /*#__PURE__*/function () {
|
|
|
570
586
|
var _a, _b, _c;
|
|
571
587
|
|
|
572
588
|
return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
573
|
-
var player, seekTime,
|
|
589
|
+
var player, seekTime, _player19, _seekTime, _player20, _seekTime2;
|
|
574
590
|
|
|
575
591
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
576
592
|
while (1) {
|
|
@@ -593,15 +609,15 @@ var Player = /*#__PURE__*/function () {
|
|
|
593
609
|
|
|
594
610
|
case 8:
|
|
595
611
|
if (this.type === 'icc_ws') {
|
|
596
|
-
|
|
612
|
+
_player19 = this.player;
|
|
597
613
|
_seekTime = (_b = (0, _moment["default"])(this.startTime)) === null || _b === void 0 ? void 0 : _b.add(time, 'seconds').format('HH:mm:ss');
|
|
598
614
|
|
|
599
|
-
|
|
615
|
+
_player19.jumpPlayByTime(_seekTime);
|
|
600
616
|
} else if (this.type === 'bd') {
|
|
601
|
-
|
|
617
|
+
_player20 = this.player;
|
|
602
618
|
_seekTime2 = (_c = (0, _moment["default"])(this.startTime)) === null || _c === void 0 ? void 0 : _c.add(time, 'seconds').valueOf();
|
|
603
619
|
|
|
604
|
-
|
|
620
|
+
_player20.jumpPlayByTime(_seekTime2);
|
|
605
621
|
} else {
|
|
606
622
|
this.video.currentTime = time;
|
|
607
623
|
}
|
|
@@ -631,9 +647,9 @@ var Player = /*#__PURE__*/function () {
|
|
|
631
647
|
return callback && callback();
|
|
632
648
|
});
|
|
633
649
|
} else if (this.type === 'bd') {
|
|
634
|
-
var
|
|
650
|
+
var _player21 = this.player;
|
|
635
651
|
|
|
636
|
-
|
|
652
|
+
_player21.pause();
|
|
637
653
|
} else {
|
|
638
654
|
this.video.pause();
|
|
639
655
|
callback && callback();
|
|
@@ -653,9 +669,9 @@ var Player = /*#__PURE__*/function () {
|
|
|
653
669
|
return callback && callback();
|
|
654
670
|
});
|
|
655
671
|
} else if (this.type === 'bd') {
|
|
656
|
-
var
|
|
672
|
+
var _player22 = this.player;
|
|
657
673
|
|
|
658
|
-
|
|
674
|
+
_player22.close(0);
|
|
659
675
|
} else {
|
|
660
676
|
this.video.play();
|
|
661
677
|
callback && callback();
|