webkit  2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
Instance Methods | Class Methods | Public Attributes | Properties | List of all members
RTCPeerConnection Class Reference

#import <RTCPeerConnection.h>

Inheritance diagram for RTCPeerConnection:
EventTarget NSObject NSObject

Instance Methods

(instancetype) - NS_UNAVAILABLE
 
(BOOL) - setConfiguration:
 
(void) - close
 
(void) - addIceCandidate:
 
(void) - removeIceCandidates:
 
(void) - addStream:
 
(void) - removeStream:
 
(void) - offerForConstraints:completionHandler:
 
(void) - answerForConstraints:completionHandler:
 
(void) - setLocalDescription:completionHandler:
 
(void) - setRemoteDescription:completionHandler:
 
(BOOL) - startRtcEventLogWithFilePath:maxSizeInBytes:
 
(void) - stopRtcEventLog
 
(instancetype) - NS_UNAVAILABLE
 
(BOOL) - setConfiguration:
 
(void) - close
 
(void) - addIceCandidate:
 
(void) - removeIceCandidates:
 
(void) - addStream:
 
(void) - removeStream:
 
(void) - offerForConstraints:completionHandler:
 
(void) - answerForConstraints:completionHandler:
 
(void) - setLocalDescription:completionHandler:
 
(void) - setRemoteDescription:completionHandler:
 
(BOOL) - startRtcEventLogWithFilePath:maxSizeInBytes:
 
(void) - stopRtcEventLog
 
(void) - initializeWith
 
(sequence< RTCRtpSender >) - getSenders
 
(sequence< RTCRtpReceiver >) - getReceivers
 
(sequence< RTCRtpTransceiver >) - getTransceivers
 
(RTCRtpSender) - addTrack
 
(void) - removeTrack
 
(RTCRtpTransceiver) - addTransceiver
 
(RTCRtpTransceiver) - addTransceiver
 
(sequence< MediaStream >) - getLocalStreams
 
(sequence< MediaStream >) - getRemoteStreams
 
(MediaStream) - getStreamById
 
(void) - addStream
 
(void) - removeStream
 
(Promise< RTCSessionDescriptionInit >) - createOffer
 
(Promise< RTCSessionDescriptionInit >) - createAnswer
 
(Promise< void >) - setLocalDescription
 
(Promise< void >) - setRemoteDescription
 
(Promise< void >) - addIceCandidate
 
(RTCConfiguration) - getConfiguration
 
(void) - setConfiguration
 
(Promise< RTCStatsReport >) - getStats
 
(Promise< RTCSessionDescriptionInit >) - queuedCreateOffer
 
(Promise< RTCSessionDescriptionInit >) - queuedCreateAnswer
 
(Promise< void >) - queuedSetLocalDescription
 
(Promise< void >) - queuedSetRemoteDescription
 
(Promise< void >) - queuedAddIceCandidate
 
(RTCDataChannel) - createDataChannel
 
(void) - close
 
(instancetype) - initWithFactory:configuration:constraints:delegate: [implementation]
 
(instancetype) - initWithFactory:configuration:constraints:delegate: [implementation]
 
(RTCDataChannel *) - dataChannelForLabel:configuration:
 
(RTCDataChannel *) - dataChannelForLabel:configuration:
 
(RTCRtpSender *) - senderWithKind:streamId:
 
(RTCRtpSender *) - senderWithKind:streamId:
 
(void) - statsForTrack:statsOutputLevel:completionHandler:
 
(void) - statsForTrack:statsOutputLevel:completionHandler:
 
- Instance Methods inherited from EventTarget
void addEventListener ([AtomicString] DOMString type, EventListener? callback, optional(AddEventListenerOptions or boolean) options=false)
 
void removeEventListener ([AtomicString] DOMString type, EventListener? callback, optional(EventListenerOptions or boolean) options=false)
 
boolean dispatchEvent (Event event)
 

Class Methods

(webrtc::PeerConnectionInterface::SignalingState) + nativeSignalingStateForState: [implementation]
 
(webrtc::PeerConnectionInterface::SignalingState) + nativeSignalingStateForState: [implementation]
 
(RTCSignalingState) + signalingStateForNativeState: [implementation]
 
