TrtcDefines.js 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454
  1. /**
  2. * TRTC 关键类型定义<br>
  3. * @description 分辨率、质量等级等枚举和常量值的定义
  4. */
  5. /////////////////////////////////////////////////////////////////////////////////
  6. //
  7. // 【(一)视频相关枚举值定义】
  8. //
  9. /////////////////////////////////////////////////////////////////////////////////
  10. /**
  11. * 视频分辨率<br>
  12. * 此处仅定义横屏分辨率(如 640 × 360),如需使用竖屏分辨率(如 360 × 640),需要同时指定 VideoResolutionMode 为 Portrait
  13. * @enum {Number}
  14. */
  15. const TRTCVideoResolution_HACK_JSDOC = {
  16. /** 宽高比 1:1;分辨率 120x120;建议码率(VideoCall)80kbps; 建议码率(LIVE)120kbps */
  17. TRTCVideoResolution_120_120: 1,
  18. /** 宽高比 1:1 分辨率 160x160;建议码率(VideoCall)100kbps; 建议码率(LIVE)150kbps */
  19. TRTCVideoResolution_160_160: 3,
  20. /** 宽高比 1:1;分辨率 270x270;建议码率(VideoCall)200kbps; 建议码率(LIVE)300kbps */
  21. TRTCVideoResolution_270_270: 5,
  22. /** 宽高比 1:1;分辨率 480x480;建议码率(VideoCall)350kbps; 建议码率(LIVE)500kbps */
  23. TRTCVideoResolution_480_480: 7,
  24. /** 宽高比4:3;分辨率 160x120;建议码率(VideoCall)100kbps; 建议码率(LIVE)150kbps */
  25. TRTCVideoResolution_160_120: 50,
  26. /** 宽高比 4:3;分辨率 240x180;建议码率(VideoCall)150kbps; 建议码率(LIVE)250kbps */
  27. TRTCVideoResolution_240_180: 52,
  28. /** 宽高比 4:3;分辨率 280x210;建议码率(VideoCall)200kbps; 建议码率(LIVE)300kbps */
  29. TRTCVideoResolution_280_210: 54,
  30. /** 宽高比 4:3;分辨率 320x240;建议码率(VideoCall)250kbps; 建议码率(LIVE)375kbps */
  31. TRTCVideoResolution_320_240: 56,
  32. /** 宽高比 4:3;分辨率 400x300;建议码率(VideoCall)300kbps; 建议码率(LIVE)450kbps */
  33. TRTCVideoResolution_400_300: 58,
  34. /** 宽高比 4:3;分辨率 480x360;建议码率(VideoCall)400kbps; 建议码率(LIVE)600kbps */
  35. TRTCVideoResolution_480_360: 60,
  36. /** 宽高比 4:3;分辨率 640x480;建议码率(VideoCall)600kbps; 建议码率(LIVE)900kbps */
  37. TRTCVideoResolution_640_480: 62,
  38. /** 宽高比 4:3;分辨率 960x720;建议码率(VideoCall)1000kbps; 建议码率(LIVE)1500kbps */
  39. TRTCVideoResolution_960_720: 64,
  40. /** 宽高比 16:9;分辨率 160x90;建议码率(VideoCall)150kbps; 建议码率(LIVE)250kbps */
  41. TRTCVideoResolution_160_90: 100,
  42. /** 宽高比 16:9;分辨率 256x144;建议码率(VideoCall)200kbps; 建议码率(LIVE)300kbps */
  43. TRTCVideoResolution_256_144: 102,
  44. /** 宽高比 16:9;分辨率 320x180;建议码率(VideoCall)250kbps; 建议码率(LIVE)400kbps */
  45. TRTCVideoResolution_320_180: 104,
  46. /** 宽高比 16:9;分辨率 480x270;建议码率(VideoCall)350kbps; 建议码率(LIVE)550kbps */
  47. TRTCVideoResolution_480_270: 106,
  48. /** 宽高比 16:9;分辨率 640x360;建议码率(VideoCall)500kbps; 建议码率(LIVE)900kbps */
  49. TRTCVideoResolution_640_360: 108,
  50. /** 宽高比 16:9;分辨率 960x540;建议码率(VideoCall)850kbps; 建议码率(LIVE)1300kbps */
  51. TRTCVideoResolution_960_540: 110,
  52. /** 宽高比 16:9;分辨率 1280x720;建议码率(VideoCall)1200kbps; 建议码率(LIVE)1800kbps */
  53. TRTCVideoResolution_1280_720: 112,
  54. /** 宽高比 16:9;分辨率 1920x1080;建议码率(VideoCall)2000kbps; 建议码率(LIVE)3000kbps */
  55. TRTCVideoResolution_1920_1080: 114,
  56. };
  57. export var TRTCVideoResolution;
  58. (function (TRTCVideoResolution) {
  59. TRTCVideoResolution[TRTCVideoResolution["TRTCVideoResolution_120_120"] = 1] = "TRTCVideoResolution_120_120";
  60. TRTCVideoResolution[TRTCVideoResolution["TRTCVideoResolution_160_160"] = 3] = "TRTCVideoResolution_160_160";
  61. TRTCVideoResolution[TRTCVideoResolution["TRTCVideoResolution_270_270"] = 5] = "TRTCVideoResolution_270_270";
  62. TRTCVideoResolution[TRTCVideoResolution["TRTCVideoResolution_480_480"] = 7] = "TRTCVideoResolution_480_480";
  63. TRTCVideoResolution[TRTCVideoResolution["TRTCVideoResolution_160_120"] = 50] = "TRTCVideoResolution_160_120";
  64. TRTCVideoResolution[TRTCVideoResolution["TRTCVideoResolution_240_180"] = 52] = "TRTCVideoResolution_240_180";
  65. TRTCVideoResolution[TRTCVideoResolution["TRTCVideoResolution_280_210"] = 54] = "TRTCVideoResolution_280_210";
  66. TRTCVideoResolution[TRTCVideoResolution["TRTCVideoResolution_320_240"] = 56] = "TRTCVideoResolution_320_240";
  67. TRTCVideoResolution[TRTCVideoResolution["TRTCVideoResolution_400_300"] = 58] = "TRTCVideoResolution_400_300";
  68. TRTCVideoResolution[TRTCVideoResolution["TRTCVideoResolution_480_360"] = 60] = "TRTCVideoResolution_480_360";
  69. TRTCVideoResolution[TRTCVideoResolution["TRTCVideoResolution_640_480"] = 62] = "TRTCVideoResolution_640_480";
  70. TRTCVideoResolution[TRTCVideoResolution["TRTCVideoResolution_960_720"] = 64] = "TRTCVideoResolution_960_720";
  71. TRTCVideoResolution[TRTCVideoResolution["TRTCVideoResolution_160_90"] = 100] = "TRTCVideoResolution_160_90";
  72. TRTCVideoResolution[TRTCVideoResolution["TRTCVideoResolution_256_144"] = 102] = "TRTCVideoResolution_256_144";
  73. TRTCVideoResolution[TRTCVideoResolution["TRTCVideoResolution_320_180"] = 104] = "TRTCVideoResolution_320_180";
  74. TRTCVideoResolution[TRTCVideoResolution["TRTCVideoResolution_480_270"] = 106] = "TRTCVideoResolution_480_270";
  75. TRTCVideoResolution[TRTCVideoResolution["TRTCVideoResolution_640_360"] = 108] = "TRTCVideoResolution_640_360";
  76. TRTCVideoResolution[TRTCVideoResolution["TRTCVideoResolution_960_540"] = 110] = "TRTCVideoResolution_960_540";
  77. TRTCVideoResolution[TRTCVideoResolution["TRTCVideoResolution_1280_720"] = 112] = "TRTCVideoResolution_1280_720";
  78. TRTCVideoResolution[TRTCVideoResolution["TRTCVideoResolution_1920_1080"] = 114] = "TRTCVideoResolution_1920_1080";
  79. })(TRTCVideoResolution || (TRTCVideoResolution = {}));
  80. /**
  81. * 视频分辨率模式<br>
  82. * TRTCVideoResolution 中仅定义了横屏分辨率(如 640 × 360),如需使用竖屏分辨率(如 360 × 640),需要同时指定 TRTCVideoResolutionMode 为 Portrait
  83. * @enum {Number}
  84. */
  85. const TRTCVideoResolutionMode_HACK_JSDOC = {
  86. /** 横屏分辨率 */
  87. TRTCVideoResolutionModeLandscape: 0,
  88. /** 竖屏分辨率 */
  89. TRTCVideoResolutionModePortrait: 1,
  90. };
  91. export var TRTCVideoResolutionMode;
  92. (function (TRTCVideoResolutionMode) {
  93. TRTCVideoResolutionMode[TRTCVideoResolutionMode["TRTCVideoResolutionModeLandscape"] = 0] = "TRTCVideoResolutionModeLandscape";
  94. TRTCVideoResolutionMode[TRTCVideoResolutionMode["TRTCVideoResolutionModePortrait"] = 1] = "TRTCVideoResolutionModePortrait";
  95. })(TRTCVideoResolutionMode || (TRTCVideoResolutionMode = {}));
  96. ;
  97. /**
  98. * 视频流类型<br>
  99. * TRTC 内部有三种不同的音视频流,分别是:
  100. * - 高清大画面:一般用来传输摄像头的视频数据
  101. * - 低清小画面:小画面和大画面的内容相互,但是分辨率和码率都比大画面低,因此清晰度也更低
  102. * - 辅流画面:一般用于屏幕分享,同一时间在同一个房间中只允许一个用户发布辅流视频,其他用户必须要等该用户关闭之后才能发布自己的辅流
  103. *
  104. * **Note:**
  105. * - 不支持单独开启低清小画面,小画面必须依附于大画面而存在,SDK 会自动设定低清小画面的分辨率和码率
  106. * @enum {Number}
  107. */
  108. const TRTCVideoStreamType_HACK_JSDOC = {
  109. /** 大画面视频流 */
  110. TRTCVideoStreamTypeBig: 0,
  111. /** 小画面视频流 */
  112. TRTCVideoStreamTypeSmall: 1,
  113. /** 辅流(屏幕分享) */
  114. TRTCVideoStreamTypeSub: 2,
  115. };
  116. export var TRTCVideoStreamType;
  117. (function (TRTCVideoStreamType) {
  118. TRTCVideoStreamType[TRTCVideoStreamType["TRTCVideoStreamTypeBig"] = 0] = "TRTCVideoStreamTypeBig";
  119. TRTCVideoStreamType[TRTCVideoStreamType["TRTCVideoStreamTypeSmall"] = 1] = "TRTCVideoStreamTypeSmall";
  120. TRTCVideoStreamType[TRTCVideoStreamType["TRTCVideoStreamTypeSub"] = 2] = "TRTCVideoStreamTypeSub";
  121. })(TRTCVideoStreamType || (TRTCVideoStreamType = {}));
  122. /**
  123. * 画面来源<br>
  124. * TRTC 内部有两种不同的画面来源,分别是:
  125. * - TRTCSnapshotSourceTypeStream: 视频流画面
  126. * - TRTCSnapshotSourceTypeView: 视频渲染画面
  127. *
  128. * **Note:**
  129. * - 截取视频流画面(TRTCSnapshotSourceTypeStream)一般更清晰。
  130. * @enum {Number}
  131. */
  132. const TRTCSnapshotSourceType_HACK_JSDOC = {
  133. /** 视频流画面 */
  134. TRTCSnapshotSourceTypeStream: 0,
  135. /** 视频渲染画面 */
  136. TRTCSnapshotSourceTypeView: 1,
  137. };
  138. export var TRTCSnapshotSourceType;
  139. (function (TRTCSnapshotSourceType) {
  140. TRTCSnapshotSourceType[TRTCSnapshotSourceType["TRTCSnapshotSourceTypeStream"] = 0] = "TRTCSnapshotSourceTypeStream";
  141. TRTCSnapshotSourceType[TRTCSnapshotSourceType["TRTCSnapshotSourceTypeView"] = 1] = "TRTCSnapshotSourceTypeView";
  142. })(TRTCSnapshotSourceType || (TRTCSnapshotSourceType = {}));
  143. /**
  144. * 视频画面填充模式<br>
  145. * 如果画面的显示分辨率不等于画面的原始分辨率,就需要您设置画面的填充模式:
  146. * - TRTCVideoFillMode_Fill,图像铺满屏幕,超出显示视窗的视频部分将被截掉,所以画面显示可能不完整。
  147. * - TRTCVideoFillMode_Fit,图像长边填满屏幕,短边区域会被填充黑色,但画面的内容肯定是完整的。
  148. * @enum {Number}
  149. */
  150. const TRTCVideoFillMode_HACK_JSDOC = {
  151. /** 图像铺满屏幕,超出显示视窗的视频部分将被截掉 */
  152. TRTCVideoFillMode_Fill: 0,
  153. /** 图像长边填满屏幕,短边区域会被填充黑色 */
  154. TRTCVideoFillMode_Fit: 1,
  155. };
  156. export var TRTCVideoFillMode;
  157. (function (TRTCVideoFillMode) {
  158. TRTCVideoFillMode[TRTCVideoFillMode["TRTCVideoFillMode_Fill"] = 0] = "TRTCVideoFillMode_Fill";
  159. TRTCVideoFillMode[TRTCVideoFillMode["TRTCVideoFillMode_Fit"] = 1] = "TRTCVideoFillMode_Fit";
  160. })(TRTCVideoFillMode || (TRTCVideoFillMode = {}));
  161. ;
  162. /**
  163. * 视频画面旋转方向<br>
  164. * TRTC SDK 提供了对本地和远程画面的旋转角度设置 API,如下的旋转角度都是指顺时针方向的。
  165. * @enum {Number}
  166. */
  167. const TRTCVideoRotation_HACK_JSDOC = {
  168. /** 顺时针旋转0度 */
  169. TRTCVideoRotation_0: 0,
  170. /** 顺时针旋转90度 */
  171. TRTCVideoRotation_90: 1,
  172. /** 顺时针旋转180度 */
  173. TRTCVideoRotation_180: 2,
  174. /** 顺时针旋转270度 */
  175. TRTCVideoRotation_270: 3,
  176. };
  177. export var TRTCVideoRotation;
  178. (function (TRTCVideoRotation) {
  179. TRTCVideoRotation[TRTCVideoRotation["TRTCVideoRotation_0"] = 0] = "TRTCVideoRotation_0";
  180. TRTCVideoRotation[TRTCVideoRotation["TRTCVideoRotation_90"] = 1] = "TRTCVideoRotation_90";
  181. TRTCVideoRotation[TRTCVideoRotation["TRTCVideoRotation_180"] = 2] = "TRTCVideoRotation_180";
  182. TRTCVideoRotation[TRTCVideoRotation["TRTCVideoRotation_270"] = 3] = "TRTCVideoRotation_270";
  183. })(TRTCVideoRotation || (TRTCVideoRotation = {}));
  184. /**
  185. * 画面渲染镜像类型<br>
  186. * TRTC 的画面镜像提供下列设置模式
  187. * @enum {Number}
  188. */
  189. const TRTCVideoMirrorType_HACK_JSDOC = {
  190. /** 只适用于移动端, 本地预览时,前置摄像头镜像,后置摄像头不镜像 */
  191. TRTCVideoMirrorType_Auto: 0,
  192. /** 所有画面均镜像 */
  193. TRTCVideoMirrorType_Enable: 1,
  194. /** 所有画面均不镜像 */
  195. TRTCVideoMirrorType_Disable: 2
  196. };
  197. export var TRTCVideoMirrorType;
  198. (function (TRTCVideoMirrorType) {
  199. TRTCVideoMirrorType[TRTCVideoMirrorType["TRTCVideoMirrorType_Auto"] = 0] = "TRTCVideoMirrorType_Auto";
  200. TRTCVideoMirrorType[TRTCVideoMirrorType["TRTCVideoMirrorType_Enable"] = 1] = "TRTCVideoMirrorType_Enable";
  201. TRTCVideoMirrorType[TRTCVideoMirrorType["TRTCVideoMirrorType_Disable"] = 2] = "TRTCVideoMirrorType_Disable";
  202. })(TRTCVideoMirrorType || (TRTCVideoMirrorType = {}));
  203. /**
  204. * 美颜(磨皮)算法<br>
  205. * TRTC SDK 内置了多种不同的磨皮算法,您可以选择最适合您产品定位的方案。
  206. * @enum {Number}
  207. */
  208. const TRTCBeautyStyle_HACK_JSDOC = {
  209. /** 光滑,算法比较激进,磨皮效果比较明显,适用于秀场直播 */
  210. TRTCBeautyStyleSmooth: 0,
  211. /** 自然,算法更多地保留了面部细节,磨皮效果更加自然,适用于绝大多数直播场景 */
  212. TRTCBeautyStyleNature: 1,
  213. /** 优图,由优图实验室提供,磨皮效果介于光滑和自然之间,比光滑保留更多皮肤细节,比自然磨皮程度更高 */
  214. TRTCBeautyStylePitu: 2,
  215. };
  216. export var TRTCBeautyStyle;
  217. (function (TRTCBeautyStyle) {
  218. TRTCBeautyStyle[TRTCBeautyStyle["TRTCBeautyStyleSmooth"] = 0] = "TRTCBeautyStyleSmooth";
  219. TRTCBeautyStyle[TRTCBeautyStyle["TRTCBeautyStyleNature"] = 1] = "TRTCBeautyStyleNature";
  220. TRTCBeautyStyle[TRTCBeautyStyle["TRTCBeautyStylePitu"] = 2] = "TRTCBeautyStylePitu";
  221. })(TRTCBeautyStyle || (TRTCBeautyStyle = {}));
  222. /**
  223. * 背景音效<br>
  224. * @enum {Number}
  225. */
  226. export class AudioMusicParam {
  227. constructor(id, path, loopCount, publish, isShortFile, startTimeMS, endTimeMS) {
  228. this.id = id;
  229. this.path = path;
  230. this.loopCount = loopCount;
  231. this.publish = publish;
  232. this.isShortFile = isShortFile;
  233. this.startTimeMS = startTimeMS;
  234. this.endTimeMS = endTimeMS;
  235. }
  236. }
  237. /////////////////////////////////////////////////////////////////////////////////
  238. //
  239. // 【(二)网络相关枚举值定义】
  240. //
  241. /////////////////////////////////////////////////////////////////////////////////
  242. /**
  243. * 应用场景<br>
  244. * TRTC 可用于视频会议和在线直播等多种应用场景,针对不同的应用场景,TRTC SDK 的内部会进行不同的优化配置:
  245. * - TRTCAppSceneVideoCall :视频通话场景,适合[1对1视频通话]、[300人视频会议]、[在线问诊]、[视频聊天]、[远程面试]等。
  246. * - TRTCAppSceneLIVE :视频互动直播,适合[视频低延时直播]、[十万人互动课堂]、[视频直播 PK]、[视频相亲房]、[互动课堂]、[远程培训]、[超大型会议]等。
  247. * - TRTCAppSceneAudioCall :语音通话场景,适合[1对1语音通话]、[300人语音会议]、[语音聊天]、[语音会议]、[在线狼人杀]等。
  248. * - TRTCAppSceneVoiceChatRoom:语音互动直播,适合:[语音低延时直播]、[语音直播连麦]、[语聊房]、[K 歌房]、[FM 电台]等。
  249. * @enum {Number}
  250. */
  251. const TRTCAppScene_HACK_JSDOC = {
  252. /**
  253. * 视频通话场景,支持720P、1080P高清画质,单个房间最多支持300人同时在线,最高支持50人同时发言。<br>
  254. * 适合:[视频低延时直播]、[十万人互动课堂]、[视频直播 PK]、[视频相亲房]、[互动课堂]、[远程培训]、[超大型会议]等。<br>
  255. * 注意:此场景下,您必须通过 TRTCParams 中的 role 字段指定当前用户的角色。
  256. */
  257. TRTCAppSceneVideoCall: 0,
  258. /**
  259. * 视频互动直播,支持平滑上下麦,切换过程无需等待,主播延时小于300ms;支持十万级别观众同时播放,播放延时低至1000ms。<br>
  260. * 在线直播场景,内部编码器和网络协议优化侧重性能和兼容性,性能和清晰度表现更佳。
  261. */
  262. TRTCAppSceneLIVE: 1,
  263. /**
  264. * 语音通话场景,支持 48kHz,支持双声道。单个房间最多支持300人同时在线,最高支持50人同时发言。<br>
  265. * 适合:[1对1语音通话]、[300人语音会议]、[语音聊天]、[语音会议]、[在线狼人杀]等。
  266. */
  267. TRTCAppSceneAudioCall: 2,
  268. /**
  269. * 语音互动直播,支持平滑上下麦,切换过程无需等待,主播延时小于300ms;支持十万级别观众同时播放,播放延时低至1000ms。<br>
  270. * 适合:[语音低延时直播]、[语音直播连麦]、[语聊房]、[K 歌房]、[FM 电台]等。<br>
  271. * 注意:此场景下,您必须通过 TRTCParams 中的 role 字段指定当前用户的角色。
  272. */
  273. TRTCAppSceneVoiceChatRoom: 3,
  274. };
  275. export var TRTCAppScene;
  276. (function (TRTCAppScene) {
  277. TRTCAppScene[TRTCAppScene["TRTCAppSceneVideoCall"] = 0] = "TRTCAppSceneVideoCall";
  278. TRTCAppScene[TRTCAppScene["TRTCAppSceneLIVE"] = 1] = "TRTCAppSceneLIVE";
  279. TRTCAppScene[TRTCAppScene["TRTCAppSceneAudioCall"] = 2] = "TRTCAppSceneAudioCall";
  280. TRTCAppScene[TRTCAppScene["TRTCAppSceneVoiceChatRoom"] = 3] = "TRTCAppSceneVoiceChatRoom";
  281. })(TRTCAppScene || (TRTCAppScene = {}));
  282. /**
  283. * 角色,仅适用于直播场景(TRTCAppSceneLIVE 和 TRTCAppSceneVoiceChatRoom)<br>
  284. * 在直播场景中,多数用户只是观众,只有个别用户是主播,这种角色区分可以有利于 TRTC 进行更好的定向优化。
  285. * - Anchor:主播,可以上行视频和音频,一个房间里最多支持50个主播同时上行音视频。
  286. * - Audience:观众,只能观看,不能上行视频和音频,一个房间里的观众人数没有上限。
  287. *
  288. * @enum {Number}
  289. */
  290. const TRTCRoleType_HACK_JSDOC = {
  291. /** 主播 */
  292. TRTCRoleAnchor: 20,
  293. /** 观众 */
  294. TRTCRoleAudience: 21,
  295. };
  296. export var TRTCRoleType;
  297. (function (TRTCRoleType) {
  298. TRTCRoleType[TRTCRoleType["TRTCRoleAnchor"] = 20] = "TRTCRoleAnchor";
  299. TRTCRoleType[TRTCRoleType["TRTCRoleAudience"] = 21] = "TRTCRoleAudience";
  300. })(TRTCRoleType || (TRTCRoleType = {}));
  301. /////////////////////////////////////////////////////////////////////////////////
  302. //
  303. // 【(三)音频相关枚举值定义】
  304. //
  305. /////////////////////////////////////////////////////////////////////////////////
  306. /**
  307. * 音频质量<br>
  308. * @enum {Number}
  309. */
  310. const TRTCAudioQuality_HACK_JSDOC = {
  311. /** 人声模式:适用于以人声沟通为主的应用场景,该模式下音频传输的抗性较强,TRTC 会通过各种人声处理技术保障在弱网络环境下的流畅度最佳 */
  312. TRTCAudioQualitySpeech: 1,
  313. /** 标准模式(或者默认模式):介于 Speech 和 Music 之间的档位,对音乐的还原度比人声模式要好,但传输数据量比音乐模式要低很多,对各种场景均有不错的适应性,如无特殊需求推荐选择之。 */
  314. TRTCAudioQualityDefault: 2,
  315. /** 音乐模式:适用于对声乐要求很苛刻的场景,该模式下音频传输的数据量很大,TRTC 会通过各项技术确保音乐信号在各频段均能获得高保真的细节还原度 */
  316. TRTCAudioQualityMusic: 3
  317. };
  318. export var TRTCAudioQuality;
  319. (function (TRTCAudioQuality) {
  320. TRTCAudioQuality[TRTCAudioQuality["TRTCAudioQualitySpeech"] = 1] = "TRTCAudioQualitySpeech";
  321. TRTCAudioQuality[TRTCAudioQuality["TRTCAudioQualityDefault"] = 2] = "TRTCAudioQualityDefault";
  322. TRTCAudioQuality[TRTCAudioQuality["TRTCAudioQualityMusic"] = 3] = "TRTCAudioQualityMusic";
  323. })(TRTCAudioQuality || (TRTCAudioQuality = {}));
  324. /////////////////////////////////////////////////////////////////////////////////
  325. //
  326. // 【(四)TRTC 核心类型定义】
  327. //
  328. /////////////////////////////////////////////////////////////////////////////////
  329. /**
  330. * 进房相关参数<br>
  331. * 只有该参数填写正确,才能顺利调用 enterRoom 进入 roomId 所指定的音视频房间。
  332. * @param {Number} sdkAppId - 【字段含义】应用标识(必填),腾讯视频云基于 sdkAppId 完成计费统计。<br>
  333. * 【推荐取值】在腾讯云 [TRTC 控制台](https://console.cloud.tencent.com/rav/) 中创建应用,之后可以在账号信息页面中得到该 ID。<br>
  334. * @param {String} userId - 【字段含义】用户标识(必填)。当前用户的 userId,相当于用户名,UTF-8编码。<br>
  335. * 【推荐取值】如果一个用户在您的账号系统中的 ID 为“abc”,则 userId 即可设置为“abc”。<br>
  336. * @param {String} userSig - 【字段含义】用户签名(必填),当前 userId 对应的验证签名,相当于登录密码。<br>
  337. * 【推荐取值】请参考 [如何计算UserSig](https://cloud.tencent.com/document/product/647/17275)。<br>
  338. * @param {Number} roomId - 【字段含义】房间号码(必填),指定房间号,在同一个房间里的用户(userId)可以彼此看到对方并进行视频通话, roomId 和 strRoomId 必须填一个, 若您选用 strRoomId,则 roomId 需要填写为0。<br>
  339. * 【推荐取值】您可以随意指定,但请不要重复,如果您的用户账号 ID 是数字类型的,可以直接用创建者的用户 ID 作为 roomId。<br>
  340. * @param {String} strRoomId - 【字段含义】字符串房间号码(选填),roomId 和 strRoomId 必须填一个。若两者都填,则优先选择 roomId。<br>
  341. * 【推荐取值】您可以随意指定,但请不要重复。<br>
  342. * @param {TRTCRoleType} role - 【字段含义】直播场景下的角色,仅适用于直播场景(TRTCAppSceneLIVE 和 TRTCAppSceneVoiceChatRoom),视频通话场景下指定无效。<br>
  343. * 【推荐取值】默认值:主播(TRTCRoleAnchor)<br>
  344. * @param {String} privateMapKey - 【字段含义】房间签名(非必填),如果您希望某个房间只能让特定的某些 userId 进入,就需要使用 privateMapKey 进行权限保护。<br>
  345. * 【推荐取值】仅建议有高级别安全需求的客户使用,参考文档:[进房权限保护](https://cloud.tencent.com/document/product/647/32240)<br>
  346. * @param {String} businessInfo - 【字段含义】业务数据(非必填),某些非常用的高级特性才需要用到此字段。<br>
  347. * 【推荐取值】不建议使用<br>
  348. * @param {String} streamId - 【字段含义】绑定腾讯云直播 CDN 流 ID[非必填],设置之后,您就可以在腾讯云直播 CDN 上通过标准直播方案(FLV或HLS)播放该用户的音视频流。<br>
  349. * 【推荐取值】限制长度为64字节,可以不填写,一种推荐的方案是使用 “sdkappid_roomid_userid_main” 作为 streamid,这样比较好辨认且不会在您的多个应用中发生冲突。<br>
  350. * 【特殊说明】要使用腾讯云直播 CDN,您需要先在[控制台](https://console.cloud.tencent.com/trtc/) 中的功能配置页开启“启动自动旁路直播”开关。<br>
  351. * 【参考文档】[CDN 旁路直播](https://cloud.tencent.com/document/product/647/16826)。
  352. * @param {String} userDefineRecordId - 【字段含义】设置云端录制完成后的回调消息中的 "userdefinerecordid" 字段内容,便于您更方便的识别录制回调。<br>
  353. * 【推荐取值】限制长度为64字节,只允许包含大小写英文字母(a-zA-Z)、数字(0-9)及下划线和连词符。<br>
  354. * 【参考文档】[云端录制](https://cloud.tencent.com/document/product/647/16823)。
  355. */
  356. export class TRTCParams {
  357. constructor(sdkAppId, userId, roomId, userSig, strRoomId, privateMapKey, role, businessInfo, streamId, userDefineRecordId) {
  358. this.sdkAppId = sdkAppId;
  359. this.userId = userId;
  360. this.roomId = roomId;
  361. this.userSig = userSig;
  362. this.strRoomId = strRoomId;
  363. this.privateMapKey = privateMapKey;
  364. this.role = role;
  365. this.businessInfo = businessInfo;
  366. this.streamId = streamId;
  367. this.userDefineRecordId = userDefineRecordId;
  368. }
  369. }
  370. /**
  371. * 视频编码参数<br>
  372. * 该设置决定了远端用户看到的画面质量(同时也是云端录制出的视频文件的画面质量)。
  373. * @param {TRTCVideoResolution} videoResolution - 【字段含义】 视频分辨率<br>
  374. * 【推荐取值】 <br>
  375. * - 视频通话建议选择360 × 640及以下分辨率,resMode 选择 Portrait。<br>
  376. * - 手机直播建议选择 540 × 960,resMode 选择 Portrait。<br>
  377. * - Window 和 iMac 建议选择 640 × 360 及以上分辨率,resMode 选择 Landscape。
  378. * 【特别说明】 TRTCVideoResolution 默认只能横屏模式的分辨率,例如640 × 360。<br>
  379. * 如需使用竖屏分辨率,请指定 resMode 为 Portrait,例如640 × 360结合 Portrait 则为360 × 640。<br>
  380. * @param {TRTCVideoResolutionMode} resMode - 【字段含义】分辨率模式(横屏分辨率 - 竖屏分辨率)<br>
  381. * 【推荐取值】手机直播建议选择 Portrait,Window 和 Mac 建议选择 Landscape。<br>
  382. * 【特别说明】如果 videoResolution 指定分辨率 640 × 360,resMode 指定模式为 Portrait,则最终编码出的分辨率为360 × 640。<br>
  383. * @param {Number} videoFps - 【字段含义】视频采集帧率<br>
  384. * 【推荐取值】15fps 或 20fps,10fps 以下会有轻微卡顿感,5fps 以下卡顿感明显,20fps 以上的帧率则过于浪费(电影的帧率也只有 24fps)。<br>
  385. * 【特别说明】很多 Android 手机的前置摄像头并不支持15fps以上的采集帧率,部分过于突出美颜功能的 Android 手机前置摄像头的采集帧率可能低于10fps。<br>
  386. * @param {Number} videoBitrate - 【字段含义】视频上行码率<br>
  387. * 【推荐取值】推荐设置请参考本文件前半部分 TRTCVideoResolution 定义处的注释说明<br>
  388. * 【特别说明】码率太低会导致视频中有很多的马赛克<br>
  389. * @param {Number} minVideoBitrate -【字段含义】最低视频码率,SDK 会在网络不佳的情况下主动降低视频码率,最低会降至 minVideoBitrate 所设定的数值。
  390. * 【推荐取值】<br>
  391. * - 如果您追求“允许卡顿但要保持清晰”的效果,可以设置 minVideoBitrate 为 videoBitrate 的 60%;
  392. * - 如果您追求“允许模糊但要保持流畅”的效果,可以设置 minVideoBitrate 为 200kbps;
  393. * - 如果您将 videoBitrate 和 minVideoBitrate 设置为同一个值,等价于关闭 SDK 的自适应调节能力;
  394. * - 默认值:0,此时最低码率由 SDK 根据分辨率情况,自动设置合适的数值。<br>
  395. * 【特别说明】<br>
  396. * - 当您把分辨率设置的比较高时,minVideoBitrate 不适合设置的太低,否则会出现画面模糊和大范围的马赛克宏块。
  397. * 比如把分辨率设置为 720p,把码率设置为 200kbps,那么编码出的画面将会出现大范围区域性马赛克。
  398. * @param {Boolean} enableAdjustRes - 【字段含义】是否允许调整分辨率<br>
  399. * 【推荐取值】 <br>
  400. * - 手机直播建议选择 NO。<br>
  401. * - 视频通话模式,若更关注流畅性,建议选择 YES,此时若遇到带宽有限的弱网,SDK 会自动降低分辨率以保障更好的流畅度(仅针对 TRTCVideoStreamTypeBig 生效)。
  402. * - 默认值:NO。<br>
  403. * 【特别说明】若有录制需求,选择 YES 时,请确保通话过程中,调整分辨率不会影响您的录制效果。<br>
  404. */
  405. export class TRTCVideoEncParam {
  406. constructor(videoResolution = TRTCVideoResolution.TRTCVideoResolution_640_360, resMode = TRTCVideoResolutionMode.TRTCVideoResolutionModePortrait, videoFps = 15, videoBitrate = 550, minVideoBitrate = 0, enableAdjustRes = false) {
  407. this.videoResolution = videoResolution;
  408. this.videoResolutionMode = resMode;
  409. this.videoFps = videoFps;
  410. this.videoBitrate = videoBitrate;
  411. this.minVideoBitrate = minVideoBitrate;
  412. this.enableAdjustRes = enableAdjustRes;
  413. }
  414. }
  415. ;
  416. /**
  417. * 画面渲染参数<br>
  418. * 您可以通过设置此参数来控制画面的旋转、填充、镜像模式
  419. * @param {TRTCVideoRotation} rotation - 【字段含义】视频画面旋转方向
  420. * @param {TRTCVideoFillMode} fillMode - 【字段含义】视频画面填充模式
  421. * @param {TRTCVideoMirrorType} mirrorType - 【字段含义】画面渲染镜像类型
  422. */
  423. export class TRTCRenderParams {
  424. constructor(rotation = TRTCVideoRotation.TRTCVideoRotation_0, fillMode = TRTCVideoFillMode.TRTCVideoFillMode_Fit, mirrorType = TRTCVideoMirrorType.TRTCVideoMirrorType_Disable) {
  425. this.rotation = rotation;
  426. this.fillMode = fillMode;
  427. this.mirrorType = mirrorType;
  428. }
  429. }
  430. /**
  431. * 音频路由(即声音的播放模式)<br>
  432. * @enum {Number}
  433. */
  434. const TRTCAudioRoute_HACK_JSDOC = {
  435. /** 使用扬声器播放(即“免提”),扬声器位于手机底部,声音偏大,适合外放音乐 */
  436. TRTCAudioRouteSpeaker: 0,
  437. /** 使用听筒播放,听筒位于手机顶部,声音偏小,适合需要保护隐私的通话场景 */
  438. TRTCAudioRouteEarpiece: 1,
  439. };
  440. export var TRTCAudioRoute;
  441. (function (TRTCAudioRoute) {
  442. TRTCAudioRoute[TRTCAudioRoute["TRTCAudioRouteSpeaker"] = 0] = "TRTCAudioRouteSpeaker";
  443. TRTCAudioRoute[TRTCAudioRoute["TRTCAudioRouteEarpiece"] = 1] = "TRTCAudioRouteEarpiece";
  444. })(TRTCAudioRoute || (TRTCAudioRoute = {}));
  445. /////////////////////////////////////////////////////////////////////////////////
  446. //
  447. // 【其它参数】
  448. //
  449. /////////////////////////////////////////////////////////////////////////////////
  450. export var TRTCShareSource;
  451. (function (TRTCShareSource) {
  452. TRTCShareSource["InApp"] = "InApp";
  453. TRTCShareSource["ByReplaykit"] = "ByReplaykit";
  454. })(TRTCShareSource || (TRTCShareSource = {}));