PWMediaSessionDelegate Protocol Reference
| Conforms to | NSObject |
|---|---|
| Declared in | PWMediaSession.h |
Overview
Used to send messages for an PWMediaSession instance. The PWMediaSession class
includes a
delegate property. When you send the
[PWMediaSession startVideoCall:participant:displayName:delegate:] message,
you specify an PWMediaSessionDelegate object.
Connect session
– mediaSession:didChangeState:
Sent when the client’s connection state changes.
- (void)mediaSession:(PWMediaSession *)session didChangeState:(PWConnectionState)stateParameters
session |
The PWMediaSession instance that sent this message. |
|---|---|
state |
The PWConnectionState instance that represents connection state. |
Declared In
PWMediaSession.h
– mediaSession:didConnectToRoom:
required method
Sent when the client is successfully connected and Created/Joined Room.
- (void)mediaSession:(PWMediaSession *)session didConnectToRoom:(PWRoom *)roomParameters
session |
The PWMediaSession instance that sent this message. |
|---|---|
room |
The PWRoom instance of a room in which client is connected. |
Declared In
PWMediaSession.h
– mediaSession:didDisconnectToRoom:
required method
Sent when the client disconnects from the session.
- (void)mediaSession:(PWMediaSession *)session didDisconnectToRoom:(PWRoom *)roomParameters
session |
The PWMediaSession instance that sent this message. |
|---|---|
room |
The PWRoom instance of a room from which client disconnects. |
Declared In
PWMediaSession.h
– mediaSession:didFailWithError:
required method
Sent when session fails to connect.
- (void)mediaSession:(PWMediaSession *)session didFailWithError:(NSError *)errorParameters
session |
The PWMediaSession instance that sent this message. |
|---|---|
error |
A |
Declared In
PWMediaSession.h
Room
– mediaSession:shouldProcessNewPeer:
Sent right before when session starts connecting to new peer.
- (BOOL)mediaSession:(PWMediaSession *)session shouldProcessNewPeer:(PWRemotePeer *)remotePeerParameters
session |
The PWMediaSession instance that sent this message. |
|---|---|
remotePeer |
The PWRemotePeer instance that represents new participant. |
Return Value
return NO if client doesn’t want to connect to new peer. Default is YES.
Discussion
This delegate is used to control number of peers at client side.
Declared In
PWMediaSession.h
– mediaSession:didJoinNewPeer:
Sent when the new client joins room.
- (void)mediaSession:(PWMediaSession *)session didJoinNewPeer:(PWRemotePeer *)remotePeerParameters
session |
The PWMediaSession instance that sent this message. |
|---|---|
remotePeer |
The PWRemotePeer instance that represents new participant. |
Declared In
PWMediaSession.h
– mediaSession:didReceiveUsersList:
Sent when the client receives list of all participants in room.
- (void)mediaSession:(PWMediaSession *)session didReceiveUsersList:(nullable NSArray *)usersParameters
session |
The PWMediaSession instance that sent this message. |
|---|---|
users |
|
Declared In
PWMediaSession.h
– mediaSession:didDisconnectPeer:
Sent when the other client disconnects from room.
- (void)mediaSession:(PWMediaSession *)session didDisconnectPeer:(PWRemotePeer *)remotePeerParameters
session |
The PWMediaSession instance that sent this message. |
|---|---|
remotePeer |
The PWRemotePeer instance that represents participant disconnected from room. |
Declared In
PWMediaSession.h
Get user media
– mediaSession:didAddLocalStream:
required method
Sent when client got user-media.
- (void)mediaSession:(PWMediaSession *)session didAddLocalStream:(PWMediaStream *)localStreamParameters
session |
The PWMediaSession instance that sent this message. |
|---|---|
localStream |
PWMediaStream object of webrtc local media stream interface.
|
Declared In
PWMediaSession.h
– mediaSession:didAddRemoteStream:ofPeer:
required method
Sent when client got remote client user-media.
- (void)mediaSession:(PWMediaSession *)session didAddRemoteStream:(PWMediaStream *)remoteStream ofPeer:(PWRemotePeer *)remotePeerParameters
session |
The PWMediaSession instance that sent this message. |
|---|---|
remoteStream |
PWMediaStream object of webrtc remote media stream interface.
|
remotePeer |
The PWRemotePeer instance that represents remote client of incoming media. |
Declared In
PWMediaSession.h
Text message and file share
– mediaSession:didReceiveTextMessage:ofPeer:
Sent when client received text message, common for public/private message both.
- (void)mediaSession:(PWMediaSession *)session didReceiveTextMessage:(NSString *)message ofPeer:(PWRemotePeer *)remotePeerParameters
session |
The PWMediaSession instance that sent this message. |
|---|---|
message |
|
remotePeer |
The PWRemotePeer sender of message. |
Declared In
PWMediaSession.h
– mediaSession:didStartReceivingDocument:
Sent when client is starting to receive file in chunks.
- (void)mediaSession:(PWMediaSession *)session didStartReceivingDocument:(PWDataFile *)documentParameters
session |
The PWMediaSession instance that sent this message. |
|---|---|
document |
The PWDataFile object which contains all the information of incoming data. |
Declared In
PWMediaSession.h
– mediaSession:didFinishReceivingDocument:atURL:ofPeer:
Sent when client successfully received file.
- (void)mediaSession:(PWMediaSession *)session didFinishReceivingDocument:(nullable PWDataFile *)document atURL:(NSURL *)url ofPeer:(PWRemotePeer *)remotePeerParameters
session |
The PWMediaSession instance that sent this message. |
|---|---|
document |
The PWDataFile object which contains all the information of received file. |
url |
The |
remotePeer |
The PWRemotePeer sender of file. |
Declared In
PWMediaSession.h
– mediaSession:didFailFileTransferWithError:
Sent when file transfer failed when connection fails.
- (void)mediaSession:(PWMediaSession *)session didFailFileTransferWithError:(NSError *)errorParameters
session |
The PWMediaSession instance that sent this message. |
|---|---|
error |
A |
Discussion
Reasons:
- Slow internet connection.
- Heavy usage of bandwidth.
- Disconnected from server.
- Data channels state
close.
Declared In
PWMediaSession.h
WebRTC Statistics
– mediaSession:didGetStats:forPeer:
Sent on collect statistics event. when you send [PWMediaSession collectStatsWithTimeInterval:]
- (void)mediaSession:(PWMediaSession *)session didGetStats:(PWStatsBuilder *)statsReport forPeer:(PWRemotePeer *)remotePeerParameters
session |
The PWMediaSession instance that sent this message. |
|---|---|
statsReport |
A |
remotePeer |
An object of remote peer W.R.T stats. |
Declared In
PWMediaSession.h