(RTCSignalingState) + signalingStateForNativeState: [implementation]
 
(NSString *) + stringForSignalingState: [implementation]
 
(NSString *) + stringForSignalingState: [implementation]
 
(webrtc::PeerConnectionInterface::IceConnectionState) + nativeIceConnectionStateForState: [implementation]
 
(webrtc::PeerConnectionInterface::IceConnectionState) + nativeIceConnectionStateForState: [implementation]
 
(RTCIceConnectionState) + iceConnectionStateForNativeState: [implementation]
 
(RTCIceConnectionState) + iceConnectionStateForNativeState: [implementation]
 
(NSString *) + stringForIceConnectionState: [implementation]
 
(NSString *) + stringForIceConnectionState: [implementation]
 
(webrtc::PeerConnectionInterface::IceGatheringState) + nativeIceGatheringStateForState: [implementation]
 
(webrtc::PeerConnectionInterface::IceGatheringState) + nativeIceGatheringStateForState: [implementation]
 
(RTCIceGatheringState) + iceGatheringStateForNativeState: [implementation]
 
(RTCIceGatheringState) + iceGatheringStateForNativeState: [implementation]
 
(NSString *) + stringForIceGatheringState: [implementation]
 
(NSString *) + stringForIceGatheringState: [implementation]
 
(webrtc::PeerConnectionInterface::StatsOutputLevel) + nativeStatsOutputLevelForLevel: [implementation]
 
(webrtc::PeerConnectionInterface::StatsOutputLevel) + nativeStatsOutputLevelForLevel: [implementation]
 

Public Attributes

readonly attribute RTCSessionDescription localDescription
 
readonly attribute RTCSessionDescription currentLocalDescription
 
readonly attribute RTCSessionDescription pendingLocalDescription
 
readonly attribute RTCSessionDescription remoteDescription
 
readonly attribute RTCSessionDescription currentRemoteDescription
 
readonly attribute RTCSessionDescription pendingRemoteDescription
 
readonly attribute DOMString signalingState
 
readonly attribute DOMString iceGatheringState
 
readonly attribute DOMString iceConnectionState
 
attribute EventHandler onnegotiationneeded
 
attribute EventHandler onicecandidate
 
attribute EventHandler onsignalingstatechange
 
attribute EventHandler ontrack
 
attribute EventHandler oniceconnectionstatechange
 
attribute EventHandler onicegatheringstatechange
 
attribute EventHandler ondatachannel
 
attribute EventHandler onaddstream
 

Properties

id< RTCPeerConnectionDelegate > delegate
 
NSArray< RTCMediaStream * > * localStreams
 
RTCSessionDescription * localDescription
 
RTCSessionDescription * remoteDescription
 
RTCSignalingState signalingState
 
RTCIceConnectionState iceConnectionState
 
RTCIceGatheringState iceGatheringState
 
NSArray< RTCRtpSender * > * senders
 
NSArray< RTCRtpReceiver * > * receivers
 
rtc::scoped_refptr< webrtc::PeerConnectionInterface > nativePeerConnection [implementation]
 

Method Documentation

◆ addIceCandidate()

- (Promise<void>) addIceCandidate (RTCIceCandidate)  candidate

◆ addIceCandidate:() [1/2]

- (void) addIceCandidate: (RTCIceCandidate *)  candidate

Provide a remote candidate to the ICE Agent.

◆ addIceCandidate:() [2/2]

- (void) addIceCandidate: (RTCIceCandidate *)  candidate

Provide a remote candidate to the ICE Agent.

◆ addStream()

- (void) addStream (MediaStream)  stream

◆ addStream:() [1/2]

- (void) addStream: (RTCMediaStream *)  stream

Add a new media stream to be sent on this peer connection.

◆ addStream:() [2/2]

- (void) addStream: (RTCMediaStream *)  stream

Add a new media stream to be sent on this peer connection.

◆ addTrack()

- (RTCRtpSender) addTrack (MediaStreamTrack)  track
(MediaStream...)  streams 

◆ addTransceiver() [1/2]

- (RTCRtpTransceiver) addTransceiver (MediaStreamTrack)  track
(optional RTCRtpTransceiverInit)  init 

◆ addTransceiver() [2/2]

