Android媒体播放器大小设置

时间:2015-11-19 17:34:07

标签: android

为了通过前置CAM设置videoSize。如果我在videoHeight和videoWidth的地方给出了编码值,我工作正常。但是当我将MediaPlayer参数设置为通用时,CAM将停止工作,如下所示:

<?php
$current_user = wp_get_current_user();

if ($current_user instanceof WP_User) {

    $userId = $current_user->ID;
    $userEmail = $current_user->user_email;
    $userRegisterDate = strtotime($current_user->user_registered);
    $userFirstName = $current_user->user_firstname;

    if (($userId && $userEmail && $userRegisterDate && $userFirstName)) {
        $session = curl_init();

        $customer_id = $userId; 
        $customerio_url = 'https://track.customer.io/api/v1/customers/';
        $site_id = 'xxxxxxxx';
        $api_key = 'xxxxxxxx';

        $data = array('email' => $userEmail, 'first_name' => $userFirstName, 'created_at' => $userRegisterDate);

        curl_setopt($session, CURLOPT_URL, $customerio_url . $customer_id);
        curl_setopt($session, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
        curl_setopt($session, CURLOPT_HTTPGET, 1);
        curl_setopt($session, CURLOPT_HEADER, false);
        curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($session, CURLOPT_CUSTOMREQUEST, 'PUT');
        curl_setopt($session, CURLOPT_VERBOSE, 1);
        curl_setopt($session, CURLOPT_POSTFIELDS, http_build_query($data));
        curl_setopt($session, CURLOPT_SSL_VERIFYPEER, false);

        curl_setopt($session, CURLOPT_USERPWD, $site_id . ':' . $api_key);

        curl_exec($session);
        curl_close($session);

        $session = curl_init();
        $customerio_url = 'https://track.customer.io/api/v1/customers/' . $customer_id . '/events';
        $actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";

        $data = array('name' => $actual_link, 'type' => 'page', 'data[referrer]' => 'http://www.spanishvirtually.com');

        curl_setopt($session, CURLOPT_URL, $customerio_url);
        curl_setopt($session, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
        curl_setopt($session, CURLOPT_HEADER, false);
        curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($session, CURLOPT_VERBOSE, 1);
        curl_setopt($session, CURLOPT_CUSTOMREQUEST, 'POST');
        curl_setopt($session, CURLOPT_POSTFIELDS, http_build_query($data));
        curl_setopt($session, CURLOPT_SSL_VERIFYPEER, false);

        curl_setopt($session, CURLOPT_USERPWD, $site_id . ':' . $api_key);

        curl_exec($session);
        curl_close($session);
    }
}
?>

1 个答案:

答案 0 :(得分:0)

您可能希望尝试通过camera.getParameters().getSupportedVideoSizes()获取支持的分辨率,并确保目标视频大小(预览大小)与受支持列表中的某个项目匹配。根据Android文档:

  

...如果摄像机用作视频源,则必须将返回列表中的一个大小传递给MediaRecorder.setVideoSize()以用于摄像机应用程序。在这种情况下,预览的大小可能与视频录制期间录制的视频的分辨率不同。

卡梅尔