当前位置: 首页>>代码示例>>Java>>正文


Java MediaRecorder.setProfile方法代码示例

本文整理汇总了Java中android.media.MediaRecorder.setProfile方法的典型用法代码示例。如果您正苦于以下问题:Java MediaRecorder.setProfile方法的具体用法?Java MediaRecorder.setProfile怎么用?Java MediaRecorder.setProfile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.media.MediaRecorder的用法示例。


在下文中一共展示了MediaRecorder.setProfile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: configureRecorder

import android.media.MediaRecorder; //导入方法依赖的package包/类
protected void configureRecorder(int quality, MediaRecorder recorder) {
    Camera.CameraInfo info = new Camera.CameraInfo();
    Camera.getCameraInfo(cameraInfo.cameraId, info);
    int displayOrientation = getDisplayOrientation(info, false);
    recorder.setOrientationHint(displayOrientation);

    int highProfile = getHigh();
    boolean canGoHigh = CamcorderProfile.hasProfile(cameraInfo.cameraId, highProfile);
    boolean canGoLow = CamcorderProfile.hasProfile(cameraInfo.cameraId, CamcorderProfile.QUALITY_LOW);
    if (canGoHigh && (quality == 1 || !canGoLow)) {
        recorder.setProfile(CamcorderProfile.get(cameraInfo.cameraId, highProfile));
    } else if (canGoLow) {
        recorder.setProfile(CamcorderProfile.get(cameraInfo.cameraId, CamcorderProfile.QUALITY_LOW));
    } else {
        throw new IllegalStateException("cannot find valid CamcorderProfile");
    }
    isVideo = true;
}
 
开发者ID:chengzichen,项目名称:KrGallery,代码行数:19,代码来源:CameraSession.java

示例2: _startRecording

import android.media.MediaRecorder; //导入方法依赖的package包/类
private synchronized void _startRecording(Camera camera, String outPutFile, int rotationHint, int maxdurationMillis, CamcorderProfile profile)
{
    /**
     * IMPORTANT - Do not change the order of the steps in this function. Code
     * taken from the google camcoder sample
     *
     */

    Log.d(ImagingUtils.TAG, "start recording video");

    mIsRecording = true;

    // Step 1: Unlock and set camera to MediaRecorder
    mRecorder = new MediaRecorder();
    camera.unlock();

    mRecorder.setCamera(camera);


    // Step 2: Set sources
    mRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
    mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);

    // Step 3: Set a CamcorderProfile (requires API Level 8 or higher)
    mRecorder.setProfile(profile);

    // Step 4: Set rotation and max duration

    //clckwise rotation for composition matrix as opposed to the 90degree anti-clockwise
    //rotation for the camera viewfinder
    //NOTE : This only works on some media players. Eg: works on VLC windows but not on VLC Linux
    mRecorder.setOrientationHint(rotationHint);
    mRecorder.setMaxDuration(maxdurationMillis + 1000);


    // Step 5 : set the file
    mRecorder.setOutputFile(outPutFile);

    // Step 6 : Prepare
    try
    {
        mRecorder.prepare();
    }
    catch (IOException e)
    {
        //Log.e("MediaRecorder prepare failed");
        e.printStackTrace();
    }
    mRecorder.start();
}
 
开发者ID:ravindu1024,项目名称:android-imaging-utils,代码行数:51,代码来源:VideoRecorder.java


注:本文中的android.media.MediaRecorder.setProfile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。