- (RTCRtpTransceiver) addTransceiver (DOMString)  kind
(optional RTCRtpTransceiverInit)  init 

◆ answerForConstraints:completionHandler:() [1/2]

- (void) answerForConstraints: (RTCMediaConstraints *)  constraints
completionHandler: (nullable void(^)(RTCSessionDescription *_Nullable sdp, NSError *_Nullable error))  completionHandler 

Generate an SDP answer.

◆ answerForConstraints:completionHandler:() [2/2]

- (void) answerForConstraints: (RTCMediaConstraints *)  constraints
completionHandler: (nullable void(^)(RTCSessionDescription *_Nullable sdp, NSError *_Nullable error))  completionHandler 

Generate an SDP answer.

◆ close() [1/3]

- (void) close

◆ close() [2/3]

- (void) close

Terminate all media and close the transport.

◆ close() [3/3]

- (void) close

Terminate all media and close the transport.

◆ createAnswer()

- (Promise<RTCSessionDescriptionInit>) createAnswer (optional RTCAnswerOptions)  answerOptions

◆ createDataChannel()

- (RTCDataChannel) createDataChannel (DOMString)  label
(optional RTCDataChannelInit)  options 

◆ createOffer()

- (Promise<RTCSessionDescriptionInit>) createOffer (optional RTCOfferOptions)  offerOptions

◆ dataChannelForLabel:configuration:() [1/2]

- (RTCDataChannel *) dataChannelForLabel: (NSString *)  label
configuration: (RTCDataChannelConfiguration *)  configuration 

Create a new data channel with the given label and configuration.

Provided by category RTCPeerConnection(DataChannel).

◆ dataChannelForLabel:configuration:() [2/2]

- (RTCDataChannel *) dataChannelForLabel: (NSString *)  label
configuration: (RTCDataChannelConfiguration *)  configuration 

Create a new data channel with the given label and configuration.

Provided by category RTCPeerConnection(DataChannel).

◆ getConfiguration()

- (RTCConfiguration) getConfiguration

◆ getLocalStreams()

- (sequence<MediaStream>) getLocalStreams

◆ getReceivers()

- (sequence<RTCRtpReceiver>) getReceivers

◆ getRemoteStreams()

- (sequence<MediaStream>) getRemoteStreams

◆ getSenders()

- (sequence<RTCRtpSender>) getSenders

◆ getStats()

- (Promise<RTCStatsReport>) getStats (optional MediaStreamTrack?)  selector = null

◆ getStreamById()

- (MediaStream) getStreamById (DOMString)  streamId

◆ getTransceivers()

- (sequence<RTCRtpTransceiver>) getTransceivers

◆ iceConnectionStateForNativeState:() [1/2]

+ (RTCIceConnectionState) iceConnectionStateForNativeState: (webrtc::PeerConnectionInterface::IceConnectionState)  nativeState
implementation

◆ iceConnectionStateForNativeState:() [2/2]

+ (RTCIceConnectionState) iceConnectionStateForNativeState: (webrtc::PeerConnectionInterface::IceConnectionState)  nativeState
implementation

◆ iceGatheringStateForNativeState:() [1/2]

+ (RTCIceGatheringState) iceGatheringStateForNativeState: (webrtc::PeerConnectionInterface::IceGatheringState)  nativeState
implementation

◆ iceGatheringStateForNativeState:() [2/2]

+ (RTCIceGatheringState) iceGatheringStateForNativeState: (webrtc::PeerConnectionInterface::IceGatheringState)  nativeState
implementation

◆ initializeWith()

- (void) initializeWith (RTCConfiguration)  configuration

◆ initWithFactory:configuration:constraints:delegate:() [1/2]

- (instancetype) initWithFactory: (RTCPeerConnectionFactory *)  factory
configuration: (RTCConfiguration *)  configuration
constraints: (RTCMediaConstraints *)  constraints
delegate: (nullable id< RTCPeerConnectionDelegate >)  NS_DESIGNATED_INITIALIZER 
implementation

Initialize an RTCPeerConnection with a configuration, constraints, and delegate.

◆ initWithFactory:configuration:constraints:delegate:() [2/2]

