Skip to content

Commit 072062c

Browse files
author
Juhi Shah
committed
Add API details for c#
1 parent 4de2c28 commit 072062c

1 file changed

Lines changed: 71 additions & 0 deletions

File tree

specs/WebRtcPortConfiguration.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,79 @@ interface ICoreWebView2StagingEnvironmentOptions10
151151
}
152152
```
153153
154+
## C#
155+
156+
```csharp
157+
/// <summary>
158+
/// Specifies the WebRTC protocol type for port range configuration.
159+
/// </summary>
160+
public enum CoreWebView2WebRtcProtocolKind
161+
{
162+
/// <summary>
163+
/// UDP protocol for WebRTC media and ICE candidates.
164+
/// </summary>
165+
Udp = 0,
166+
/// <summary>
167+
/// TCP protocol for WebRTC media and ICE candidates (future support).
168+
/// </summary>
169+
Tcp = 1,
170+
}
171+
172+
/// <summary>
173+
/// WebRTC port configuration interface for managing WebRTC port range configuration.
174+
/// This interface provides methods to configure and retrieve custom port ranges
175+
/// that WebRTC will use for ICE candidates and media connections across different protocols.
176+
/// </summary>
177+
public interface ICoreWebView2WebRtcPortConfiguration
178+
{
179+
/// <summary>
180+
/// The SetPortRange method allows you to set a custom port range for WebRTC to use
181+
/// for a specific protocol type.
182+
/// This method allows configuring a specific port range that WebRTC will use
183+
/// for ICE candidates and media connections for the specified protocol.
184+
///
185+
/// protocol specifies the WebRTC protocol type (UDP, TCP, etc.).
186+
/// minPort and maxPort must be in the range 1025-65535 (inclusive).
187+
/// minPort must be less than or equal to maxPort.
188+
/// If minPort equals maxPort, it represents a single port.
189+
///
190+
/// Calling this method will replace any previously configured port range for the specified protocol.
191+
/// </summary>
192+
/// <param name="protocol">The WebRTC protocol type</param>
193+
/// <param name="minPort">Minimum port in the range (1025-65535)</param>
194+
/// <param name="maxPort">Maximum port in the range (1025-65535)</param>
195+
void SetPortRange(CoreWebView2WebRtcProtocolKind protocol, uint minPort, uint maxPort);
196+
197+
/// <summary>
198+
/// The GetPortRange method gets the currently configured port range for a specific protocol.
199+
/// Returns true if a custom port range is configured for the specified protocol,
200+
/// with the range values in out parameters.
201+
/// Returns false if no custom range is set for the protocol (using default dynamic allocation),
202+
/// in which case the out parameter values should be ignored.
203+
/// </summary>
204+
/// <param name="protocol">The WebRTC protocol type</param>
205+
/// <param name="minPort">Output parameter for minimum port in the range</param>
206+
/// <param name="maxPort">Output parameter for maximum port in the range</param>
207+
/// <returns>True if custom range is configured, false if using default allocation</returns>
208+
bool GetPortRange(CoreWebView2WebRtcProtocolKind protocol, out uint minPort, out uint maxPort);
209+
}
210+
211+
/// <summary>
212+
/// Additional options used to create WebView2 Environment to manage WebRTC port range configuration.
213+
/// </summary>
214+
public interface ICoreWebView2EnvironmentOptions
215+
{
216+
/// <summary>
217+
/// Gets the WebRTC port configuration object for configuring custom port ranges.
218+
/// This configuration can be used to set and retrieve port range configuration
219+
/// that WebRTC will use for ICE candidates and media connections.
220+
/// </summary>
221+
ICoreWebView2WebRtcPortConfiguration WebRtcPortConfiguration { get; }
222+
}
223+
```
154224

155225
# Appendix
226+
156227
Validation rules: Ports must be within 1025–65535. Calls with invalid ranges return E_INVALIDARG.
157228
Default behavior: If no range is configured, WebRTC uses the OS ephemeral port range.
158229
Thread safety: Configuration must be completed before the environment is created.

0 commit comments

Comments
 (0)