|
@@ -22,20 +22,23 @@ export class LiveService {
|
|
|
videoTrack: null,
|
|
|
};
|
|
|
rid?: string; //房间id(channel)
|
|
|
- profile?: Parse.Object;
|
|
|
+ profile?:any = localStorage.getItem('profile');
|
|
|
client: any; //客户端
|
|
|
company: string = '';
|
|
|
UID:any
|
|
|
constructor(private http: HttpService, private aiServ: AiChatService) {
|
|
|
+ this.client?.leave();
|
|
|
this.company = this.aiServ.company;
|
|
|
this.getProfile();
|
|
|
}
|
|
|
async getProfile() {
|
|
|
+ if(this.profile) return
|
|
|
let queryProfile = new Parse.Query('Profile');
|
|
|
queryProfile.equalTo('user', Parse.User.current()?.id);
|
|
|
queryProfile.notEqualTo('isDeleted', true);
|
|
|
queryProfile.equalTo('isCross', true);
|
|
|
- this.profile = await queryProfile.first();
|
|
|
+ let r = await queryProfile.first();
|
|
|
+ this.profile = r?.id
|
|
|
}
|
|
|
/* 初始化Agora */
|
|
|
initAgora() {
|
|
@@ -70,7 +73,7 @@ export class LiveService {
|
|
|
}
|
|
|
async getToken(room: Parse.Object) {
|
|
|
//获取频道token记录
|
|
|
- if (room?.get('profile').id == this.profile?.id) {
|
|
|
+ if (room?.get('profile').id == this.profile) {
|
|
|
this.UID = 111111
|
|
|
let uid = Parse.User.current()?.id;
|
|
|
if (!uid) {
|
|
@@ -79,8 +82,8 @@ export class LiveService {
|
|
|
let baseurl = 'https://server.fmode.cn/api/webrtc/build_token';
|
|
|
let reqBody = {
|
|
|
company: this.company, // this.aiSer.company,
|
|
|
- profile: this.profile?.id,
|
|
|
- channelName: this.profile?.id,
|
|
|
+ profile: this.profile,
|
|
|
+ channelName: this.profile,
|
|
|
};
|
|
|
let data: any = await this.http.httpRequst(baseurl, reqBody, 'POST');
|
|
|
console.log(data);
|