0

当我将主要视频通话活动添加为应用程序的启动器活动时,我能够成功运行 Jitsi 视频通话 android sdk,视频连接流畅且无后顾之忧。但是,当我更改代码以从另一个活动调用相同的活动时,它会引发活动未找到异常。

这是我的清单文件

<activity
        android:name=".activity.JitsiVideoCallActivity"
        android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize"
        android:label="@string/app_name"
        android:resizeableActivity="true"
        android:supportsPictureInPicture="true"
        android:windowSoftInputMode="adjustResize">


        <intent-filter>
            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.BROWSABLE" />
            <category android:name="android.intent.category.DEFAULT" />

            <data
                android:host="beta.hipchat.me"
                android:scheme="https" />
            <data
                android:host="beta.meet.jit.si"
                android:scheme="https" />
            <data
                android:host="chaos.hipchat.me"
                android:scheme="https" />
            <data
                android:host="enso.me"
                android:scheme="https" />
            <data
                android:host="hipchat.me"
                android:scheme="https" />
            <data
                android:host="meet.jit.si"
                android:scheme="https" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.BROWSABLE" />
            <category android:name="android.intent.category.DEFAULT" />

            <data android:scheme="org.jitsi.meet" />
        </intent-filter>
    </activity>

这是我应该进行视频通话的活动

公共类 JitsiVideoCallActivity 扩展 AppCompatActivity {

private JitsiMeetView view;
private static final String ADD_PEOPLE_CONTROLLER_QUERY = null;

@Override
protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

    view = new JitsiMeetView(this);
    Bundle config = new Bundle();
    config.putBoolean("startWithAudioMuted", false);
    config.putBoolean("startWithVideoMuted", false);
    Bundle urlObject = new Bundle();
    urlObject.putBundle("config", config);
    urlObject.putString("url", "https://meet.jit.si/wizcounsel");
    view.loadURLObject(urlObject);
    setContentView(view);


}

这就是我启动意图的方式

@OnClick(R.id.call)
void call() {
    if (ContextCompat.checkSelfPermission(this, Manifest.permission.RECORD_AUDIO)
            != PackageManager.PERMISSION_GRANTED) {
        // Permission is not granted
        askForAudioPermission();
    } else
        startActivity(new Intent(this, JitsiMeetActivity.class),);
}

我在我的应用程序级别的 gradle 文件中添加了 JAVA 8 兼容性以及对这两个 gradle 文件的依赖项

我尝试 将启动模式更改为单任务应用程序崩溃 使启动器应用程序工作 的视频通话活动扩展 AppCombactActivity 和/或 JitsiMee 活动应用程序崩溃

这是我的崩溃日志

E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.star.star*, PID: 26197
android.content.ActivityNotFoundException: Unable to find explicit activity class {com.star.star/org.jitsi.meet.sdk.JitsiMeetActivity}; have you declared this activity in your AndroidManifest.xml?

如果需要更多信息,请告诉我,提前感谢,请帮助

4

2 回答 2

0

在 oncreate 方法中初始化它。在任何活动中。

void connectCall() {
    URL serverURL;
    try {
        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)
            .build();
    JitsiMeet.setDefaultConferenceOptions(defaultOptions);
}

现在在你想要的地方调用这个方法。示例 onclick 监听器

 public void onVideoCall(String text) {

    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(text)
                .setWelcomePageEnabled(false)
                .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(activity, options);
    }
于 2019-11-12T07:00:58.803 回答
0

我认为您忘记在 AndroidManifest.xml 中注册您的活动。您应该在<application>标签中注册您的活动,如下所示。

 <activity
        android:name=".YourActivity"/>
于 2020-12-30T07:46:08.593 回答