- (instancetype) initWithFactory: (RTCPeerConnectionFactory *)  factory
configuration: (RTCConfiguration *)  configuration
constraints: (RTCMediaConstraints *)  constraints
delegate: (nullable id< RTCPeerConnectionDelegate >)  NS_DESIGNATED_INITIALIZER 
implementation

Initialize an RTCPeerConnection with a configuration, constraints, and delegate.

◆ nativeIceConnectionStateForState:() [1/2]

+ PeerConnectionInterface: (RTCIceConnectionState)  state
implementation

◆ nativeIceConnectionStateForState:() [2/2]

+ PeerConnectionInterface: (RTCIceConnectionState)  state
implementation

◆ nativeIceGatheringStateForState:() [1/2]

+ PeerConnectionInterface: (RTCIceGatheringState)  state
implementation

◆ nativeIceGatheringStateForState:() [2/2]

+ PeerConnectionInterface: (RTCIceGatheringState)  state
implementation

◆ nativeSignalingStateForState:() [1/2]

+ PeerConnectionInterface: (RTCSignalingState)  state
implementation

◆ nativeSignalingStateForState:() [2/2]

+ PeerConnectionInterface: (RTCSignalingState)  state
implementation

◆ nativeStatsOutputLevelForLevel:() [1/2]

+ PeerConnectionInterface: (RTCStatsOutputLevel)  level
implementation

◆ nativeStatsOutputLevelForLevel:() [2/2]

+ PeerConnectionInterface: (RTCStatsOutputLevel)  level
implementation

◆ NS_UNAVAILABLE() [1/2]

- (instancetype) NS_UNAVAILABLE

◆ NS_UNAVAILABLE() [2/2]

- (instancetype) NS_UNAVAILABLE

◆ offerForConstraints:completionHandler:() [1/2]

- (void) offerForConstraints: (RTCMediaConstraints *)  constraints
completionHandler: (nullable void(^)(RTCSessionDescription *_Nullable sdp, NSError *_Nullable error))  completionHandler 

Generate an SDP offer.

◆ offerForConstraints:completionHandler:() [2/2]

- (void) offerForConstraints: (RTCMediaConstraints *)  constraints
completionHandler: (nullable void(^)(RTCSessionDescription *_Nullable sdp, NSError *_Nullable error))  completionHandler 

Generate an SDP offer.

◆ queuedAddIceCandidate()

- (Promise<void>) queuedAddIceCandidate (RTCIceCandidate)  candidate

◆ queuedCreateAnswer()

- (Promise<RTCSessionDescriptionInit>) queuedCreateAnswer (optional RTCAnswerOptions)  answerOptions

◆ queuedCreateOffer()

- (Promise<RTCSessionDescriptionInit>) queuedCreateOffer (optional RTCOfferOptions)  offerOptions

◆ queuedSetLocalDescription()

- (Promise<void>) queuedSetLocalDescription (RTCSessionDescription)  description

◆ queuedSetRemoteDescription()

- (Promise<void>) queuedSetRemoteDescription (RTCSessionDescription)  description

◆ removeIceCandidates:() [1/2]

- (void) removeIceCandidates: (NSArray<RTCIceCandidate *> *)  candidates

Remove a group of remote candidates from the ICE Agent.

◆ removeIceCandidates:() [2/2]

- (void) removeIceCandidates: (NSArray< RTCIceCandidate * > *)  candidates

Remove a group of remote candidates from the ICE Agent.

◆ removeStream()

- (void) removeStream (MediaStream)  stream

◆ removeStream:() [1/2]

- (void) removeStream: (RTCMediaStream *)  stream

Remove the given media stream from this peer connection.

◆ removeStream:() [2/2]

- (void) removeStream: (RTCMediaStream *)  stream

Remove the given media stream from this peer connection.

◆ removeTrack()

- (void) removeTrack (RTCRtpSender)  sender

◆ senderWithKind:streamId:() [1/2]

- (RTCRtpSender *) senderWithKind: (NSString *)  kind
streamId: (NSString *)  streamId 

Create an RTCRtpSender with the specified kind and media stream ID. See RTCMediaStreamTrack.h for available kinds.

Provided by category RTCPeerConnection(Media).

◆ senderWithKind:streamId:() [2/2]

- (RTCRtpSender *) senderWithKind: (NSString *)  kind
streamId: (NSString *)  streamId 

