IpcPlayer
Requires:
@ray-js/ray≥0.6.9
Description
Real-time video playback component. A native component with separate-layer rendering; be aware of the limitations on native components.
Props
| Property | Type | Required | Default | Description | Since |
|---|---|---|---|---|---|
deviceId | string | Yes | "" | Device ID; the component's unique identifier; required | - |
autoplay | boolean | No | false | Autoplay | - |
muted | boolean | No | - | Whether to mute | - |
clarity | "ss" | "normal" | "hd" | "ud" | "ssp" | "auto" | "audio" | No | normal | Quality: ss (data saver), normal (SD), hd (HD), ud (UHD), ssp (extra HD), auto (auto), audio (audio mode) | - |
soundMode | "speaker" | "ear" | No | speaker | Audio output: speaker (loudspeaker), ear (earpiece) | - |
orientation | "vertical" | "horizontal" | No | vertical | Screen orientation: vertical (portrait), horizontal (landscape) | - |
objectFit | "contain" | "fillCrop" | No | contain | Fill mode: contain (fit long edge), fillCrop (cover and crop) | - |
autoPauseIfNavigate | boolean | No | true | Whether to auto-pause real-time audio/video when navigating to another page within this mini program | - |
autoPauseIfOpenNative | boolean | No | true | Whether to auto-pause real-time audio/video when navigating to other native pages in the app | - |
rotateZ | number | No | 0 | Camera rotation angle, 0–360 | - |
scalable | boolean | No | true | Whether zoom is currently enabled | - |
scaleMultiple | number | No | 0 | Zoom ratio; takes effect only when scalable is true | - |
ptzControllable | boolean | No | true | Whether to enable cloud platform control for the video area | - |
borderWidth | number | string | No | 0 | Border width, in px | - |
borderStyle | "solid" | "dashed" | No | solid | Border style: solid, dashed | - |
borderColor | string | No | #ffffff | Border color, hex | - |
borderRadius | number | string | No | 0 | Border radius, in px | - |
backgroundColor | string | No | #ffffff | Background color, hex | - |
| No | - | Additional properties | @ray-js/ray 1.7.79 | ||
| No | - | Fires when the connection state changes; use onConnectChange | - | ||
| No | - | Fires when the preview state changes; use onPreviewChange | - | ||
| No | - | Fires when the device online status changes; use onOnlineChange | - | ||
| No | - | Fires when initialization completes; use onInitDone | - | ||
| No | - | Fires when the video zoom ratio changes; use onZoomChange | - | ||
| No | - | Fires when the video is tapped; use onVideoTap | - | ||
| No | - | Fires when the connection state changes; state = 0 indicates connection successful | - | ||
| No | - | Fires when the preview state changes; state = 1 indicates preview started successfully, 0 indicates preview ended successfully | - | ||
| No | - | Fires when the IPC device online status changes | - | ||
| No | - | Triggered when initialization completes | - | ||
| No | - | Fires when the video zoom ratio and current zoom factor change | - | ||
| No | - | Fires when the video is tapped | - | ||
| No | - | Fires when the state is abnormal | - | ||
| No | - | Disconnected (⚠️ Not delivered on Android; disconnection is reflected via onConnectChange with state < 0) | - | ||
| No | - | Preview failed (fires when P2P sessionStatus < 0; shared by normal and multi-lens preview) | IPCKit 6.1.4 | ||
| No | - | Weak network notification | IPCKit 6.1.4 | ||
| No | - | Fires when the overlay component is created successfully | IPCKit 6.2.3 | ||
| No | - | Fires when a video index is selected | IPCKit 7.3.3 | ||
| No | - | Fires when the layout state changes | IPCKit 7.3.3 | ||
| No | - | Fires when the locator positions | IPCKit 7.3.3 | ||
| No | - | Fires when a swipe gesture on the player is reported and PTZ rotation is required | IPCKit 7.3.3 | ||
updateLayout | unknown | No | - | Used for cross-layer components to notify the container layer to update styles | - |
Referenced Types
interface
IpcPlayerSessionDidDisconnectedEventinterface
IpcPlayerCreateViewSuccessEventinterface
BaseEvent| Property | Type | Required | Description |
|---|---|---|---|
type | string | Yes | Event type |
timeStamp | number | Yes | Time in milliseconds since the page opened |
| Yes | Source component of the event | ||
| Yes | Collection of property values for the current component | ||
mark | any | No | Event mark data |
interface
Target| Property | Type | Required | Description |
|---|---|---|---|
id | string | Yes | id of the event source component |
| Yes | Collection of custom attributes from the `dataset` on the event source component |
Valid Values
clarity
| Value | Description | Since |
|---|---|---|
ss | Data-saving quality | - |
normal | Standard-definition quality | - |
hd | High-definition quality | - |
ud | Ultra-high-definition quality | - |
ssp | Super-ultra-high-definition quality | - |
auto | Automatically select video quality | - |
audio | Audio mode | - |
soundMode
| Value | Description | Since |
|---|---|---|
speaker | Output audio through the speaker | - |
ear | Output audio through the earpiece | - |
orientation
| Value | Description | Since |
|---|---|---|
vertical | Vertical | - |
horizontal | Horizontal | - |
objectFit
| Value | Description | Since |
|---|---|---|
contain | Preserve the aspect ratio and fit the longer side to display the entire image | - |
fillCrop | Preserve the aspect ratio and fill the container, cropping any overflow | - |
borderStyle
| Value | Description | Since |
|---|---|---|
solid | Solid border | - |
dashed | Dashed border | - |
Examples
Basic usage
IPC playback control
Error Codes
Related Links
Related API: createIpcPlayerContext. This is a native component based on off-screen rendering. Please note the native component usage restrictions.
FAQ
ipc-playerdefault width is 300px and height is 225px. You can set the width and height via tyss.- Not supported in the Tuya MiniApp IDE.
- For related principles, refer to Native components based on off-screen rendering.
- Please note the native component usage restrictions.