internal override void OnDetached(WebRTC webRtc) { NativeWebRTC.RemoveMediaSource(webRtc.Handle, SourceId.Value). ThrowIfFailed("Failed to remove MediaMicrophoneSource."); WebRtc = (WebRTC)null; }
internal override void OnDetached(WebRTC webRtc) { NativeWebRTC.RemoveMediaSource(webRtc.Handle, SourceId.Value). ThrowIfFailed($"Failed to remove {MediaType.ToString()} MediaCustomSource."); WebRtc = null; }
internal override void OnAttached(WebRTC webRtc) { Debug.Assert(webRtc != null); if (WebRtc != null) { Log.Error(WebRTCLog.Tag, "The source is has already been assigned to another WebRTC."); throw new InvalidOperationException("The source is has already been assigned to another WebRTC."); } NativeWebRTC.AddMediaSource(webRtc.Handle, MediaSourceType.Microphone, out uint sourceId). ThrowIfFailed("Failed to add MediaMicrophoneSource."); WebRtc = webRtc; SourceId = sourceId; }
internal override void OnAttached(WebRTC webRtc) { Debug.Assert(webRtc != null); if (WebRtc != null) { throw new InvalidOperationException("The source is has already been assigned to another WebRTC."); } var type = MediaType == MediaType.Video ? CustomMediaSourceType.Video : CustomMediaSourceType.Audio; NativeWebRTC.AddCustomMediaSource(webRtc.Handle, type, out uint sourceId). ThrowIfFailed($"Failed to add {MediaType.ToString()} MediaCustomSource."); WebRtc = webRtc; SourceId = sourceId; }
/// <summary> /// Applies the audio stream policy to <see cref="MediaMicrophoneSource"/>. /// </summary> /// <param name="policy">The <see cref="AudioStreamPolicy"/> to apply.</param> /// <remarks> /// The WebRTC must be in the <see cref="WebRTCState.Idle"/> state.<br/> /// <br/> /// <see cref="WebRTC"/> does not support all <see cref="AudioStreamType"/>.<br/> /// Supported types are <see cref="AudioStreamType.Media"/>, <see cref="AudioStreamType.VoiceRecognition"/>, /// <see cref="AudioStreamType.Voip"/>, <see cref="AudioStreamType.MediaExternalOnly"/>. /// </remarks> /// <exception cref="ObjectDisposedException"> /// The WebRTC has already been disposed.<br/> /// -or-<br/> /// <paramref name="policy"/> has already been disposed. /// </exception> /// <exception cref="InvalidOperationException">The WebRTC is not in the valid state.</exception> /// <exception cref="ArgumentNullException"><paramref name="policy"/> is null.</exception> /// <exception cref="NotSupportedException"> /// <see cref="AudioStreamType"/> of <paramref name="policy"/> is not supported on the current platform. /// </exception> /// <seealso cref="AudioStreamPolicy"/> /// <since_tizen> 9 </since_tizen> public void ApplyAudioStreamPolicy(AudioStreamPolicy policy) { if (policy == null) { throw new ArgumentNullException(nameof(policy), "policy is null"); } WebRtc.ValidateWebRTCState(WebRTCState.Idle); var ret = NativeWebRTC.SetAudioStreamPolicyToMicrophoneSource(WebRtc.Handle, SourceId.Value, policy.Handle); if (ret == WebRTCErrorCode.InvalidArgument) { throw new NotSupportedException("The specified policy is not supported on the current system."); } ret.ThrowIfFailed("Failed to set the audio stream policy to the WebRTC"); }
internal override void OnAttached(WebRTC webRtc) { Debug.Assert(webRtc != null); if (WebRtc != null) { throw new InvalidOperationException("The source is has already been assigned to another WebRTC."); } NativeWebRTC.AddMediaSource(webRtc.Handle, MediaSourceType.File, out uint sourceId). ThrowIfFailed("Failed to add MediaFileSource."); NativeWebRTC.SetFileSourcePath(webRtc.Handle, sourceId, _path). ThrowIfFailed("Failed to set path for MediaFileSource."); WebRtc = webRtc; SourceId = sourceId; }