# createCameraContext

Creates the `CameraContext` object. 

`CameraContext` is bound to the unique `camera` component in the page, and operates on the corresponding `camera` component.

## Supported capabilities

App capability | Android | iOS | PC | Preview
---|---|---|---|---
Gadget | V5.21.0+ | V5.21.0+ | **X** | Preview
Web app | **X** | **X** | **X** | Preview

## Input

Name | Data type | Required | Default value | Description
---|---|---|---|---
id | string | Yes | &nbsp; | `camera` component's id

## Output
Return value: `CameraContext`. See the following table for the object's methods:

Method | Description
---|---
[CameraContext.setZoom](https://open.feishu.cn/document/uYjL24iN/ukDOukDOukDO/camera/cameracontext/setzoom) | Sets zoom level
[CameraContext.takePhoto](https://open.feishu.cn/document/uYjL24iN/ukDOukDOukDO/camera/cameracontext/takephoto) | Takes photo
[CameraContext.startRecord](https://open.feishu.cn/document/uYjL24iN/ukDOukDOukDO/camera/cameracontext/startrecord) | Starts recording
[CameraContext.stopRecord](https://open.feishu.cn/document/uYjL24iN/ukDOukDOukDO/camera/cameracontext/stoprecord) | Stops recording

## Sample code

```js
// The id parameter passed in must be the same as the id attribute defined in the component TTML
const cameraContext = tt.createCameraContext('myCamera');
```