public void OnAddTrack(Webrtc.RtpReceiver p0, Webrtc.MediaStream[] p1) { var track = p0.Track(); if (track.Kind() == Webrtc.MediaStreamTrack.AudioTrackKind) { var audioTrack = track as AudioTrack; audioTrack.SetEnabled(true); audioTrack.SetVolume(10); } OnTrack?.Invoke(this, RTCTrackEvent.Create(p0, p1)); }
public void DidAddStream(Webrtc.RTCPeerConnection peerConnection, Webrtc.RTCMediaStream stream) { // Depreceted. Convert to OnTrack. foreach (var track in stream.VideoTracks) { OnTrack?.Invoke(this, RTCTrackEvent.Create(track)); } foreach (var track in stream.AudioTracks) { OnTrack?.Invoke(this, RTCTrackEvent.Create(track)); } }
private RTCPeerConnection(IJSRuntime jsRuntime, JsObjectRef jsObjectRef, RTCConfiguration rtcConfiguration) : base(jsRuntime, jsObjectRef) { AddNativeEventListener("connectionstatechange", (s, e) => OnConnectionStateChanged?.Invoke(s, e)); AddNativeEventListenerForObjectRef("datachannel", (s, e) => OnDataChannel?.Invoke(s, e), RTCDataChannelEvent.Create); AddNativeEventListenerForObjectRef("icecandidate", (s, e) => OnIceCandidate?.Invoke(s, e), RTCPeerConnectionIceEvent.Create); AddNativeEventListener("iceconnectionstatechange", (s, e) => OnIceConnectionStateChange?.Invoke(s, e)); AddNativeEventListener("icegatheringstatechange", (s, e) => OnIceGatheringStateChange?.Invoke(s, e)); AddNativeEventListener("negotiationneeded", (s, e) => OnNegotiationNeeded?.Invoke(s, e)); AddNativeEventListener("signallingstatechange", (s, e) => OnSignallingStateChange?.Invoke(s, e)); AddNativeEventListenerForObjectRef("track", (s, e) => OnTrack?.Invoke(s, e), RTCTrackEvent.Create); }