chengkun
2025-04-18 1bb985f32f2efe0f9dd69f3cf29a1c809b1cf96d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// v4.7.0 及其以上版本的 SDK
TRTC.checkSystemRequirements().then((checkResult) => {
  if(!checkResult.result) {
     unUserd();
     // SDK 不支持当前浏览器,根据用户设备类型建议用户使用 SDK 支持的浏览器
  }else{
      // 设备不支持H.264
      let checkDetail = checkResult.detail;
      if(!checkDetail.isH264DecodeSupported || !checkDetail.isH264EncodeSupported ){
         unUserd(); 
      }
  }
});
// setup logging stuffs
TRTC.Logger.setLogLevel(TRTC.Logger.LogLevel.WARN);
TRTC.Logger.enableUploadLog();
 
TRTC.getDevices()
  .then(devices => {
    devices.forEach(item => {
      //console.log('device: ' + item.kind + ' ' + item.label + ' ' + item.deviceId);
    });
  })
  .catch(error => console.error('getDevices error observed ' + error));
 
// populate camera options
TRTC.getCameras().then(devices => {
  devices.forEach(device => {
    if (!cameraId) {
      cameraId = device.deviceId;
    }
  });
});
 
// populate microphone options
TRTC.getMicrophones().then(devices => {
  devices.forEach(device => {
    if (!micId) {
      micId = device.deviceId;
    }
  });
});