簡體   English   中英

無法使視頻適用於quickBlox的新android SDK

[英]Can't get video working for new android SDK of quickBlox

在過去兩天里,我一直在嘗試讓視頻聊天適用於quickblox的android 2.0 SDK。 我可以接受,進行,拒絕視頻通話,但是視頻不會在Surfaceview上發送或接收。

我可以看到自己的攝像機視頻,並可以正常切換攝像機。

我已經遍歷了演示多次,幾乎逐行復制了它。

誰能給我一些如何使其工作的提示? 我將非常感謝。

這是我的QBChatListener聲明

 OnQBVideoChatListener qbVideoChatListener = new OnQBVideoChatListener() {
    @Override
    public void onCameraDataReceive(byte[] videoData) {

        QBVideoChatController.getInstance().sendVideo(videoData);
        Log.d("send", "video");

    }

    @Override
    public void onMicrophoneDataReceive(byte[] audioData) {
        if (!muteOn) {
            QBVideoChatController.getInstance().sendAudio(audioData);
            Log.d("send", "audio");

        }
    }

    @Override
    public void onOpponentVideoDataReceive(byte[] videoData) {
        toUserSurfaceView.render(videoData);
        Log.d("receive", "video");
    }

    @Override
    public void onOpponentAudioDataReceive(byte[] audioData) {
        QBVideoChatController.getInstance().playAudio(audioData);
        Log.d("receive", "audio");

    }



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

    @Override
    public void onVideoChatStateChange(CallState callState, VideoChatConfig receivedVideoChatConfig) {
        videoChatConfig = receivedVideoChatConfig;

        switch (callState) {

            case ON_CALL_START:
                Log.d("ON_CALL_START", "ON_CALL_START");

                break;
            case ON_CANCELED_CALL:

                videoChatConfig = null;
                Log.d("on_cancel", "on_cancel");


                //play sound
                goBack();


                break;
            case ON_CALL_END:
                Log.d("oncallend", "oncallend");

                // clear opponent view
                toUserSurfaceView.clear();
                goBack();

                break;
            case ACCEPT:

                callingTitle.setText("Attempting to connect with \n" + callTitle);
                mySurfaceView.setVisibility(View.VISIBLE);
                toUserSurfaceView.setVisibility(View.VISIBLE);
                QBVideoChatController.getInstance().acceptCallByFriend(videoChatConfig, null);
                Log.d("accept", "accept");


                break;
            case ON_ACCEPT_BY_USER:
                callingTitle.setText(callTitle + "\n accepted. Attempting to connect");
                mySurfaceView.setVisibility(View.VISIBLE);
                toUserSurfaceView.setVisibility(View.VISIBLE);

                QBVideoChatController.getInstance().onAcceptFriendCall(videoChatConfig, null);
                Log.d("ON_ACCEPT_BY_USER", "ON_ACCEPT_BY_USER");

                break;
            case ON_REJECTED_BY_USER:


                                    break;
            case ON_DID_NOT_ANSWERED:


                break;


            case ON_CONNECTED:
                hideTitleAndIndicator();
                Log.d("onConnected", "onConnected");

                switchCameraButton.setEnabled(true);

                break;
            case ON_START_CONNECTING:
                Log.d("onstartconnection", "onstartconnection");


                break;

        }

    }

這是我在日志中遇到的錯誤:

10-03 21:08:36.910    D/QBDataSenders﹕ true false false
10-03 21:08:36.910    D/QBDataSenders﹕ videoData didn`t send
10-03 21:08:36.918    D/CameraView﹕ time=368 9600 1000
10-03 21:08:36.918    D/CameraView﹕ processed my audio frame, time=368, size=0.9765625 kb false
10-03 21:08:36.918    D/QBDataSenders﹕ audiData didn`t send
10-03 21:08:36.918    D/send﹕ audio
10-03 21:08:36.957    D/skia﹕ onFlyCompress
10-03 21:08:37.012    GC_FOR_ALLOC freed 1218K, 13% free 13441K/15392K, paused 32ms, total 32ms
10-03 21:08:37.051    D/QBDataSenders﹕ true false false
10-03 21:08:37.051    D/QBDataSenders﹕ videoData didn`t send

10-03 21:23:09.528    W/System.err﹕ java.lang.InterruptedException
10-03 21:23:09.528     W/System.err﹕ at java.lang.VMThread.sleep(Native Method)
10-03 21:23:09.528     W/System.err﹕ at java.lang.Thread.sleep(Thread.java:1031)
10-03 21:23:09.535     W/System.err﹕ at java.lang.Thread.sleep(Thread.java:1013)
10-03 21:23:09.535    W/System.err﹕ at com.quickblox.module.videochat.core.objects.AudioRecorder$AudioPlayingRunnable.run(AudioRecorder.java:126)
10-03 21:23:09.535    W/System.err﹕ at java.lang.Thread.run(Thread.java:856)
10-03 21:23:09.535    W/System.err﹕ java.lang.InterruptedException
10-03 21:23:09.535    W/System.err﹕ java.lang.InterruptedException
10-03 21:23:09.535    W/System.err﹕ at java.lang.VMThread.sleep(Native Method)
10-03 21:23:09.535   W/System.err﹕ at java.lang.Thread.sleep(Thread.java:1031)
10-03 21:23:09.535    W/System.err﹕ at java.lang.Thread.sleep(Thread.java:1013)
10-03 21:23:09.535   W/System.err﹕ at com.quickblox.module.videochat.core.objects.AudioRecorder$AudioPlayingRunnable.run(AudioRecorder.java:126)
10-03 21:23:09.535   W/System.err﹕ at java.lang.Thread.run(Thread.java:856)

10-03 22:27:49.824   W/System.err﹕ java.lang.InterruptedException
10-03 22:27:49.831   W/System.err﹕ at java.lang.VMThread.sleep(Native Method)
10-03 22:27:49.831   W/System.err﹕ at java.lang.Thread.sleep(Thread.java:1031)
10-03 22:27:49.831   W/System.err﹕ at java.lang.Thread.sleep(Thread.java:1013)
10-03 22:27:49.831  W/System.err﹕ at com.quickblox.module.videochat.core.objects.XMPPConnectionClient$CallingRunnable.run(XMPPConnectionClient.java:150)

經過大量的拔毛工作以及styler1972的幫助后,這對我有用。

我沒有哪個人能解決我的問題,但這正是對我有用的,因此,我將涵蓋所有內容。

  1. 確保您的libs文件夾中有armeabi編解碼器,就像演示項目一樣。

  2. 在gradle中確保您有

    buildscript {存儲庫{mavenCentral()}依賴項{classpath'com.android.tools.build:gradle:0.12.2'}}

    然后

    android {

    compileSdkVersion 19 buildToolsVersion '20 .0.0'

     sourceSets { main { manifest.srcFile 'src/main/AndroidManifest.xml' //location of your manifest java.srcDirs = ['src'] res.srcDirs = ['src/main/res'] } } defaultConfig { applicationId "your bundle id" minSdkVersion 16 targetSdkVersion 19 versionCode 1 versionName "1.0" } // don't use proguard // buildTypes { // release { // runProguard true // proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' // } // } // lintOptions { // abortOnError true // } task nativeLibsToJar(type: Zip, description: 'create a jar archive of the native libs') { destinationDir file("$buildDir/native-libs") baseName 'native-libs' extension 'jar' from fileTree(dir: 'libs', include: '**/*.so') into 'lib/' } tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn(nativeLibsToJar) } dependencies { compile fileTree(dir: 'libs', include: '*.jar') compile fileTree(dir: '../jar', include: '*.jar') compile fileTree(dir: "$buildDir/native-libs", include: 'native-libs.jar') } 

之后,我終於可以使它起作用了!

此解決方案適用於Eclipse Android項目結構:-

在SDK示例中,您將找到一個編解碼器的.SO文件,該文件應位於項目中。將此文件復制到您的libs / armeabi文件夾中。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM