0

立体 (3D) 画像/ビデオを撮影するための 2 つの背面カメラを備えた lg g-slate があります。私のアプリでは、デバイスにプリインストールされている 3D ビデオ レコーダー アプリケーションを呼び出そうとしています。次の方法でアプリを正常に起動できました。

    Intent i;
    PackageManager manager = getPackageManager();
    try {
        i = manager.getLaunchIntentForPackage("com.lge.stereo.camcorder");
        if (i == null)
            throw new PackageManager.NameNotFoundException();
        i.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
        startActivityForResult(i, ACTION_TAKE_VIDEO);
    } catch (PackageManager.NameNotFoundException e) {

アプリでビデオを録画した後、戻るボタンを使用する以外にアプリから戻る方法はありません。したがって、 onActivityResult() では、結果コードは RESULT_CANCELLED であり、インテントから返されたデータを取得する方法はありません。ビデオが保存されたファイルの Uri を取得したいのですが、アプリから戻る唯一の方法は戻るボタンを使用するため、これを行う方法がわかりません。

以前に次のコードを使用して 2D ビデオを記録しました。

Intent takeVideoIntent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
startActivityForResult(takeVideoIntent, ACTION_TAKE_VIDEO);

ビデオを録画した後、[OK] を選択してアプリケーションに戻り、onActivityResult でファイル URI を取得できるダイアログ ポップアップが表示されます。

結果を取得できるように 3D ビデオ レコーダーを起動する方法はありますか?

ヘルプや提案をいただければ幸いです。ありがとう

4

2 に答える 2

0

ここに画像の説明を入力カスタム レイアウトでのみ、アプリ内でカメラ アプリを開きます。ビデオを保存および破棄するための2つのボタンを配置できる場所。ユーザーが押してビデオを保存すると、事前定義された場所に保存されます。ビデオのパスは既に自分で定義しているため、ユーザーがビデオのキャンセルを押すと、場所を破棄してビデオをキャンセルするか、戻るボタンの機能を上書きします。

例えば

onCreate() メソッド内で、カメラのインスタンスを取得します

private Camera myCamera;
// Get Camera for preview
myCamera = getCameraInstance();


private Camera getCameraInstance() {
        // TODO Auto-generated method stub
        Camera c = null;
        try {
            // attempt to get a Camera instance
            c = Camera.open();
        } catch (Exception e) {
            // Camera is not available (in use or does not exist)
        }
        // returns null if camera is unavailable
        return c;
    }

カメラのサーフェス ビューを作成するようになりました

         private MyCameraSurfaceView myCameraSurfaceView;

        myCameraSurfaceView = new MyCameraSurfaceView(this, myCamera);
        FrameLayout myCameraPreview = (FrameLayout) findViewById(R.id.videoview);
        myCameraPreview.addView(myCameraSurfaceView);

        myButton = (Button) findViewById(R.id.mybutton);
        myButton.setOnClickListener(myButtonOnClickListener);

        flashOff = (RadioButton) findViewById(R.id.flashoff);
        flashTorch = (RadioButton) findViewById(R.id.flashtorch);

このようなレイアウトを作成します

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="horizontal" >

        <FrameLayout
            android:id="@+id/videoview"
            android:layout_width="720px"
            android:layout_height="480px" />

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:orientation="vertical" >

            <Button
                android:id="@+id/mybutton"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="REC"
                android:textSize="12dp" />

            <RadioGroup
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical" >

                <RadioButton
                    android:id="@+id/flashoff"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:checked="true"
                    android:text="OFF"
                    android:textSize="8dp" />

                <RadioButton
                    android:id="@+id/flashtorch"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Torch"
                    android:textSize="8dp" />
            </RadioGroup>

            <Button
                android:layout_marginTop="10dp"
                android:id="@+id/btn_next"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="NEXT"
                android:textSize="12dp" />


        </LinearLayout>
    </LinearLayout>

</LinearLayout>
于 2013-11-01T05:23:18.190 に答える