我正在尝试在我的android应用程序中使用jitsi meet sdk,我需要在视频通话中向参与者显示一个对话框,同时他们正在像lingbe应用程序所做的那样交谈-->图片:https://play-lh.googleusercontent.com/t5gmc-wnptmum8cbun-jcrxg4crbjwo0-sg45f97lje4dadcxaclu6ze08g3aaeoxejs=w1366-h625 rw。我不知道如何控制和定制意图。jitsi文档也没有提到它!这是创建jitsi意图的片段。提前感谢:)
public class TalkFragment extends Fragment {
FragmentTalkBinding binding;
private final BroadcastReceiver broadcastReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
onBroadcastReceived(intent);
}
};
@Override
public View onCreateView(
LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState
) {
binding = FragmentTalkBinding.inflate(inflater, container, false);
// Initialize default options for Jitsi Meet conferences.
URL serverURL;
try {
// When using JaaS, replace "https://meet.jit.si" with the proper serverURL
serverURL = new URL("https://meet.jit.si");
} catch (MalformedURLException e) {
e.printStackTrace();
throw new RuntimeException("Invalid server URL!");
}
JitsiMeetConferenceOptions defaultOptions
= new JitsiMeetConferenceOptions.Builder()
.setServerURL(serverURL)
// When using JaaS, set the obtained JWT here
//.setToken("MyJWT")
// Different features flags can be set
.setFeatureFlag("toolbox.enabled", true)
// .setFeatureFlag("filmstrip.enabled", false)
.setWelcomePageEnabled(false)
.build();
JitsiMeet.setDefaultConferenceOptions(defaultOptions);
registerForBroadcastMessages();
listener();
return binding.getRoot();
}
@Override
public void onDestroy() {
LocalBroadcastManager.getInstance(requireContext()).unregisterReceiver(broadcastReceiver);
super.onDestroy();
}
public void listener() {
binding.button4.setOnClickListener(view -> {
String text = binding.conferenceName.getText().toString();
if (text.length() > 0) {
// Build options object for joining the conference. The SDK will merge the default
// one we set earlier and this one when joining.
JitsiMeetConferenceOptions options
= new JitsiMeetConferenceOptions.Builder()
.setRoom("test")
// Settings for audio and video
//.setAudioMuted(true)
//.setVideoMuted(true)
.build();
// Launch the new activity with the given options. The launch() method takes care
// of creating the required Intent and passing the options.
JitsiMeetActivity.launch(requireContext(), options);
}
});
}
private void registerForBroadcastMessages() {
IntentFilter intentFilter = new IntentFilter();
/* This registers for every possible event sent from JitsiMeetSDK
If only some of the events are needed, the for loop can be replaced
with individual statements:
ex: intentFilter.addAction(BroadcastEvent.Type.AUDIO_MUTED_CHANGED.getAction());
intentFilter.addAction(BroadcastEvent.Type.CONFERENCE_TERMINATED.getAction());
... other events
*/
for (BroadcastEvent.Type type : BroadcastEvent.Type.values()) {
intentFilter.addAction(type.getAction());
}
LocalBroadcastManager.getInstance(requireContext()).registerReceiver(broadcastReceiver, intentFilter);
}
// Example for handling different JitsiMeetSDK events
private void onBroadcastReceived(Intent intent) {
if (intent != null) {
BroadcastEvent event = new BroadcastEvent(intent);
switch (event.getType()) {
case CONFERENCE_JOINED:
Timber.i("Conference Joined with url%s", event.getData().get("url"));
break;
case PARTICIPANT_JOINED:
Timber.i("Participant joined%s", event.getData().get("name"));
break;
case CONFERENCE_TERMINATED:
//
}
}
}
// Example for sending actions to JitsiMeetSDK
private void hangUp() {
Intent hangupBroadcastIntent = BroadcastIntentHelper.buildHangUpIntent();
LocalBroadcastManager.getInstance(requireContext()).sendBroadcast(hangupBroadcastIntent);
}
@Override
public void onViewCreated(@NonNull @NotNull View view, @Nullable @org.jetbrains.annotations.Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
}
}
暂无答案!
目前还没有任何答案,快来回答吧!