/// </remarks>
/// <exception cref="ObjectDisposedException">The WebRTC has already been disposed of.</exception>
/// <exception cref="ArgumentException">The value has already been assigned to another WebRTC.</exception>
- /// <exception cref="InvalidOperationException">The WebRTC is not called in <see cref="WebRTC.TrackAdded"/> event.</exception>
+ /// <exception cref="InvalidOperationException">
+ /// The WebRTC is not called in <see cref="WebRTC.TrackAdded"/> event.
+ /// -or-<br/>
+ /// This MediaStreamTrack is not Video.
+ /// </exception>
/// <since_tizen> 9 </since_tizen>
public Display Display
{
get => _display;
set
{
+ if (Type != MediaType.Video)
+ {
+ throw new InvalidOperationException("This property is only for video.");
+ }
+
if (value == null)
{
throw new ArgumentNullException(nameof(value), "Display cannot be null.");
/// </remarks>
/// <value>A <see cref="WebRTCDisplayMode"/> that specifies the display mode.</value>
/// <exception cref="ArgumentException">Display mode type is incorrect.</exception>
+ /// <exception cref="InvalidOperationException"><see cref="Display"/> is not set.</exception>
/// <since_tizen> 9 </since_tizen>
public WebRTCDisplayMode DisplayMode
{
/// <remarks>
/// This property is meaningful only in overlay or EVAS surface display type.
/// </remarks>
+ /// <exception cref="InvalidOperationException"><see cref="Display"/> is not set.</exception>
/// <since_tizen> 9 </since_tizen>
public bool DisplayVisible
{
get
{
- NativeWebRTC.GetDisplayVisible(_webRtc.Handle, _trackId,out bool val).
+ NativeWebRTC.GetDisplayVisible(_webRtc.Handle, _trackId, out bool val).
ThrowIfFailed("Failed to get visible status");
return val;
/// <see cref="WebRTC.AudioFrameEncoded"/> was set.<br/>
/// -or-<br/>
/// This method was not called in <see cref="WebRTC.TrackAdded"/> event.
+ /// -or-<br/>
+ /// This MediaStreamTrack is not Audio.
/// </exception>
/// <exception cref="NotSupportedException">
/// <see cref="AudioStreamType"/> of <paramref name="policy"/> is not supported on the current platform.
/// <summary>
/// Releases all resources used by the current instance.
/// </summary>
- /// <exception cref="ObjectDisposedException">The WebRTC has already been disposed.</exception>
/// <since_tizen> 9 </since_tizen>
public void Dispose()
{
if (_handle != null)
{
- UnregisterEvents();
_handle.Dispose();
_disposed = true;
}
NativeWebRTC.Stop(Handle).ThrowIfFailed("Failed to stop the WebRTC");
}
- /// <summary>
- /// Creates SDP offer to start a new WebRTC connection to a remote peer.
- /// </summary>
- /// <remarks>The WebRTC must be in the <see cref="WebRTCState.Negotiating"/></remarks>
- /// <returns>The SDP offer.</returns>
- /// <exception cref="InvalidOperationException">The WebRTC is not in the valid state.</exception>
- /// <exception cref="ObjectDisposedException">The WebRTC has already been disposed.</exception>
- /// <seealso cref="CreateOfferAsync()"/>
- /// <since_tizen> 9 </since_tizen>
- public string CreateOffer()
- {
- ValidateWebRTCState(WebRTCState.Negotiating);
-
- NativeWebRTC.CreateSDPOffer(Handle, new SafeBundleHandle(), out string offer).
- ThrowIfFailed("Failed to create offer");
-
- return offer;
- }
-
/// <summary>
/// Creates SDP offer asynchronously to start a new WebRTC connection to a remote peer.
/// </summary>
/// <returns>The SDP offer.</returns>
/// <exception cref="InvalidOperationException">The WebRTC is not in the valid state.</exception>
/// <exception cref="ObjectDisposedException">The WebRTC has already been disposed.</exception>
- /// <seealso cref="CreateOffer()"/>
+ /// <seealso cref="CreateAnswerAsync()"/>
/// <since_tizen> 9 </since_tizen>
public async Task<string> CreateOfferAsync()
{
return offer;
}
- /// <summary>
- /// Creates SDP answer to an offer received from a remote peer.
- /// </summary>
- /// <remarks>
- /// The WebRTC must be in the <see cref="WebRTCState.Negotiating"/>.<br/>
- /// The SDP offer must be set by <see cref="SetRemoteDescription"/> before creating answer.
- /// </remarks>
- /// <returns>The SDP answer.</returns>
- /// <exception cref="InvalidOperationException">The WebRTC is not in the valid state.</exception>
- /// <exception cref="ObjectDisposedException">The WebRTC has already been disposed.</exception>
- /// <seealso cref="CreateAnswerAsync()"/>
- /// <seealso cref="SetRemoteDescription(string)"/>
- /// <since_tizen> 9 </since_tizen>
- public string CreateAnswer()
- {
- ValidateWebRTCState(WebRTCState.Negotiating);
-
- NativeWebRTC.CreateSDPAnswer(Handle, new SafeBundleHandle(), out string answer).
- ThrowIfFailed("Failed to create answer");
-
- return answer;
- }
-
/// <summary>
/// Creates SDP answer asynchronously with option to an offer received from a remote peer.
/// </summary>
/// <returns>The SDP answer.</returns>
/// <exception cref="InvalidOperationException">The WebRTC is not in the valid state.</exception>
/// <exception cref="ObjectDisposedException">The WebRTC has already been disposed.</exception>
- /// <seealso cref="CreateAnswer()"/>
+ /// <seealso cref="CreateOfferAsync()"/>
/// <since_tizen> 9 </since_tizen>
public async Task<string> CreateAnswerAsync()
{
/// <exception cref="ArgumentNullException">The description is null.</exception>
/// <exception cref="InvalidOperationException">The WebRTC is not in the valid state.</exception>
/// <exception cref="ObjectDisposedException">The WebRTC has already been disposed.</exception>
- /// <seealso cref="CreateOffer()"/>
- /// <seealso cref="CreateAnswer()"/>
+ /// <seealso cref="CreateOfferAsync()"/>
+ /// <seealso cref="CreateAnswerAsync()"/>
/// <since_tizen> 9 </since_tizen>
public void SetLocalDescription(string description)
{
/// <exception cref="ArgumentNullException">The description is null.</exception>
/// <exception cref="InvalidOperationException">The WebRTC is not in the valid state.</exception>
/// <exception cref="ObjectDisposedException">The WebRTC has already been disposed.</exception>
- /// <seealso cref="CreateOffer()"/>
- /// <seealso cref="CreateAnswer()"/>
+ /// <seealso cref="CreateOfferAsync()"/>
+ /// <seealso cref="CreateAnswerAsync()"/>
/// <since_tizen> 9 </since_tizen>
public void SetRemoteDescription(string description)
{
/// The WebRTC must be in the <see cref="WebRTCState.Idle"/>.<br/>
/// Each MediaSource requires different feature or privilege.<br/>
/// <see cref="MediaCameraSource"/> needs camera feature and privilege.<br/>
- /// <see cref="MediaFileSource"/> needs mediastorage or externalstorage privilege.<br/>
/// <see cref="MediaMicrophoneSource"/> needs microphone feature and recorder privilege.<br/>
/// </remarks>
/// <param name="source">The media sources to add.</param>
/// The WebRTC must be in the <see cref="WebRTCState.Idle"/>.<br/>
/// Each MediaSource requires different feature or privilege.<br/>
/// <see cref="MediaCameraSource"/> needs camera feature and privilege.<br/>
- /// <see cref="MediaFileSource"/> needs mediastorage or externalstorage privilege.<br/>
/// <see cref="MediaMicrophoneSource"/> needs microphone feature and recorder privilege.<br/>
/// </remarks>
/// <param name="sources">The media sources to add.</param>