harmony 鸿蒙Previewing

  • 2022-08-09
  • 浏览 (712)

Previewing

When to Use

Use the camera module APIs to generate and play video streams.

Available APIs

For details, see the available APIs described in development guidelines on photographing.

Limitations and Constraints

None

How to Develop

  1. Perform step 1 through step 4 described in development guidelines on photographing.

  2. Set the preview area.

    Surface *surface = Surface::CreateSurface();
    /* Set the display area. */
    surface->SetUserData("region_position_x", "480"); // X-coordinate of the upper left corner of the rectangle
    surface->SetUserData("region_position_y", "270"); // Y-coordinate of the upper left corner of the rectangle
    surface->SetUserData("region_width", "960"); // Width
    surface->SetUserData("region_height", "540"); // Height
    
    
    fc->AddSurface(*surface);
    
  3. Start and stop previewing.

    stateCallback->camera_->TriggerLoopingCapture(*fc); // Start previewing.
    stateCallback->camera_->StopLoopingCapture(); // Stop previewing.
    

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Development Examples

harmony 鸿蒙Photographing

harmony 鸿蒙Video Recording

harmony 鸿蒙Use Case

harmony 鸿蒙Screen and Camera Control Overview

harmony 鸿蒙Adding Pages

harmony 鸿蒙Debugging and Packaging

harmony 鸿蒙Building the Details Page

harmony 鸿蒙FAQs

harmony 鸿蒙Building the Home Page

0  赞