Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local video black screen #6

Open
YanXinDong opened this issue May 30, 2018 · 13 comments
Open

Local video black screen #6

YanXinDong opened this issue May 30, 2018 · 13 comments

Comments

@YanXinDong
Copy link

Excuse me, why is the local video on the HUAWEI mate9 mobile phone a black screen? Is it related to HUAWEI's own CPU decoding?

@YanXinDong
Copy link
Author

In case of this problem, please check the camera format supported by the tester. The CameraEnumerationAndroid class under libjingle_peerconnection.jar provides an API to get the camera format, then compare the camera parameters you set, where the width and height are the same, and the frameRate is smaller than the system supports. Example: new NBMVideoFormat(640, 480, pixelform. RGB_888, 30);

@realskyrin
Copy link

@YanXinDong 遇到相同问题,经查应该是华为 P9 、P10 等设备底层删除了已被弃用的 Camera API,使用新的 Camera2 API 导致,请问您是如何解决的?

@realskyrin
Copy link

After testing HUAWEI P9、P8 , I got these device supports max frameRate is 15? So i set the FormatConfig like this: new NBMVideoFormat(640, 480, ImageFormat.NV21, 15); it works. May be it's not best way and if you have another way to solved this problem,PLS reply back.

@YanXinDong
Copy link
Author

@realskyrin 有些华为手机帧数就是很小,我就是更改了那个帧数,我改成了0,也没发现有什么影响。

@pcj110
Copy link

pcj110 commented Sep 12, 2018

关闭自己的视频调用enableVideo 不好用呀

@realskyrin
Copy link

realskyrin commented Sep 12, 2018 via email

@pcj110
Copy link

pcj110 commented Sep 27, 2018

还有本地是黑怎么解决

@realskyrin
Copy link

realskyrin commented Sep 27, 2018 via email

@pcj110
Copy link

pcj110 commented Sep 28, 2018

关闭流本地是那个方法呀,还有,我是视频时,是黑的,有时看不到自己,有时看不到对方,还有多人视频时,后进去的人,之前的人看不到他的是视频

@realskyrin
Copy link

realskyrin commented Sep 28, 2018

关闭流本地是那个方法呀,还有,我是视频时,是黑的,有时看不到自己,有时看不到对方,还有多人视频时,后进去的人,之前的人看不到他的是视频

关闭本地流:

    /**
     * switch local video
     *
     * @param view
     */
    public void toggleVideo(View view) {
        // nbmWebRTCPeer.enableVideo(); 并不适用于此场景
        // 解决方案:修改源码位于 MediaResourceManager 下,增加 localVideoTrack.setEnabled(bool);
        if (nbmWebRTCPeer.isLocalMediaEnabled()) {
            try {
                nbmWebRTCPeer.enableLocalVideo(false);
            } catch (Exception e) {
                // e.printStackTrace();
                Toast.makeText(this, "没有检测到可用摄像头", Toast.LENGTH_SHORT).show();
            }
            local_render.setBackgroundColor(getResources().getColor(R.color.black));
        } else {
            local_render.setBackgroundColor(getResources().getColor(R.color.full_trans));
            try {
                nbmWebRTCPeer.enableLocalVideo(true);
            } catch (Exception e) {
                Toast.makeText(this, "没有检测到可用摄像头", Toast.LENGTH_SHORT).show();
            }
        }
    }

视频黑的:
首先webrtc一个会议室多端最多只能支持8到10再多就卡了,webrtc本身定位就是peer to peer,然后你这个情况应该是没有拿到对方端的offer,如果要做多端互通,需要注意的一点是 generateoffer 时不能多个同时进行,会阻塞导致后面 offer 无法授权,这样就拿不到对方的正确ip地址以及流相关的信息了 自然就看不到画面,正确的做法是 每发出一个 generateoffer 就等两秒钟再发下一个,例如:

    /**
     * 生成对端offer
     *
     * @param peerId 对端id
     * @param delay  延迟时间
     */
    private void offerRemotePeer(String peerId, long delay) {
        L.e("delay----->" + delay);
        handler.postDelayed(() -> {
            L.e("I'm " + userName + " LOCAL: Generating offer for peer " + peerId);
            callState = CallState.WAITING_REMOTE_USER;
            if (nbmWebRTCPeer != null)
                nbmWebRTCPeer.generateOffer(peerId, false);
        }, delay);
    }

@pcj110
Copy link

pcj110 commented Sep 30, 2018

我用到上面的方法后,第一次进去是好用,假如在退出后,在进入,已经在房间里的人就看不到后面的人了

@realskyrin
Copy link

realskyrin commented Sep 30, 2018 via email

@pcj110
Copy link

pcj110 commented Oct 13, 2018

你好,我还想咨询一下,在第一次进入时,先进去的人能看到后面的人,但退出后,再次进入,就看不到了,这个也执行了nbmWebRTCPeer.generateOffer(peerId, false);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants