1

I am developing a video recording app using pipe-android-sdk. I have implemented their TestApp code, But when I run that app and press the record button, errors (log below) are coming, I have tried but I am not able to solve the error because it's my first Android app.

MainActivity After Pressing RECORD VIDEO button of activity and press record button of mobile error come Application Stop

MainActivity.java

package com.example.admin.myapplication;

import android.Manifest;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.pm.PackageManager;
import android.os.Build;
import android.support.annotation.Nullable;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.Toast;

import com.android.pipe.pipeandroidsdk.PipeRecorder;


public class MainActivity extends AppCompatActivity  implements View.OnClickListener{

    private Button      button_recordVideoCustomUI;
    private Button      button_recordVideo;
    private Button      button_useExistingVideo;

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

        button_recordVideoCustomUI = (Button)findViewById(R.id.button_recordVideoCustomUI);
        button_recordVideo         = (Button)findViewById(R.id.button_recordVideo);
        button_useExistingVideo    = (Button)findViewById(R.id.button_useExistingVideo);

        button_recordVideoCustomUI.setOnClickListener(this);
        button_recordVideo.setOnClickListener(this);
        button_useExistingVideo.setOnClickListener(this);

        if (Build.VERSION.SDK_INT >= 23) {
            int permissionCheck = ContextCompat.checkSelfPermission(this,
                    Manifest.permission.CAMERA);

            if (permissionCheck == PackageManager.PERMISSION_DENIED) {
                ActivityCompat.requestPermissions(this,
                        new String[]{Manifest.permission.CAMERA},
                        2);
                ActivityCompat.requestPermissions(this,
                        new String[] {Manifest.permission.RECORD_AUDIO}, 3);

                ActivityCompat.requestPermissions(this,
                        new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},
                        1);
            }
        }
    }

    @Override
    public void onRequestPermissionsResult(int requestCode,
                                           String permissions[], int[] grantResults) {
        switch (requestCode) {
            case 1: {

                if (grantResults.length > 0
                        && grantResults[0] == PackageManager.PERMISSION_GRANTED) {

                } else {
                    Toast.makeText(this, "Permission denied to read your External storage", Toast.LENGTH_SHORT).show();
                }

                return;
            }

            case 2: {

                if (grantResults.length > 0
                        && grantResults[0] == PackageManager.PERMISSION_GRANTED) {

                } else {
                    Toast.makeText(this, "Permission denied to use Camera", Toast.LENGTH_SHORT).show();
                }

                return;
            }

            case 3: {
                if (grantResults.length > 0
                        && grantResults[0] == PackageManager.PERMISSION_GRANTED) {

                } else {
                    Toast.makeText(this, "Permission denied to record audio", Toast.LENGTH_SHORT).show();
                }

                return;
            }
        }
    }

    public void onClick(View v) {

        final PipeRecorder recorder = new PipeRecorder(this, "7e63bc4603355074d371ec74e01f8b2a");

        recorder.setOnUploadedListener(new PipeRecorder.OnUploadListener() {
            @Override
            public void onUploadSucceed(String result) {
                Toast toast = Toast.makeText(getActivity(), "Success", Toast.LENGTH_LONG);
                toast.show();
            }

            @Override
            public void onUploadFailed(String result) {
                Toast toast = Toast.makeText(getActivity(), "Network Connection Error", Toast.LENGTH_LONG);
                toast.show();
            }
        });

        switch (v.getId()) {
            case R.id.button_recordVideoCustomUI:
                recorder.maxDuration = 60;
                recorder.recordHD = false;
                recorder.payload = "Test payload for recording with customUI";
                recorder.showCameraControls = false;

                LayoutInflater inflater;
                inflater = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                View controlLayout = (View)inflater.inflate(R.layout.control_layout, null);

                Button button_record = (Button)controlLayout.findViewById(R.id.button_record);
                Button button_stop = (Button)controlLayout.findViewById(R.id.button_stop);
                Button button_cancel = (Button)controlLayout.findViewById(R.id.button_cancel);

                button_record.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        recorder.startVideoCapture();
                    }
                });

                button_stop.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        recorder.stopVideoCapture();
                    }
                });

                button_cancel.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        recorder.hide();
                    }
                });

                recorder.controlsLayout = controlLayout;

                recorder.show();

                break;

            case R.id.button_recordVideo:
                recorder.maxDuration = 5;
                recorder.recordHD = false;
                recorder.payload = "Test payload for recording with normalUI";
                recorder.showCameraControls = true;

                recorder.show();

                break;
            case R.id.button_useExistingVideo:
                recorder.payload = "Test payload with existingVideo";
                recorder.useExistingVideo();

                break;
            default:
                break;
        }

    }

    public Activity getActivity() {
        return this;
    }

}

activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    >


    <LinearLayout
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center_vertical|center_horizontal">

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Record Video Custom UI"
            android:id="@+id/button_recordVideoCustomUI" />

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Record Video"
            android:id="@+id/button_recordVideo" />

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Use Existing Video"
            android:id="@+id/button_useExistingVideo"
            android:gravity="center_vertical|center_horizontal" />
    </LinearLayout>
</RelativeLayout>

control_layout.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id = "@+id/controlsLayout"
    android:orientation="vertical"
    android:gravity="center_vertical|center_horizontal">

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="record"
        android:id="@+id/button_record"
        android:layout_weight="1"
        tools:ignore="ButtonStyle" />

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="stop"
        android:id="@+id/button_stop"
        android:layout_weight="1" />

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="cancel"
        android:id="@+id/button_cancel"
        android:layout_weight="1" />
</LinearLayout>

Error Output:

09-04 19:26:18.455 4387-4400/com.example.admin.myapplication E/Surface: getSlotFromBufferLocked: unknown buffer: 0xae6b05a0
09-04 19:26:22.385 1262-4465/? E/OMXNodeInstance: getParameter(3e:google.mpeg4.encoder, ParamVideoErrorCorrection(0x6000007)) ERROR: NotImplemented(0x80001006)
09-04 19:26:22.385 1262-4465/? E/OMXNodeInstance: setConfig(3e:google.mpeg4.encoder, ConfigPriority(0x6f800002)) ERROR: Undefined(0x80001001)
09-04 19:26:22.417 1262-4466/? E/SoftMPEG4Encoder: Failed to initialize the encoder
09-04 19:26:22.417 1262-4465/? E/ACodec: [OMX.google.mpeg4.encoder] ERROR(0x80001001)
    signalError(omxError 0x80001001, internalError -2147483648)
09-04 19:26:22.417 1262-4471/? E/OMXNodeInstance: setConfig(3f:google.amrnb.encoder, ConfigPriority(0x6f800002)) ERROR: Undefined(0x80001001)
09-04 19:26:22.417 1262-4464/? E/MediaCodec: Codec reported err 0x80001001, actionCode 0, while in state 6
09-04 19:26:22.419 1262-4463/? E/MediaCodecSource: Encoder (video) reported error : 0x80001001
09-04 19:26:23.007 1262-4478/? E/MPEG4Writer: The number of recorded samples is 0
09-04 19:26:23.138 1262-4482/? E/OMXNodeInstance: setConfig(40:google.vorbis.decoder, ConfigPriority(0x6f800002)) ERROR: Undefined(0x80001001)
09-04 19:26:23.245 1262-4483/? E/MPEG4Writer: The number of recorded samples is 0
09-04 19:26:23.556 4387-4387/com.example.admin.myapplication E/MediaRecorder: stop failed: -1007
09-04 19:26:23.557 4387-4387/com.example.admin.myapplication E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.admin.myapplication, PID: 4387
    java.lang.RuntimeException: stop failed.
        at android.media.MediaRecorder.stop(Native Method)
        at com.android.pipe.pipeandroidsdk.Preview.stopVideo(Preview.java:477)
        at com.android.pipe.pipeandroidsdk.Preview.onVideoError(Preview.java:2275)
        at com.android.pipe.pipeandroidsdk.Preview.access$1500(Preview.java:53)
        at com.android.pipe.pipeandroidsdk.Preview$8$1.run(Preview.java:2376)
        at android.app.Activity.runOnUiThread(Activity.java:5511)
        at com.android.pipe.pipeandroidsdk.Preview$8.onError(Preview.java:2373)
        at android.media.MediaRecorder$EventHandler.handleMessage(MediaRecorder.java:1029)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:148)
        at android.app.ActivityThread.main(ActivityThread.java:5417)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
09-04 19:26:24.399 1633-2958/system_process E/eglCodecCommon: glUtilsParamSize: unknow param 0x00008cdf
09-04 19:26:24.402 1633-2958/system_process E/eglCodecCommon: glUtilsParamSize: unknow param 0x00008824
Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
  • Are you sure that it is not related to this one? https://stackoverflow.com/questions/16221866/mediarecorder-failed-when-i-stop-the-recording – Iulian Popescu Sep 04 '18 at 14:24
  • i have gone through this solution but because i am using pipe-android-sdk, where i am not able to get where they are calling this stop function..can u suggest me how to solve these type errors if any external library is used and how can we edit that library according to our need..thanks – ankit dwivedi Sep 05 '18 at 05:46

0 Answers0