Browse Source

解决当前用户视频展示不了的问题 当前用户取的是手机号码 im成员列表返回的是id 导致不匹配

lincl 5 years ago
parent
commit
3c49480406
1 changed files with 18 additions and 5 deletions
  1. 18 5
      src/components/videoChat/video-chat.vue

+ 18 - 5
src/components/videoChat/video-chat.vue

@ -5,7 +5,7 @@
        </div>
        <div class="main-content clearfix">
            <div class="main-chat fl">
                <video v-if="userId" :id="'video_'+ userId" autoplay="" :poster="getPhoto(docInfo)"></video>
                <!-- <video v-if="userId" :id="'video_'+ userId" autoplay="" :poster="getPhoto(docInfo)"></video> -->
            </div>
            <div class="member-panel fl">
                <div class="c-fff c-f14 plr15 pt10">参与人员:</div>
@ -176,8 +176,9 @@ export default {
    data(){
        return {
            docInfo:{},
            uderId: '',
            userId: '',
            userName: '',
            userCode: '',
            ws: '',
            participants: {},
            mainVideo: '',
@ -216,6 +217,7 @@ export default {
            this.getMembers();
        }else{
            this.chatMembers1 = this.chatMembers
            this.getUserCode()
        }
        
        window.onbeforeunload = function() {
@ -241,6 +243,16 @@ export default {
        }
    },
    methods:{
        getUserCode(){
            var o
            for(var i=0; i<this.chatMembers1.length; i++){
                o = this.chatMembers1[i]
                if(o.mobile==this.userId){
                    this.userCode = o.code || o.id
                    this.mainVideo = this.userCode;
                }
            }
        },
        async getMembers(){
            let rs = await imApi.Sessions.getParticipants(this.sessionId)
            this.chatMembers1 = _.map(rs.data, function(o){
@ -249,6 +261,7 @@ export default {
                }
                return o;
            })
            this.getUserCode()
            // console.log(this.chatMembers1);
        },
        async createNewChat(){
@ -350,7 +363,7 @@ export default {
        register(){
            var message = {
                id : 'joinRoom',
                userId : this.userId,
                userId : this.userCode,
                roomId : this.sessionId,
            }
            console.log(this.ws.readyState);
@ -415,8 +428,8 @@ export default {
                    }
                }
            };
            var participant1 = new this.participant(this.userId, this);
            this.participants[this.userId] = participant1;
            var participant1 = new this.participant(this.userCode, this);
            this.participants[this.userCode] = participant1;
            var video = participant1.getVideoElement();
            var iceServer = this.iceservers;
            var options = {