Vonage 屏幕共享不起作用

Vonage screensharing not works

我在 android studio java.I 中使用 vonage api 的屏幕共享 java.I 已经遵循了他们的文档,但是问题 is:when 我尝试共享屏幕它发送视频from camera instead of screen capturing.Here 是代码片段,(另外,我是否需要使用不同的 API 密钥,屏幕共享的会话 ID 与视频共享不同 api)

@Override
public void onConnected(Session session) {
    Log.d(TAG, "onConnected: Connected to session " + session.getSessionId());

    mPublisher = new Publisher.Builder(MainActivity.this).name("publisher").build();
    mPublisher.setPublisherListener(this);
    mPublisher.setPublisherVideoType(PublisherKit.PublisherKitVideoType.PublisherKitVideoTypeScreen);
    mPublisher.setAudioFallbackEnabled(false);

    ScreenSharingCapturer screenCapturer = new ScreenSharingCapturer(MainActivity.this, mWebViewContainer);
    mPublisher.setCapturer(screenCapturer);

    mWebViewContainer.setWebViewClient(new WebViewClient());
    WebSettings webSettings = mWebViewContainer.getSettings();
    webSettings.setJavaScriptEnabled(true);
    mWebViewContainer.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    mWebViewContainer.loadUrl("http://www.tokbox.com");

    mPublisher.setStyle(BaseVideoRenderer.STYLE_VIDEO_SCALE, BaseVideoRenderer.STYLE_VIDEO_FILL);
    mPublisherViewContainer.addView(mPublisher.getView());

    mSession.publish(mPublisher);
}

最后我解决了这个问题:

Publisher.Builder mPublisherBuilder = new Publisher.Builder(MainActivity.this); //.build();
ScreenSharingCapturer screenCapturer = new ScreenSharingCapturer(MainActivity.this, mWebViewContainer);
mPublisherBuilder=mPublisherBuilder.capturer(screenCapturer);
mPublisher=mPublisherBuilder.build();

setCapturer 已弃用,因此它没有设置来自 BaseVideoCapture 的捕获器。