Commit a553b310 by qlintonger xeno

通话数据问题准备修复+6

parent 5dd5a58b
...@@ -20,13 +20,15 @@ export class Agora { ...@@ -20,13 +20,15 @@ export class Agora {
} }
AgoraClient = null AgoraClient = null
localAp = null localAp = null
app = null;
constructor(options) { constructor(options, app) {
this.notUploadLog = options.notUploadLog this.notUploadLog = options.notUploadLog
this.logLevel = options.logLevel this.logLevel = options.logLevel
this.codec = options.codec this.codec = options.codec
this.mode = options.mode this.mode = options.mode
this.appId = options.appId this.appId = options.appId
this.app = app;
this.localPlayerId = options.localPlayerId this.localPlayerId = options.localPlayerId
this.remotePlayerPrefix = options.remotePlayerPrefix this.remotePlayerPrefix = options.remotePlayerPrefix
this.localAp = options.localAp this.localAp = options.localAp
...@@ -224,12 +226,18 @@ export class Agora { ...@@ -224,12 +226,18 @@ export class Agora {
const uidS = user.uid.toString() const uidS = user.uid.toString()
const targetUser = userStates.value.onlineContacts.find(a => a.fromID.toString() === uidS); const targetUser = userStates.value.onlineContacts.find(a => a.fromID.toString() === uidS);
console.log('在线用户加入了频道', targetUser) console.log('在线用户加入了频道', targetUser)
if (typeof this.app.infoCB === 'function') {
this.app.infoCB(`${targetUser.fromName}加入了会议`)
}
targetUser.callState = 'calling' targetUser.callState = 'calling'
}) })
this.AgoraClient.on('user-left', (user) => { this.AgoraClient.on('user-left', (user) => {
const uidS = user.uid.toString() const uidS = user.uid.toString()
const targetUser = userStates.value.onlineContacts.find(a => a.fromID.toString() === uidS); const targetUser = userStates.value.onlineContacts.find(a => a.fromID.toString() === uidS);
console.log('在线用户离开了频道', targetUser) console.log('在线用户离开了频道', targetUser)
if (typeof this.app.infoCB === 'function') {
this.app.infoCB(`${targetUser.fromName}离开了会议`)
}
}) })
this.AgoraClient.on('user-published', (user, mediaType) => { this.AgoraClient.on('user-published', (user, mediaType) => {
console.log('检测到远程用户发布媒体', user, mediaType); console.log('检测到远程用户发布媒体', user, mediaType);
......
...@@ -38,7 +38,7 @@ export class AgoraHandle { ...@@ -38,7 +38,7 @@ export class AgoraHandle {
}) { }) {
this.recordConfig = recordConfig this.recordConfig = recordConfig
this.agoraOptions = options; this.agoraOptions = options;
this.agoraApp = new Agora(options) this.agoraApp = new Agora(options, this.AnyRemote)
await this.agoraApp.preload(); await this.agoraApp.preload();
} }
......
import {WSInt} from "./ws"; import { WSInt } from './ws'
import {AgoraHandle} from "./agoraHandle"; import { AgoraHandle } from './agoraHandle'
import {userStates} from "./states/wsStates"; import { userStates } from './states/wsStates'
export class AnyRemote { export class AnyRemote {
wsInt = null wsInt = null
agora = null agora = null
infoCB = null
warningCB = null
errorCB = null
configureWS(url, tabVisibleCB = () => true, connectionLostCB = () => true, wsSocketChannelName = '') { configureWS(url, tabVisibleCB = () => true, connectionLostCB = () => true, wsSocketChannelName = '') {
this.wsInt = new WSInt(url, this.onMessageGeneral.bind(this), tabVisibleCB, connectionLostCB, wsSocketChannelName) this.wsInt = new WSInt(url, this.onMessageGeneral.bind(this), tabVisibleCB, connectionLostCB, wsSocketChannelName)
this.wsInt.connect() this.wsInt.connect()
} }
setUpNotificationCB(infoCB, warningCB, errorCB) {
this.infoCB = infoCB
this.warningCB = warningCB
this.errorCB = errorCB
}
sendWSFromCall(toID, msgType, msgData, channelID) { sendWSFromCall(toID, msgType, msgData, channelID) {
this.wsInt.send({ this.wsInt.send({
fromID: userStates.value.currentUserId, fromID: userStates.value.currentUserId,
...@@ -44,12 +53,12 @@ export class AnyRemote { ...@@ -44,12 +53,12 @@ export class AnyRemote {
recordStartUrl: 'https://video.anyremote.cn:8081/recorder/v1/start', recordStartUrl: 'https://video.anyremote.cn:8081/recorder/v1/start',
recordStopUrl: 'https://video.anyremote.cn:8081/recorder/v1/stop' recordStopUrl: 'https://video.anyremote.cn:8081/recorder/v1/stop'
}) { }) {
this.agora = new AgoraHandle(this); this.agora = new AgoraHandle(this)
await this.agora.configure(options, recordConfig) await this.agora.configure(options, recordConfig)
} }
onMessageGeneral(data) { onMessageGeneral(data) {
let {msgType} = data let { msgType } = data
if (msgType === 'ForceUpdateOnlineUsers') { if (msgType === 'ForceUpdateOnlineUsers') {
console.log('需要主动拉取在线用户列表', data) console.log('需要主动拉取在线用户列表', data)
this.sendWSFromCall('0', 'GetCompanyUserList') this.sendWSFromCall('0', 'GetCompanyUserList')
...@@ -65,5 +74,5 @@ export class AnyRemote { ...@@ -65,5 +74,5 @@ export class AnyRemote {
} }
export function useAnyR() { export function useAnyR() {
return inject("AnyR") return inject('AnyR')
} }
\ No newline at end of file
...@@ -5,6 +5,13 @@ export default { ...@@ -5,6 +5,13 @@ export default {
install(app, options) { install(app, options) {
const anyRemote = new AnyRemote() const anyRemote = new AnyRemote()
const {wsOpts, agoraConfig, recordConfig, wsOpen} = options const {wsOpts, agoraConfig, recordConfig, wsOpen} = options
if (options.notice) {
anyRemote.setUpNotificationCB(
options.notice.info,
options.notice.warning,
options.notice.error
)
}
watch(() => wsOpen.value, function (value) { watch(() => wsOpen.value, function (value) {
console.log('value here', value) console.log('value here', value)
if (value) { if (value) {
......
...@@ -7,6 +7,7 @@ import { wsShouldOpen } from 'AnyR/states/coreState.js' ...@@ -7,6 +7,7 @@ import { wsShouldOpen } from 'AnyR/states/coreState.js'
import AnyRemotePlugin from 'AnyR/plugin' import AnyRemotePlugin from 'AnyR/plugin'
import { getBrowserDeviceId } from 'AnyR/utils/makeSID' import { getBrowserDeviceId } from 'AnyR/utils/makeSID'
import useStore from '@/store/user/index' import useStore from '@/store/user/index'
import {Message} from '@arco-design/web-vue'
// import directive from './directive'; // import directive from './directive';
...@@ -59,6 +60,11 @@ app.use(AnyRemotePlugin, { ...@@ -59,6 +60,11 @@ app.use(AnyRemotePlugin, {
fileDomain: 'https://video.anyremote.cn:444', fileDomain: 'https://video.anyremote.cn:444',
recordStartUrl: 'https://ifar.test.com:3001/recorder/v1/start', recordStartUrl: 'https://ifar.test.com:3001/recorder/v1/start',
recordStopUrl: 'https://ifar.test.com:3001/recorder/v1/stop' recordStopUrl: 'https://ifar.test.com:3001/recorder/v1/stop'
},
notice: {
info: Message.info,
warning: Message.warning,
error: Message.error
} }
}) })
// app.use(directive); // app.use(directive);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment