使用 Sinch Video Calling 传递额外数据
Pass extra data with Sinch VideoCalling
这是我如何实现调用的代码。
@Override
public void onClientStarted(SinchClient sinchClient) {
Log.e(TAG, "started");
callClient = sinchClient.getCallClient();
callClient.addCallClientListener(this);
}
public void initiateCall(String receiverId) {
Call call = callClient.callUserVideo(receiverId);
call.addCallListener(this);
}
但是我想传递一些数据,比如用户名、头像和其他东西,有什么方法可以通过视频通话传递这些数据吗?
已从 sinch 开发人员处获得解决方案。
You can pass along custom data providing headers to the
callUserVideo(String toUserId, Map headers) method. The headers you
pass can be retrieved from the incoming Call object using getHeaders()
method.
https://download.sinch.com/docs/android/latest/reference/com/sinch/android/rtc/calling/Call.html
我们可以在初始化调用时在map中传递额外的值。
HashMap<String,String> map=new HashMap<>();
map.put("userId","5");
map.put("profileImage","image url");
Call call = callClient.callUserVideo(receiverId,map);
这是我如何实现调用的代码。
@Override
public void onClientStarted(SinchClient sinchClient) {
Log.e(TAG, "started");
callClient = sinchClient.getCallClient();
callClient.addCallClientListener(this);
}
public void initiateCall(String receiverId) {
Call call = callClient.callUserVideo(receiverId);
call.addCallListener(this);
}
但是我想传递一些数据,比如用户名、头像和其他东西,有什么方法可以通过视频通话传递这些数据吗?
已从 sinch 开发人员处获得解决方案。
You can pass along custom data providing headers to the callUserVideo(String toUserId, Map headers) method. The headers you pass can be retrieved from the incoming Call object using getHeaders() method. https://download.sinch.com/docs/android/latest/reference/com/sinch/android/rtc/calling/Call.html
我们可以在初始化调用时在map中传递额外的值。
HashMap<String,String> map=new HashMap<>();
map.put("userId","5");
map.put("profileImage","image url");
Call call = callClient.callUserVideo(receiverId,map);