WGShare.Client.Electron/src/utils/package/basicEngagement.ts

96 lines
2.8 KiB
TypeScript

// import AgoraRTC from "agora-rtc-sdk-ng"
// let rtcClient = null as any;
// const options = {
// appId: "dcfc466a6ecb4a1f972630065dfb1e75",
// channel: '17723085346',
// token: "007eJxTYNDlkfJ9fD3lzh2e0KI5Oyy6vdU7phyIXOpV8F36/xPOeS8VGFKS05JNzMwSzVKTk0wSDdMszY3MjA0MzExT0pIMU81Np/g0pTUEMjJExEqyMjJAIIjPzWBobm5kbGBhamxixsAAAC6mH9k=",
// uid: 'eaecab',
// };
// rtcClient = AgoraRTC.createClient({ mode: "live", codec: "vp8" });
// // 以观众身份加入房间
// export async function AudienceJoinChannel(channel: any, uid: string | number) {
// await SetRule(1)
// await rtcClient.join(options.appId, channel, options.token, uid)
// }
// // 加入房间
// export async function JoinChannel(channel: any, uid: string | number) {
// await rtcClient.join(options.appId, channel, options.token, uid)
// }
// // 设置用户角色 1=观众 2=主播
// export async function SetRule(type: number) {
// await rtcClient.setClientRole(type == 1 ? "audience" : "host");
// }
// // 接流
// export async function ReceiveFLow(flowHandld: any) {
// rtcClient.on("user-published", async (user: any, mediaType: any) => {
// await rtcClient.subscribe(user, mediaType);
// console.log(user,'嘻嘻');
// flowHandld(user)
// });
// }
// // 远端取消推流
// export function ChannelFlow(channelHandle: any) {
// rtcClient.on("user-unpublished", (user: any) => {
// channelHandle(user)
// });
// }
// // 离开频道
// export function LeaveChannel() {
// rtcClient.leave()
// }
// // 发布本地音频轨道
// export async function PublishAudio(deviceId: string) {
// var audioTrack = await AgoraRTC.createMicrophoneAudioTrack({
// AEC: true, // 是否开启回声消除
// AGC: true, // 是否开启自动增益
// ANS: true, // 是否开启噪声抑制
// microphoneId: deviceId // 麦克风的设备 ID
// })
// await rtcClient.publish(audioTrack)
// }
// // 发布本地视频轨道 硬件设备
// export async function PublishVideo(deviceId: string) {
// var videoTrack = await AgoraRTC.createCameraVideoTrack({
// cameraId: deviceId,
// encoderConfig: '1080p_3'
// })
// await rtcClient.publish(videoTrack)
// }
// // 发布本地视频轨道 屏幕共享
// export async function PublishVideoScreen(sharedScreenItem: any) {
// var screenTrack = await AgoraRTC.createScreenVideoTrack({
// encoderConfig: "1080p_1",
// electronScreenSourceId: sharedScreenItem.id,
// })
// await rtcClient.publish(screenTrack)
// }
// // 获取麦克风设备列表
// export async function GetMicrophones() {
// return await AgoraRTC.getMicrophones()
// }
// // 获取摄像头设备列表
// export async function GetCameras() {
// return await AgoraRTC.getCameras()
// }
// // 取消发布所有流
// export async function UnpublishAll() {
// await rtcClient.unpublish()
// }