ucservice 1.0.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/package.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "ucservice",
3
+ "private": false,
4
+ "version": "1.0.0",
5
+ "description": "统一通信服务",
6
+ "main": "index.js",
7
+ "scripts": {
8
+ "serve": "vue-cli-service serve",
9
+ "build": "vue-cli-service build",
10
+ "lint": "vue-cli-service lint",
11
+ "lib": "vue-cli-service build --target lib --name ucservice ./index.js"
12
+ },
13
+ "devDependencies": {
14
+ "@vue/cli-plugin-babel": "~4.5.0",
15
+ "@vue/cli-service": "~4.5.0",
16
+ "babel-eslint": "^10.1.0",
17
+ "compression-webpack-plugin": "^5.0.2",
18
+ "css-loader": "^6.5.1",
19
+ "eslint": "^6.7.2",
20
+ "eslint-plugin-prettier": "^3.3.1",
21
+ "node-sass": "^6.0.1",
22
+ "nprogress": "^0.2.0",
23
+ "prettier": "^1.19.1",
24
+ "sass": "^1.32.8",
25
+ "sass-loader": "^10.1.0"
26
+ },
27
+ "keywords": [
28
+ "janus",
29
+ "comted"
30
+ ],
31
+ "author": "shusg",
32
+ "license": "MIT",
33
+ "dependencies": {
34
+ "jquery": "^3.6.0",
35
+ "webrtc-adapter": "^8.1.1"
36
+ }
37
+ }
@@ -0,0 +1,147 @@
1
+ let cometd = require('./lib/cometd.js');
2
+ import { server, cometd_server } from '@/config';
3
+ let Video = require('./scooper.video');
4
+ let $ = require('jquery');
5
+ /**
6
+ * 接口请求通用方法
7
+ * @param {*} url
8
+ * @param {*} param
9
+ * @param {*} backSuccfn
10
+ * @param {*} async
11
+ * @param {*} method
12
+ */
13
+ export const loadJson = function(url, param, backSuccfn, async, method, headers) {
14
+ method = (method? method:'POST');
15
+ async = (async == undefined? true:async);
16
+ let ajaxContent = {
17
+ 'method': method,
18
+ 'url': server + url,
19
+ 'data': param,
20
+ 'async' : async
21
+ }
22
+ if(headers) Object.assign(ajaxContent, headers);
23
+ $.ajax(ajaxContent).fail(function(jqXHR,sts){
24
+ console.error('加载数据失败:' + sts + ", " + url);
25
+ }).done(function(ret){
26
+ if (!ret || ret.code != 0) {
27
+ console.error('加载数据失败:' + JSON.stringify(ret) + ", " + url);
28
+ }
29
+ if (backSuccfn) backSuccfn(ret);
30
+ });
31
+ }
32
+
33
+ /**
34
+ *
35
+ * @param {*} meetcallfunc 会议通知处理
36
+ * @param {*} callfunc 呼叫通知处理
37
+ * @param {*} videocallfunc 视频通知处理
38
+ * @param {*} connectcallfunc 通讯录通知处理
39
+ */
40
+ export const initCometd = function(meetcallfunc, callfunc, videocallfunc, connectcallfunc){ //初始
41
+ let _cometd = new cometd.CometD("xjInfoReport");
42
+ _cometd.websocketEnabled = true;
43
+ let cometdUrl = server + cometd_server;
44
+ _cometd.init({
45
+ url: cometdUrl,
46
+ logLevel: "info"
47
+ });
48
+
49
+ _cometd.addListener("/meta/handshake", function(message) {
50
+ if (message.successful) {
51
+ console.log("handshake success.");
52
+ }
53
+ });
54
+
55
+ let _connected = false;
56
+ _cometd.addListener('/meta/connect', function(message) {
57
+ if (message.successful) {
58
+ if (!_connected) {
59
+ doSubscribe(_cometd, {meetcallfunc, callfunc, videocallfunc, connectcallfunc});
60
+ }
61
+ _connected = true;
62
+ } else {
63
+ _connected = false;
64
+ console.log("连接cometd后台失败");
65
+ }
66
+ });
67
+ }
68
+
69
+ function doSubscribe(_cometd, callback) {
70
+
71
+ /**
72
+ * 会场模块消息通知
73
+ */
74
+ if(callback.meetcallfunc){
75
+ _cometd.subscribe("/dispatch-web/notify/meet/#", null, function(message) {
76
+ callback.meetcallfunc(message);
77
+ });
78
+ }
79
+
80
+ /**
81
+ * 呼叫模块消息通知
82
+ */
83
+ if(callback.callfunc){
84
+ _cometd.subscribe("/dispatch-web/notify/call/#", null, function(message) {
85
+ callback.callfunc(message);
86
+ });
87
+ }
88
+
89
+ /**
90
+ * 视频通话状态消息通知(视频通话建立 和 中断)
91
+ */
92
+ if(callback.videocallfunc){
93
+ _cometd.subscribe("/server/#", null, function(message) {
94
+ callback.videocallfunc(message);
95
+ });
96
+ }
97
+
98
+ //'#':多级通配,订阅所有的主题
99
+ if(callback.connectcallfunc){
100
+ _cometd.subscribe("/scooper_core/#", null, function(message) {
101
+ callback.connectcallfunc(message);
102
+ });
103
+ }
104
+ }
105
+
106
+ /**
107
+ * 初始化视频获取视频对象
108
+ * @param {*} token
109
+ * @param {*} videoArea //展示视频的容器模块
110
+ * 使用该方法前提是videoArea等相关dom节点必须已加载完毕
111
+ */
112
+ export const initVideo = function(token, videoArea){ //读取视频服务配置初始化视频
113
+ return new Promise((resolve, reject) =>{
114
+ let url = server + '/scooper-video/conf/data';
115
+ var param = {};
116
+ $.getJSON(url,param,function (conf) {
117
+ // 初始化视频播放方式
118
+ // initplaVideoType();
119
+ let janusUrl = conf['video.janus.url'];
120
+ var videoOpts = {
121
+ //初始化时的界面显示的分屏树
122
+ windows: 4,
123
+ //共有哪几种分屏
124
+ windowsArr: [1, 4, 9, 16],
125
+ //总的窗口数
126
+ windowsNum: 16,
127
+ conf: {
128
+ user: conf['video.username'],
129
+ passwd: conf['video.password'],
130
+ ip: conf['video.ip'],
131
+ port: conf['video.port'],
132
+ janusUrl: conf['video.janus.url'],
133
+ token: token
134
+ },
135
+ extra: false,
136
+ streamType: conf['video.stream'],
137
+ openChangeWindowStrategy: conf['video.openChangeWindowStrategy'] === 'true',
138
+ capImage: conf['video.cap.image'] === 'true',
139
+ videoCapImagePath: conf['video.cap.image.path'],
140
+ videoInfoInBottom: false
141
+ };
142
+ conf['video.poll.time'] && (videoOpts.pollInterval = conf['video.poll.time']);
143
+ let videoController = new Video($(videoArea), videoOpts);
144
+ resolve(videoController);
145
+ })
146
+ })
147
+ }
package/src/config.js ADDED
@@ -0,0 +1,13 @@
1
+ import '@/net_url/account_net_url'; //账号
2
+ import '@/net_url/aduio_net_url'; //音频
3
+ import '@/net_url/aduio_video_net_url'; //音频、视频公共接口
4
+ import '@/net_url/dept_ry_url'; //部门成员
5
+ import '@/net_url/dept_url'; //部门
6
+ import '@/net_url/location_url'; //定位
7
+ import '@/net_url/meet_url'; //会议
8
+ import '@/net_url/message_url'; //短信
9
+ import '@/net_url/record_url'; //录音录像
10
+ import '@/net_url/video_net_url'; //视频
11
+
12
+ export const server = 'http://10.249.4.152:8080'; //服务地址
13
+ export const cometd_server = '/scooper-msg-queue/cometd'; //
@@ -0,0 +1,209 @@
1
+ @charset "UTF-8";
2
+ html, body{
3
+ padding:0;
4
+ margin:0;
5
+ height:100%;
6
+ width:100%;
7
+ overflow: hidden;
8
+ }
9
+
10
+ .video-main{
11
+ position: absolute;
12
+ top: 0px;
13
+ left: -25px;
14
+ right: -12px;
15
+ bottom: -18px;
16
+ }
17
+ .video-main-full{
18
+ position: absolute;
19
+ top: 1px;
20
+ left: 1px;
21
+ right: 1px;
22
+ bottom: 1px;
23
+ /*border:1px solid #999;*/
24
+ }
25
+ .video-main>li, .video-main-full>li{
26
+ border: 1px solid #aaa;
27
+ float: left;
28
+ position: relative;
29
+ }
30
+ .video-main>li.loading, .video-main-full>li.loading{
31
+ background: #000;
32
+ }
33
+ .video-main>li:hover, .video-main-full>li:hover{
34
+ border: 1px solid #ffb951;
35
+ }
36
+ .video-main>li.sel, .video-main-full>li.sel{
37
+ border: 1px solid #ef8601;
38
+ }
39
+ .video-main.mode-1>li, .video-main-full.mode-1>li{
40
+ width: 98.5%;
41
+ height: 98.5%;
42
+ list-style: none;
43
+ }
44
+ .video-main.mode-1>li .info, .video-main-full.mode-1>li .info{
45
+ font-size:20px;
46
+ bottom: 40px;
47
+ }
48
+ .video-main.mode-4>li{
49
+ width: 49%;
50
+ height: 49%;
51
+ list-style: none;
52
+ }
53
+ .video-main.mode-4>li .info{
54
+ font-size:18px;
55
+ bottom: 20px;
56
+ }
57
+ .video-main.mode-6>li{
58
+ width: 33.33%;
59
+ height: 33.33%;
60
+ }
61
+ .video-main.mode-6>li .info{
62
+ font-size:14px;
63
+ bottom: 13px;
64
+ }
65
+ .video-main.mode-6 .screen-1{
66
+ width: 66.66%;
67
+ height: 66.65%;
68
+ }
69
+ .video-main.mode-6 .screen-1 .info{
70
+ font-size:18px;
71
+ bottom: 30px;
72
+ }
73
+ .video-main.mode-9>li{
74
+ width: 32.5%;
75
+ height: 32.5%;
76
+ list-style: none;
77
+ }
78
+ .video-main.mode-9>li .info{
79
+ font-size:12px;
80
+ bottom: 14px;
81
+ }
82
+ .video-main.mode-16>li{
83
+ width: 24.5%;
84
+ height: 24.5%;
85
+ list-style: none;
86
+ }
87
+ .video-main.mode-16>li .info{
88
+ font-size:8px;
89
+ bottom: 10px;
90
+ }
91
+ .video-box{
92
+ object-fit: fill;
93
+ display:none;
94
+ width: 100%;
95
+ height: 100%;
96
+ }
97
+ .stream-loading{
98
+ width: 200px;
99
+ height: 30px;
100
+ line-height: 30px;
101
+ position: absolute;
102
+ top: 50%;
103
+ left: 50%;
104
+ margin-top: -15px;
105
+ margin-left: -100px;
106
+ color: #fff;
107
+ font-size: 16px;
108
+ padding-left: 30px;
109
+ /* background: transparent url(../../js/lib/zTree/img/loading.gif) no-repeat 10px center; */
110
+ }
111
+ .info{
112
+ position: absolute;
113
+ float: left;
114
+ color: #fff;
115
+ left: 10px;
116
+ width: 67%;
117
+ /* bottom: 10px;
118
+ width: 320px;
119
+ height: 30px;
120
+ text-align: center; */
121
+ z-index:1;
122
+ }
123
+
124
+ .operate-btn{
125
+ position: absolute;
126
+ width: 24px;
127
+ height: 24x;
128
+ float: left;
129
+ right: 1px;
130
+ bottom: 2px;
131
+ z-index:1;
132
+ cursor: pointer;
133
+ }
134
+
135
+ .send-audio-btn {
136
+ position: absolute;
137
+ bottom: -8px;
138
+ right: 70px;
139
+ border: 0;
140
+ width: 48px;
141
+ height: 48px;
142
+ float: left;
143
+ /* background:url(../../image/video/audio/yy.png); */
144
+ background-size: 100% 100%;
145
+ background-color: rgba(0,0,0,0);
146
+ }
147
+
148
+ .unsend-audio-btn {
149
+ position: absolute;
150
+ bottom: -8px;
151
+ right: 70px;
152
+ border: 0;
153
+ width: 48px;
154
+ height: 48px;
155
+ float: left;
156
+ /* background-image: url(../../image/video/audio/yy_gb.png); */
157
+ background-size: 100% 100%;
158
+ background-color: rgba(0,0,0,0);
159
+ }
160
+ .recv-audio-btn {
161
+ position: absolute;
162
+ bottom: -8px;
163
+ right: 30px;
164
+ border: 0;
165
+ width: 48px;
166
+ height: 48px;
167
+ float: left;
168
+ /* background:url(../../image/video/audio/hm_shengyin_sel.png); */
169
+ background-size: 100% 100%;
170
+ background-color: rgba(0,0,0,0);
171
+ }
172
+
173
+ .unrecv-audio-btn {
174
+ position: absolute;
175
+ bottom: -8px;
176
+ right: 30px;
177
+ border: 0;
178
+ width: 48px;
179
+ height: 48px;
180
+ float: left;
181
+ /* background-image: url(../../image/video/audio/hm_jingyin_sel.png); */
182
+ background-size: 100% 100%;
183
+ background-color: rgba(0,0,0,0);
184
+ }
185
+
186
+ .close-btn {
187
+ position: absolute;
188
+ bottom: 5px;
189
+ right: 5px;
190
+ border: 0;
191
+ width: 20px;
192
+ height: 20px;
193
+ float: left;
194
+ /* background-image: url("../img/close.png"); */
195
+ background-size: 100% 100%;
196
+ background-color: rgba(0,0,0,0);
197
+ }
198
+ .operation {
199
+ position: absolute;
200
+ width: 100%;
201
+ height: 12%;
202
+ bottom: 0;
203
+ background: rgba(0,0,0,0.3);
204
+ color: #fff;
205
+ }
206
+
207
+ .hide {
208
+ display: none;
209
+ }