Plugin | Live View | Playback |
---|---|---|
Electronic magnifier | √ | √ |
Fullscreen | √ | √ |
Screenshot | √ | √ |
Manual mosaic | √ | √ |
Video information | √ | √ |
Screen ratio | √ | √ |
Live view delay monitoring | √ | - |
All functions are mounted on the player.pluginMap. For playback, plugins are uniformly mounted on the outer player historyPlayer.pluginMap. There's no need to call methods in the channel player. When calling a method, you can pass a channel object { devId, channel }. If you do not provide a channel object, the method will apply to all channels.
Usage example: Take enabling the electronic magnifier as an example.
Description
Click and hold the left mouse button to select an area on the video. Once you release the mouse button, the selected area will be magnified.
Interface
Enable the magnifier
player.pluginMap.magnifier.enable(channelIndex?, devId?);
Disable the magnifier
player.pluginMap.magnifier.disable(channelIndex?, devId?);
Cancel the magnifier
player.pluginMap.magnifier.cancelZoomIn(channelIndex?, devId?);
Note: channelIndex can be the channel object { devId, channel }. If it is not provided, the method will apply to all channels.
Example
Description
This plugin is used to display the video in fullscreen mode.
Note: This plugin will only display the video in fullscreen mode. If your business logic also requires the fullscreen display of control buttons or other UI components, please implement the fullscreen function yourself.
Interface
Fullscreen
player.pluginMap.fullscreen.fullscreen();
Cancel fullscreen
player.pluginMap.fullscreen.cancelFullscreen();
Note: channelIndex can be the channel object of the playback player { devId, channel }.
Example
Description
This plugin is used to capture a screenshot of the video, including video images, ADAS overlays, DMS overlays, and mosaic effects.
Interface
const base64Datas = player.pluginMap.snapshot.capture(channelIndex?,[, options]);
Parameters
Property Value | Data Type | Description |
---|---|---|
channelIndex | object[] | Required. Can be "ALL", null, or channel object { devId, channel }. If "ALL" or null, applies to all channels. |
options | object | Optional. Controls the screenshot behavior. |
├fileName | string | Optional. Name of the downloaded image file. If not provided, timestamp will be used. |
├autodownload | boolean | Optional. Whether to automatically download the screenshot. Default is false. |
├captureFormat | string | Optional. Image encoding format: "png" or "jpeg". Note: JPEG is lossy encoding, suitable for screenshots where original quality is not needed, faster; PNG is lossless encoding, slower. Default is PNG. |
├captureSize | string | Optional. Specify the size of downloaded image: "container" or "original". Container is the size of the player container, original is the original video size. Note that original takes longer than container. Default is "original". |
├watermark | object | Optional parameter, watermark configuration. Refer to the watermark parameters table below |
Watermark options
Key | Default Value | Description |
---|---|---|
fontSize | 16 | Font size in pixels |
fontFamily | 'sans-serif' | Font family name |
color | 'rgba(255, 255, 255, 0.25)' | Text color in RGBA format |
gridSize | [320, 200] | Size of individual watermark block in pixels [width, height] |
lineHeight | 32 | Line height in pixels |
rotate | -30 | Rotation angle in degrees (clockwise) |
breakNumber | 30 | Maximum number of characters before line break |
contents | [] | Array of text content to display as watermark |
Return value
Property Value | Data Type | Description |
---|---|---|
base64Datas | object[] | An array containing the base64 data of the current screenshot. |
├channel | number | Channel number |
├devId | string | Device ID |
├base64 | string | The base64 data |
Example
Description
During video playing, fixed-position mosaics can be added manually.
Interface
Edit mosaic
player.pluginMap.codeMosaic.editMosaic(channelInfo?);
Save mosaic
player.pluginMap.codeMosaic.saveMosaic(channelInfo?);
Clear mosaic (used during editing)
player.pluginMap.codeMosaic.clearMosaic(channelInfo?);
Get mosaic data
player.pluginMap.codeMosaic.getData(channelInfo[]);
Return value: mosaicData[]
Set mosaic data
player.pluginMap.codeMosaic.setData(mosaicData[]);
Delete mosaic
player.pluginMap.codeMosaic.clearData(channelInfo[]);
Note: channelInfo is the channel object { devId, channel }. If it is not provided, the method will apply to all channels. For getData and clearData methods, this parameter is required.
Parameter mosaicData structure:
Example
Dynamic Mosaic Setting Example
Description
It displays the video's resolution, bitrate, and frame rate information in the bottom-right corner of the video.
Interface
Parameters in data:
p: resolution fps: bitrate mbps: real-time frame rate
Example
Description
It is used to set the screen ratio for the video. Value range: String, full for full screen, origin for original aspect ratio, and specific aspect ratios such as 16:9, 4:3, and 1:1.
Interface
Note: If channelInfo is empty or 0, it applies to all channels. If it is an object { channel: 1, devId: 'devId' }, it applies to the specified channel.
Example
Description
Used to detect whether there is delay in live view and provide callbacks. The plugin is only effective in live view scenarios.
Interface
Property Value | Data Type | Description |
---|---|---|
interval | number | Unit: millisecond. The callback interval of onMessage. |
delayTime | number | Unit: millisecond. For example, if the delay time is set to 5000, the onMessage will be called back if 5000ms is delayed during playback |
onMessage | function | Delay callback function. No parameters. |
Enable delay plugin
player.pluginMap.liveDelay.enable()
Turn off delay plugin
player.pluginMap.liveDelay.disable();
Example