How can I determine whether a call is an audio call or a video call?
In real-time audio or video communication, you can use the Agora RTM SDK or the Agora RTC SDK to determine whether an incoming or ongoing call is an audio call or a video call.
Before a call
If you need to determine and send the call type to the receiver before a call, ensure that you have integrated the RTM SDK and the RTC SDK. Refer to the following articles to learn more about integration:
Complete the following steps to determine the call type:
- When the caller sends a call, use the Call Invitation API of the RTM SDK to send a call invitation to the callee.
- Call
sendMessageToPeer
to send the call type to the callee via peer-to-peer message. The callee gets the call type from the received peer-to-peer message.
After a call
If you need to determine and send the call type to the receiver during a call, ensure that you have integrated the RTC SDK. Refer to the following article:
During a call, the receiver can determine the call type according to the following guideline:
- If the receiver receives the onRemoteVideoStateChange callback, the current call is a video call.
- If the receiver does not receive the onRemoteVideoStateChange callback and receives the onRemoteVideoStateChange callback, the current call is an audio call.
Corresponding methods and callbacks
This article references the names of Java methods and callbacks. The following table shows the corresponding methods and callbacks for other languages.
Java/C++ | Objective-C | JavaScript |
---|---|---|
sendMessageToPeer | sendMessage:toPeer:sendMessageOptions:completion: | sendMessage |
onRemoteAudioStateChanged | remoteAudioStateChangedOfUid | getRemoteAudioStats |
onRemoteVideoStateChanged | remoteVideoStateChangedOfUid | getRemoteVideoStats |