RTCRTPSender
The corresponding JS API docs is here RTCRTPSender.
The RTCRtpSender interface provides the ability to control and obtain details about how a particular MediaStreamTrackis encoded and transmitted to a remote peer.
Methods#
setParameters:Sets the encoding parameters for theMediaStreamTrackassociated with thisRTCRtpSender.
var sender = pc.getSenders().firstWhere((s) => s.track.kind == 'video');var params = sender.parameters; params.degradationPreference = RTCDegradationPreference.MAINTAIN_RESOLUTION;await sender.setParameters(params);replaceTrack:replaces theMediaStreamTrackassociated with thisRTCRtpSenderwith a newMediaStreamTrack.
/// Example usage:var stream = await navigator.mediaDevices.getUserMedia({video: true});var videoTrack = stream.getVideoTracks()[0];var sender = pc.getSenders().firstWhere((s) => s.track.kind == 'video');/// Replace the video track with a new video tracksender.replaceTrack(sender, newVideoTrack);setTrack:TheRTCRtpSendermethod setStreams() associates the sender's track with the specifiedMediaStreamTrackobjects.
var stream = await navigator.mediaDevices.getUserMedia({video: true});var videoTrack = stream.getVideoTracks()[0];sender.setTrack(videoTrack,{takeOwnership: true});getStats:The RTCRtpSender methodgetStats()asynchronously requests an RTCStatsReport object which provides statistics about outgoing traffic on theRTCPeerConnectionwhich owns the sender, returning a Promise which is fulfilled when the results are available.
var sender = pc.getSenders().firstWhere((s) => s.track.kind == 'video');sender.getStats().then((stats) => { print('statsId is+ ${stats.id}');});setStreams:TheRTCRtpSendermethod setStreams() associates the sender's track with the specifiedMediaStreamobjects.
var stream = await navigator.mediaDevices.getUserMedia({video: true});var sender = pc.getSenders().firstWhere((s) => s.track.kind == 'video');sender.setStreams(stream);dispose:TheRTCRtpSendermethoddispose()closes theRTCRtpSenderand releases any associated resources.
sender.dispose();Properties#
paramters:TheRTCRtpSenderproperty RTCRTPParameters is an object describing the current configuration for the encoding and transmission of media on the track.
var sender = pc.getSenders().firstWhere((s) => s.track.kind == 'video');var parameters = sender.parameters;print('transactionId is ${parameters.transactionId}');track: The track property of the RTCRtpSender interface returns the MediaStreamTrack which is being handled by the RTCRtpSender.senderId: The senderId property of the RTCRtpSender interface returns a unique identifier for the RTCRtpSender.ownsTrack: The ownsTrack property of the RTCRtpSender interface returns a boolean value indicating whether the RTCRtpSender owns the track.dtmfSender: The dtmfSender property of the RTCRtpSender interface returns an RTCDTMFSender object which can be used to send DTMF tones using the track associated with the RTCRtpSender. RegardingRTCDTMFsender, please refer to: