@rongcloud/plugin-rtc 5.4.5-alpha.1 → 5.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1 +1,50 @@
1
- # @rongcloud/plugin-rtc
1
+ # 使用说明
2
+ ## 安装依赖 @rongcloud/plugin-rtc
3
+
4
+ > RTC 消息通信需要依赖 IMLib 进行消息收发,所以需要先安装 IMLib
5
+ ### 一、 安装消息通信依赖 IMLib
6
+
7
+ 1. 查看最新包所依赖模块
8
+
9
+ ```
10
+ npm info "@rongcloud/imlib-next@latest" peerDependencies
11
+ ```
12
+
13
+ 2. 安装所依赖的模块
14
+
15
+ > npm version > 5.0
16
+ >
17
+ > 将所有依赖安装到 `dependencies` 的位置
18
+
19
+ ```
20
+ npx install-peerdeps -x "--save-prod" @rongcloud/imlib-next@latest
21
+ ```
22
+
23
+
24
+ ### 二、 安装音视频通信 RTCLib
25
+ 1. 查看最新包所依赖模块
26
+
27
+ ```
28
+ npm info "@rongcloud/plugin-rtc@latest" peerDependencies
29
+ ```
30
+
31
+ 2. 安装所依赖的模块
32
+
33
+ > npm version > 5.0
34
+ >
35
+ > 将所有依赖安装到 `dependencies` 的位置
36
+
37
+ ```
38
+ npx install-peerdeps -x "--save-prod" @rongcloud/plugin-rtc@latest
39
+ ```
40
+
41
+ ## RTC 使用
42
+
43
+ 1. 融云开发者文档 [^快速开始](https://doc.rongcloud.cn/live/Web/5.X/quickstart/init)
44
+
45
+ 2. demo 体验 [rongcloud-rtc-web-demo](https://github.com/rongcloud/rongcloud-rtc-web-demo)
46
+ 2. 流程说明
47
+ - [初始化](https://doc.rongcloud.cn/live/Web/5.X/quickstart/init)
48
+ - 创建房间并加入
49
+ - 在房间内发布资源
50
+ - 订阅房间内已经发布的资源
@@ -1,5 +1,5 @@
1
1
  import { IRCTrackBitrate } from '../../interfaces';
2
- import { ISdpSemantics } from './ASdpStrategy';
2
+ import { ISdpSemantics, RtpTransceiverDirection } from './ASdpStrategy';
3
3
  /**
4
4
  * 以字符串的形式 硬处理 SDP 信息
5
5
  * 对于 plan-b | unified-plan 数据的处理 方式是相同的。
@@ -12,6 +12,9 @@ export default abstract class ASdpBuilder {
12
12
  protected SDPHeader: string;
13
13
  protected videoStreams: string[];
14
14
  protected audioStreams: string[];
15
+ static KBitrate: number;
16
+ get videoSdps(): string[];
17
+ get audioSdps(): string[];
15
18
  constructor(SDP: string, type: ISdpSemantics);
16
19
  /**
17
20
  * 它从 SDP 中删除空行和尾随空格
@@ -54,6 +57,12 @@ export default abstract class ASdpBuilder {
54
57
  * @param {string} streamId - 音频流的媒体流 ID。
55
58
  */
56
59
  setAudioBitrateWithStreamId(bitrate: IRCTrackBitrate, streamId: string): ASdpBuilder;
60
+ /**
61
+ * 它设置特定 MID 的音频比特率。
62
+ * @param {IRCTrackBitrate} bitrate - 音频流的比特率,以 kbps 为单位。
63
+ * @param {string} mid - 音频流的媒体流 ID。
64
+ */
65
+ setAudioBitrateWithMid(bitrate: IRCTrackBitrate, mid: string): ASdpBuilder;
57
66
  /**
58
67
  * 它接受一个 SDP 音频块和一个比特率,并返回比特率设置为给定值的 SDP 音频块
59
68
  * @param {string} sdpAudioBlock - SDP 的音频块。
@@ -80,6 +89,12 @@ export default abstract class ASdpBuilder {
80
89
  * @param {string} streamId - 媒体流 ID。
81
90
  */
82
91
  setVideoBitrateWithStreamId(bitrate: IRCTrackBitrate, streamId: string): ASdpBuilder;
92
+ /**
93
+ * 它设置特定中间的视频比特率, 针对 SDP 中给定 mid 的 video 元素添加码率设置。
94
+ * @param {IRCTrackBitrate} bitrate - 您要设置的比特率。
95
+ * @param {string} streamId - 媒体流 ID。
96
+ */
97
+ setVideoBitrateWithMid(bitrate: IRCTrackBitrate, mid: string): ASdpBuilder;
83
98
  /**
84
99
  * 它设置视频项目的比特率。
85
100
  * @param {string} sdpVideoBlock - SDP 的视频块。
@@ -94,5 +109,7 @@ export default abstract class ASdpBuilder {
94
109
  * @returns 正在返回 sdpVideoBlock。
95
110
  */
96
111
  private addVideoBlineAS;
112
+ clearnSsrcWithMid(mid: string, direction: RtpTransceiverDirection): ASdpBuilder;
113
+ private clearSSRC;
97
114
  }
98
115
  //# sourceMappingURL=ASdpBuilder.d.ts.map
@@ -8,6 +8,11 @@ export declare enum SdpSemantics {
8
8
  PLANB = "plan-b",
9
9
  UNIFIEDPLAN = "unified-plan"
10
10
  }
11
+ export declare enum RtpTransceiverDirection {
12
+ SENDONLY = "sendonly",
13
+ RECVONLY = "recvonly",
14
+ INACTIVE = "inactive"
15
+ }
11
16
  export interface IOfferInfo {
12
17
  type: 'offer';
13
18
  sdp: string;
@@ -0,0 +1,60 @@
1
+ interface ssrcMedia {
2
+ ssrc: number;
3
+ attribute?: string;
4
+ value?: string;
5
+ }
6
+ interface Msid {
7
+ stream: string;
8
+ track: string;
9
+ }
10
+ interface mline {
11
+ kind: string;
12
+ port: number;
13
+ protocol: string;
14
+ fmt: string;
15
+ }
16
+ export default class SDPUtils {
17
+ static splitSections(blob: string): string[];
18
+ /**
19
+ * 它需要一个 SDP 文本块并返回一个仅包含媒体部分的 SDP 文本数组
20
+ * @param {string} blob - 您要解析的 SDP 字符串。
21
+ * @returns 字符串数组。
22
+ */
23
+ static getMediaSections(blob: string): string[];
24
+ static parseExtmap(line: string): {
25
+ id: number;
26
+ direction: string;
27
+ uri: string;
28
+ };
29
+ static splitLines(blob: string): string[];
30
+ /**
31
+ * 它接受一个媒体部分并返回一个对象,其中包含媒体部分的种类、端口、协议和格式
32
+ * @param {string} mediaSection - SDP的媒体部分。
33
+ * @returns 具有以下属性的对象:
34
+ * kind:媒体的类型(音频、视频等)
35
+ * 端口:端口号
36
+ * 协议:使用的协议
37
+ * fmt:媒体的格式
38
+ */
39
+ static parseMLine(mediaSection: string): mline;
40
+ static matchPrefix(blob: string, prefix: string): string[];
41
+ /**
42
+ * 它从 SDP 媒体部分解析 msid 属性
43
+ * @param {string} mediaSection - SDP的媒体部分。
44
+ * @returns 具有两个属性的对象:流和轨道。
45
+ */
46
+ static parseMsid(mediaSection: string): Msid;
47
+ /**
48
+ * 它接受一个字符串并返回一个对象
49
+ * @param {string} line - 我们正在解析的 SDP 行。
50
+ */
51
+ static parseSsrcMedia(line: string): ssrcMedia;
52
+ /**
53
+ * 它从 SDP 的媒体部分返回中间值
54
+ * @param {string} mediaSection - SDP的媒体部分。
55
+ * @returns 媒体部分的中间。
56
+ */
57
+ static getMid(mediaSection: string): string | undefined;
58
+ }
59
+ export {};
60
+ //# sourceMappingURL=SDPUtils.d.ts.map
@@ -14,8 +14,12 @@ export declare class UnifiedPlanStrategy extends ASdpStrategy {
14
14
  private _subedTracks;
15
15
  updateRecvTransceiverMap(trackId: string, transceiver: RTCRtpTransceiver): void;
16
16
  updateSubRemoteTracks(tracks: RCRemoteTrack[]): void;
17
+ protected midMsid: {
18
+ [key: string]: string;
19
+ };
17
20
  createOffer(iceRestart: boolean): Promise<IOfferInfo>;
18
21
  setRemoteAnswer(sdp: string): Promise<RCRTCCode>;
19
- protected resetSdp(sdp: string): string;
22
+ protected resetOfferSdp(sdp: string): string;
23
+ protected resetAnswerSdp(sdp: string): string;
20
24
  }
21
25
  //# sourceMappingURL=UnifiedPlanStrategy.d.ts.map
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
- * RCRTC - v5.4.5-alpha.1
3
- * CommitId - 960e964ebd4294c2f095e87cf9e33935703b475e
4
- * Fri Aug 12 2022 15:02:10 GMT+0800 (China Standard Time)
2
+ * RCRTC - v5.4.6
3
+ * CommitId - 94eaaf8b42fa1e563b6c6408fffee2eeaea15e7a
4
+ * Tue Aug 23 2022 22:25:57 GMT+0800 (China Standard Time)
5
5
  * ©2020 RongCloud, Inc. All rights reserved.
6
6
  */
7
7
  import { EventEmitter, RTCMode, IRuntime, RTCPluginContext, IJoinRTCRoomData, IReceivedMessage, ErrorCode, RTCJoinType, IRTCUserData, KVString, IServerRTCRoomEntry, LogLevel, IRTCJoinedInfo, IPluginGenerator } from '@rongcloud/engine';