💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
[TOC] ## 视频会议流程 ### 获取token ``` post-uri: https://ip:3004/createToken/ 参数: {"role":"presenter","username":"user","room":""} ``` ### 加入会议室 解析token ``` JSONObject jsonToken = new JSONObject( new String(Base64.decode(token, Base64.DEFAULT))); ``` 解析出来的token是 ``` {"tokenId":"5f253b987171911f9b70dc6e","host":"xxx:8080","secure":true,"signature":"NmRiMGVmOWUxZTZhODIyY2YxYzUwYjkzZjBiMWIyZDBkYTQ1MWFlYTNhZjNlMWFkYjg1NmFjNWU0ZTFhNGJlNQ=="} ``` 初始化 socketio参数,开始连接服务器 ``` socketClient = IO.socket(url, opt); socketClient.connect(); ``` 获取到会议室信息 ``` //通过token加入服务器 conferenceClient.join(token, new ActionCallback<ConferenceInfo>() {} // 发送登录服务器到指令 socketClient.emit("login",....); // 处理服务器返回回来的会议室信息 observer.onRoomConnected((JSONObject) args[1]); public void onRoomConnected(final JSONObject info) {} // 创建会议信息对象 conferenceInfo = new ConferenceInfo(info); // 加入会议室成功 joinCallback.onSuccess(conferenceInfo); // 添加会议室流id信息 remoteStreamIdList.add(remoteStream.id()); remoteStreamMap.put(remoteStream.id(), remoteStream); ``` ### 采集和推流 采集信息 ``` capturer = OwtVideoCapturer.create(vga ? 640 : 1280, vga ? 480 : 720, 30, true, isCameraFront); localStream = new LocalStream(capturer, new MediaConstraints.AudioTrackConstraints()); localStream.attach(localRenderer); ``` 推流关键函数: ``` sendSignalingMessage("publish", publishMsg, args -> {} conferenceClient.publish(localStream, setPublishOptions(), callback); ``` ### 拉流 选择一个流 ``` private View.OnClickListener subscribe = new View.OnClickListener() { public void onClick(View v) {} } ``` 选择编码: ``` public void chooseCodec(RemoteStream remoteStream) {} ``` 开始拉流 ``` conferenceClient.subscribe(remoteStream, options,) ```