Learn how to add peer-to-peer video calls to your app.
init()
method.
init()
method, a Exception
is returned: The call service is not connected
.sessionId
). You can get the sessionId
from the session
value returned from call()
, accept()
, reject()
, hangUp()
methods or from any event emitted by QB.webrtc
module. See a full list of callbacks here.StreamSubscription
that you should unsubscribe when you need in dispose()
method. Learn more details about the event handler configuration in the Event handler section.
call()
method.
Argument | Description | Description |
---|---|---|
opponentsIds | yes | A list of opponents IDs. |
sessionType | yes | Call type: QB.webrtc.RTC\_SESSION\_TYPE.VIDEO , QB.webrtc.RTC\_SESSION\_TYPE.AUDIO . |
QB.webrtc.EVENT_TYPE.CALL
.accept()
method and pass sessionId
to tell SDK which call session to accept.
Argument | Required | Description |
---|---|---|
sessionId | yes | Call session identifier. |
userInfo | no | Custom user data. |
reject()
method and pass sessionId
parameter to tell SDK which call session to reject.
Argument | Required | Description |
---|---|---|
sessionId | yes | Call session identifier. |
userInfo | no | Custom user data. |
hangUp()
method and pass sessionId
parameter to tell SDK which call session to end.
Argument | Required | Description |
---|---|---|
sessionId | yes | Call session identifier. |
userInfo | no | Custom user data. |
QB.webrtc
module. Call release()
method that allows to unregister QB.webrtc
module from receiving any video chat events and closes existing signaling channels.
release()
method should be called when a video track is no more valid. If you don’t call this method, you will get a memory leak.RTCVideoViewController
for the remote camera app of the remote peer.RTCVideoViewController
for the local camera app of the local peer.QBRTCEventTypes.RECEIVED_VIDEO_TRACK
manually. Thus, once the SDK receives data that a remote video track was received, it creates the event of RECEIVED_VIDEO_TRACK
type with userId
and sessionId
properties.
play()
and pass sessionId
and userId
parameters to it. If userId
matches with the one in properties, the video starts playing.
Argument | Required | Description |
---|---|---|
sessionId | yes | Call session identifier. |
userId | yes | The ID of the local peer. |
opponentId | yes | The ID of the remote peer. |
accept()
method is called when your call has been accepted by the user. This method receives information about the call session and additional key-value data about the user.
QuickBlox Flutter SDK persistently interacts with the server via XMPP connection that works as a signaling transport for establishing a call between two or more peers. It receives the callbacks of the asynchronous events which happen with the call and peer connection. This allows you to track these events and build your own video calling features around them.
Event type | Description |
---|---|
QBRTCEventTypes.CALL | An incoming call event has been received by the peer after the call session has been initiated. |
QBRTCEventTypes.ACCEPT | An incoming call has been accepted by the peer. |
QBRTCEventTypes.REJECT | An incoming call has been rejected by the remote peer without accepting the call. |
QBRTCEventTypes.HANG_UP | An accepted call has been ended by the peer by pressing the hang-up button. |
QBRTCEventTypes.RECEIVED_VIDEO_TRACK | A remote video track has been received by the remote peer. |
QBRTCEventTypes.PEER_CONNECTION_STATE_CHANGED | A peer connection state has been changed. View all available peer connection states in the Peer connection states section. |
QBRTCEventTypes.NOT_ANSWER | No answer received from the remote peer within the timer expiration period. |
QBRTCEventTypes.CALL_END | An accepted call has been ended. A call session was closed. |
Argument | Required | Description |
---|---|---|
type | yes | The name of the event you have subscribed to. |
payload | yes | Available if the event transmits the data. Almost all events contain session (to identify in which session this event occurred) and userId (to indicate initiator of the event) properties. |
QB.webrtc.EVENT\_TYPE.PEER\_CONNECTION\_STATE\_CHANGED
event type.
Connection state | Description |
---|---|
QBRTCPeerConnectionStates.NEW | Gathering information to establish connection. |
QBRTCPeerConnectionStates.CONNECTED | A peer is connected to the call session. |
QBRTCPeerConnectionStates.FAILED | A peer failed to join the call session. |
QBRTCPeerConnectionStates.DISCONNECTED | A peer is disconnected from the call session. |
QBRTCPeerConnectionStates.CLOSED | A call session is closed by the peer. |