Create an RTCRtpSender with the specified kind and media stream ID. See RTCMediaStreamTrack.h for available kinds.

Provided by category RTCPeerConnection(Media).

◆ setConfiguration()

- (void) setConfiguration (RTCConfiguration)  configuration

◆ setConfiguration:() [1/2]

- (BOOL) setConfiguration: (RTCConfiguration *)  configuration

Sets the PeerConnection's global configuration to |configuration|. Any changes to STUN/TURN servers or ICE candidate policy will affect the next gathering phase, and cause the next call to createOffer to generate new ICE credentials. Note that the BUNDLE and RTCP-multiplexing policies cannot be changed with this method.

◆ setConfiguration:() [2/2]

- (BOOL) setConfiguration: (RTCConfiguration *)  configuration

Sets the PeerConnection's global configuration to |configuration|. Any changes to STUN/TURN servers or ICE candidate policy will affect the next gathering phase, and cause the next call to createOffer to generate new ICE credentials. Note that the BUNDLE and RTCP-multiplexing policies cannot be changed with this method.

◆ setLocalDescription()

- (Promise<void>) setLocalDescription (RTCSessionDescription)  description

◆ setLocalDescription:completionHandler:() [1/2]

- (void) setLocalDescription: (RTCSessionDescription *)  sdp
completionHandler: (nullable void(^)(NSError *_Nullable error))  completionHandler 

Apply the supplied RTCSessionDescription as the local description.

◆ setLocalDescription:completionHandler:() [2/2]

- (void) setLocalDescription: (RTCSessionDescription *)  sdp
completionHandler: (nullable void(^)(NSError *_Nullable error))  completionHandler 

Apply the supplied RTCSessionDescription as the local description.

◆ setRemoteDescription()

- (Promise<void>) setRemoteDescription (RTCSessionDescription)  description

◆ setRemoteDescription:completionHandler:() [1/2]

- (void) setRemoteDescription: (RTCSessionDescription *)  sdp
completionHandler: (nullable void(^)(NSError *_Nullable error))  completionHandler 

Apply the supplied RTCSessionDescription as the remote description.

◆ setRemoteDescription:completionHandler:() [2/2]

- (void) setRemoteDescription: (RTCSessionDescription *)  sdp
completionHandler: (nullable void(^)(NSError *_Nullable error))  completionHandler 

Apply the supplied RTCSessionDescription as the remote description.

◆ signalingStateForNativeState:() [1/2]

+ (RTCSignalingState) signalingStateForNativeState: (webrtc::PeerConnectionInterface::SignalingState)  nativeState
implementation

◆ signalingStateForNativeState:() [2/2]

+ (RTCSignalingState) signalingStateForNativeState: (webrtc::PeerConnectionInterface::SignalingState)  nativeState
implementation

◆ startRtcEventLogWithFilePath:maxSizeInBytes:() [1/2]

- (BOOL) startRtcEventLogWithFilePath: (NSString *)  filePath
maxSizeInBytes: (int64_t)  maxSizeInBytes 

Start or stop recording an Rtc EventLog.

◆ startRtcEventLogWithFilePath:maxSizeInBytes:() [2/2]

- (BOOL) startRtcEventLogWithFilePath: (NSString *)  filePath
maxSizeInBytes: (int64_t)  maxSizeInBytes 

Start or stop recording an Rtc EventLog.

◆ statsForTrack:statsOutputLevel:completionHandler:() [1/2]

- (void) statsForTrack: (nullable RTCMediaStreamTrack *)  mediaStreamTrack
statsOutputLevel: (RTCStatsOutputLevel)  statsOutputLevel
completionHandler: (nullable void(^)(NSArray< RTCLegacyStatsReport * > *stats))  completionHandler 

Gather stats for the given RTCMediaStreamTrack. If |mediaStreamTrack| is nil statistics are gathered for all tracks.

Provided by category RTCPeerConnection(Stats).

◆ statsForTrack:statsOutputLevel:completionHandler:() [2/2]

- (void) statsForTrack: (nullable RTCMediaStreamTrack *)  mediaStreamTrack
statsOutputLevel: (RTCStatsOutputLevel)  statsOutputLevel
completionHandler: (nullable void(^)(NSArray< RTCLegacyStatsReport * > *stats))  completionHandler 

