Quickblox提高视频质量

时间:2014-09-09 21:50:30

标签: java android video quickblox

当视频发送到其他设备时,使用QuickBlox我的视频质量非常差。例如,我在自己的设备上看到自己的质量非常高,但是一旦我看到其他设备,接收到的内容质量就很差。

我尝试使用此功能来增加FPS:

 cameraView.setFPS(30);

如何提高收到的视频质量?

我在Google环聊中对这两款平板电脑进行了测试,质量优于我的应用。


这是可以在Sample by QuickBlox上找到的代码。

public class ActivityVideoChat extends Activity 
{
    private CameraView cameraView;
    private OpponentGlSurfaceView opponentView;
    private ProgressBar opponentImageLoadingPb;
    private VideoChatConfig videoChatConfig;

    @Override
    protected void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.video_chat_layout);
        initViews();
    }

    private void initViews() 
    {
        Debugger.logConnection("initViews");

        opponentView = (OpponentGlSurfaceView) findViewById(R.id.opponentView);

        cameraView = (CameraView) findViewById(R.id.cameraView);
        cameraView.setCameraFrameProcess(true);
        cameraView.setQBVideoChatListener(qbVideoChatListener);

        cameraView.setFPS(30);
        cameraView.setOnCameraViewListener(new OnCameraViewListener() {
            @Override
            public void onCameraSupportedPreviewSizes(List<Camera.Size> supportedPreviewSizes) {
                Camera.Size firstFrameSize = supportedPreviewSizes.get(0);
                Camera.Size lastFrameSize = supportedPreviewSizes.get(supportedPreviewSizes.size() - 1);
                cameraView.setFrameSize(firstFrameSize.width > lastFrameSize.width ? lastFrameSize : firstFrameSize);
            }
        });

        opponentImageLoadingPb = (ProgressBar) findViewById(R.id.opponentImageLoading);

        videoChatConfig = getIntent().getParcelableExtra(VideoChatConfig.class.getCanonicalName());

        QBVideoChatController.getInstance().setQBVideoChatListener(DataHolder.getInstance().getCurrentQbUser(), qbVideoChatListener);
    }

    @Override
    protected void onResume() 
    {
        super.onResume();
        cameraView.reuseCameraView();
    }

    @Override
    protected void onPause() 
    {
        cameraView.closeCamera();
        super.onPause();
    }

    @Override
    public void onDestroy() 
    {
        QBVideoChatController.getInstance().finishVideoChat(videoChatConfig);
        super.onDestroy();
    }

    OnQBVideoChatListener qbVideoChatListener = new OnQBVideoChatListener() 
    {
        @Override
        public void onCameraDataReceive(byte[] videoData) 
        {
            if (videoChatConfig.getCallType() != CallType.VIDEO_AUDIO) 
            {
                return;
            }
            QBVideoChatController.getInstance().sendVideo(videoData);
        }

        @Override
        public void onMicrophoneDataReceive(byte[] audioData) 
        {
            QBVideoChatController.getInstance().sendAudio(audioData);
        }

        @Override
        public void onOpponentVideoDataReceive(byte[] videoData) 
        {
            opponentView.loadOpponentImage(videoData);
        }

        @Override
        public void onOpponentAudioDataReceive(byte[] audioData)
        {
            QBVideoChatController.getInstance().playAudio(audioData);
        }

        @Override
        public void onProgress(boolean progress) 
        {
            opponentImageLoadingPb.setVisibility(progress ? View.VISIBLE : View.GONE);
        }

        @Override
        public void onVideoChatStateChange(CallState callState, VideoChatConfig chat) 
        {
            switch (callState) 
            {
                case ON_CALL_START:
                    break;
                case ON_CANCELED_CALL:

                    finish();
                    break;
                case ON_CALL_END:
                    finish();
                    break;
            }
        }
    };
}

1 个答案:

答案 0 :(得分:0)

我实际上甚至无法接收视频。你是从android到android还是android到ios?

你有什么特别的东西要让视频工作吗?如果是的话,你能告诉我你做了什么吗?