Gather stats for the given RTCMediaStreamTrack. If |mediaStreamTrack| is nil statistics are gathered for all tracks.

Provided by category RTCPeerConnection(Stats).

◆ stopRtcEventLog() [1/2]

- (void) stopRtcEventLog

◆ stopRtcEventLog() [2/2]

- (void) stopRtcEventLog

◆ stringForIceConnectionState:() [1/2]

+ (NSString *) stringForIceConnectionState: (RTCIceConnectionState)  state
implementation

◆ stringForIceConnectionState:() [2/2]

+ (NSString *) stringForIceConnectionState: (RTCIceConnectionState)  state
implementation

◆ stringForIceGatheringState:() [1/2]

+ (NSString *) stringForIceGatheringState: (RTCIceGatheringState)  state
implementation

◆ stringForIceGatheringState:() [2/2]

+ (NSString *) stringForIceGatheringState: (RTCIceGatheringState)  state
implementation

◆ stringForSignalingState:() [1/2]

+ (NSString *) stringForSignalingState: (RTCSignalingState)  state
implementation

◆ stringForSignalingState:() [2/2]

+ (NSString *) stringForSignalingState: (RTCSignalingState)  state
implementation

Member Data Documentation

◆ currentLocalDescription

- (readonly attribute RTCSessionDescription) currentLocalDescription

◆ currentRemoteDescription

- (readonly attribute RTCSessionDescription) currentRemoteDescription

◆ iceConnectionState

- (readonly attribute DOMString) iceConnectionState

◆ iceGatheringState

- (readonly attribute DOMString) iceGatheringState

◆ localDescription

◆ onaddstream

- (attribute EventHandler) onaddstream

◆ ondatachannel

- (attribute EventHandler) ondatachannel

◆ onicecandidate

- (attribute EventHandler) onicecandidate

◆ oniceconnectionstatechange

- (attribute EventHandler) oniceconnectionstatechange

◆ onicegatheringstatechange

- (attribute EventHandler) onicegatheringstatechange

◆ onnegotiationneeded

- (attribute EventHandler) onnegotiationneeded

◆ onsignalingstatechange

- (attribute EventHandler) onsignalingstatechange

◆ ontrack

- (attribute EventHandler) ontrack

◆ pendingLocalDescription

- (readonly attribute RTCSessionDescription) pendingLocalDescription

◆ pendingRemoteDescription

- (readonly attribute RTCSessionDescription) pendingRemoteDescription

◆ remoteDescription

- (readonly attribute RTCSessionDescription) remoteDescription

◆ signalingState

- (readonly attribute DOMString) signalingState

Property Documentation

◆ delegate

- (id< RTCPeerConnectionDelegate >) delegate
readwritenonatomicweak

The object that will be notifed about events such as state changes and streams being added or removed.

◆ iceConnectionState

- (RTCIceConnectionState) iceConnectionState
readnonatomicassign

◆ iceGatheringState

- (RTCIceGatheringState) iceGatheringState
readnonatomicassign

◆ localDescription

- (RTCSessionDescription *) localDescription
readnonatomicassign

◆ localStreams

- (NSArray< RTCMediaStream * > *) localStreams
readnonatomicassign

◆ nativePeerConnection

- (scoped_refptr<)webrtc:
readnonatomicassignimplementation

The native PeerConnectionInterface created during construction.

◆ receivers

- (NSArray< RTCRtpReceiver * > *) receivers
readnonatomicassign

Gets all RTCRtpReceivers associated with this peer connection. Note: reading this property returns different instances of RTCRtpReceiver. Use isEqual: instead of == to compare RTCRtpReceiver instances.

◆ remoteDescription

- (RTCSessionDescription *) remoteDescription
readnonatomicassign

◆ senders

- (NSArray< RTCRtpSender * > *) senders
readnonatomicassign

Gets all RTCRtpSenders associated with this peer connection. Note: reading this property returns different instances of RTCRtpSender. Use isEqual: instead of == to compare RTCRtpSender instances.

◆ signalingState

- (RTCSignalingState) signalingState
readnonatomicassign

The documentation for this class was generated from the following files: