Access to other video functions

1. Function support status

Plugin Live View Playback
Electronic magnifying glass
Full screen
Screenshot
Manual Mosaic
Video information
Live view delay monitoring -
Play frame by frame -

2. Function access guide

All functions are mounted on player.pluginMap. The playback plug-ins are also uniformly mounted on the outer player historyPlayer.pluginMap, and there is no need to call methods in the channel player. Different from live view, when playback calls a method of a channel, you need to pass in an additional parameter channelIndex (channel index, starting from 0, not the channel number) or channel object {devId, channel} in the method. If you do not pass the channel index, it takes effect on all channels.

Usage: Take turning on the electronic magnifying glass as an example

Live view:

player.pluginMap.magnifier.enable();

Playback:

// Turn on the magnifying glass of channel 0
historyPlayer.pluginMap.magnifier.enable(0);

3. Function details

3.1. Electronic magnifying glass

describe

Hold down the left mouse button in the video, select the range, and then release it. The selected range will be enlarged and displayed.

interface

  • Turn on the magnifying glass

    player.pluginMap.magnifier.enable(channelIndex?);

  • Disable magnifying glass

    player.pluginMap.magnifier.disable(channelIndex?);

  • Cancel the magnifying glass

    player.pluginMap.magnifier.cancelZoomIn(channelIndex?);

Note: channelIndex is the channel index or channel object {devId, channel}. Live view does not have this parameter. If the playback is not filled in, it will take effect on all channels.

Example

// Live view
player.pluginMap.magnifier.enable();

// Playback, turn on the magnifying glass of channel 0
historyPlayer.pluginMap.magnifier.enable(0);
// or
historyPlayer.pluginMap.magnifier.enable({ devId: 'devId', channel: 0 });

// For playback, turn on the magnifying glass for all channels
historyPlayer.pluginMap.magnifier.enable();

3.2. Full screen

describe

Display the video screen in full screen.

Note: This plug-in will only display the video screen in full screen. If the business layer also needs to display control buttons or other UI components in full screen, please implement the full screen function by yourself.

interface

  • full screen

    player.pluginMap.fullscreen.fullscreen();

  • Cancel full screen

    player.pluginMap.fullscreen.cancelFullscreen();

Note: channelIndex is the playback player channel index or channel object {devId, channel}, and live view does not have this parameter.

Example

// Live view
player.pluginMap.fullscreen.fullscreen();

// Playback channel 0 in full screen
historyPlayer.pluginMap.fullscreen.fullscreen(0);
// or
historyPlayer.pluginMap.fullscreen.fullscreen({ devId: 'devId', channel: 0 });

3.3. Screenshot

describe

Capture video images, including video images, ADAS overlay, DMS overlay, and mosaic effects.

interface

  • Live view

const base64Datas = player.pluginMap.snapshot.capture(options?);

Parameters

Attribute value Data type Description
options object Optional parameters, control screenshot behavior
├fileName string Optional parameter, the file name of the downloaded image, if not filled in, it will be named with the timestamp
├autodownload boolean Optional parameter, whether to automatically download screenshots, default false
  • Playback

const base64Datas = player.pluginMap.snapshot.capture(channelIndex?,[, options]);

Parameters

Attribute value Data type Description
channelIndex object[] Required parameter, which can be channel index or channel object { devId, channel }. There is no such parameter for live view. If the playback is null, it will take effect on all channels
options object Optional parameters, control screenshot behavior
├fileName string Optional parameter, the file name of the downloaded image, if not filled in, it will be named with the timestamp
├autodownload boolean Optional parameter, whether to automatically download screenshots, default false

return value

Attribute value Data type Description
base64Datas object[] Array with base64 data of the current screenshot
├channel number channel number
├devId string device id
├base64 string base64 data

Example

// Live view screenshot
player.pluginMap.snapshot.capture();

player.pluginMap.snapshot.caputure({ fileName: 'test', autodownload: true });

// Playback, screenshot of the 0th channel
historyPlayer.pluginMap.snapshot.capture(0);
// or
historyPlayer.pluginMap.snapshot.capture({ devId: 'devId', channel: 0 });

// Playback, screenshots of all channels
historyPlayer.pluginMap.snapshot.capture();

3.4. Manual Mosaic

describe

During video playback, fixed-position mosaics can be added manually.

interface

  • Edit mosaic

    player.pluginMap.codemosiac.editMosiac(channelIndex?);

  • Save mosaic

    player.pluginMap.codemosiac.saveMosiac(channelIndex?);

  • Clear mosaics

    player.pluginMap.codemosiac.clearMosiac(channelIndex?);

  • Get mosaic data

    player.pluginMap.codemosiac.getData(channelInfo[]);

    Return value: mosaicData[]

  • Set mosaic data

    player.pluginMap.codemosiac.setData(mosaicData[]);

  • Delete mosaic

    player.pluginMap.codemosiac.clearData(channelInfo[]);

Note: channelIndex is the channel index or channel object {devId, channel}. Live view does not have this parameter. If the playback is not filled in, it will take effect on all channels. For getData and clearData methods, channelInfo is required.

Mosaic data structure:

{
    devId: string,    // Device ID
    channel: number,  // Channel number
    list: {
        x: number,    // X coordinate
        y: number,    // Y coordinate
        w: number,    // Width
        h: number,    // Height
        mw: number,   // Original video width
        mh: number    // Original video height
    }[]
}

Example

// Live view
player.pluginMap.codemosiac.editMosiac();

// Playback, edit the 0th channel
historyPlayer.pluginMap.codemosiac.editMosiac(0);
// or
historyPlayer.pluginMap.codemosiac.editMosiac({ devId: 'devId', channel: 0 });

// Playback, edit all channels
historyPlayer.pluginMap.codemosiac.editMosiac();

// Get mosaic data
historyPlayer.pluginMap.codemosiac.getData([{devId, channel}]);
// Set mosaic data
historyPlayer.pluginMap.codemosiac.setData(data);
// Delete mosaic
historyPlayer.pluginMap.codemosiac.clearData([{devId, channel}]);

3.5. Video information

describe

Displays the resolution, bit rate, and frame rate information of the video. Displayed in the lower right corner of the video.

interface

  • player.pluginMap.videoInfoLayer.setInfoList(data[], channelIndex?);

data parameters:

  • p: resolution
  • fps: bit rate
  • mbps: real-time frame rate

Example

// Live view
player.pluginMap.videoInfoLayer.setInfoList(['p', 'fps', 'mbps']);

// Playback, open the 0th channel
historyPlayer.pluginMap.videoInfoLayer.setInfoList(['p', 'fps', 'mbps'], 0);
historyPlayer.pluginMap.videoInfoLayer.setInfoList(['p', 'fps', 'mbps'], {
    devId: 'devId',
    channel: 0
});

// Playback, open all channels
historyPlayer.pluginMap.videoInfoLayer.setInfoList(['p', 'fps', 'mbps']);

3.6. Live view delay monitoring

describe

Used to detect whether there is delay in live view and give a callback. Only the live view scene plug-in takes effect.

interface

  • player.pluginMap.liveDelay.setOptions(options: Object)

parameter

Properties Type Description
interval number Unit: milliseconds. onMessage callback interval.
delayTime number Unit: milliseconds. Delay judgment length, for example, set to 5000, if there is a delay of 5000ms during playback, onMessage will be called back
onMessage function Delayed callback function, no parameters.
  • Enable delay plugin

    player.pluginMap.liveDelay.enable()

  • Turn off delay plugin

    player.pluginMap.liveDelay.disable();

Example

player.pluginMap.liveDelay.setOptions({
    interval: 10000,
    delayTime: 5000,
    onMessage: () => {
        console.log('The current live view has delay, please check the network');
    }
});

3.11. Play frame by frame

Version

V1.4.0 or above

describe

Generally used to select the desired frame when playing back screenshots.

This function is only available for playback.

interface

  • next frame

    player.pluginMap.framePlay.nextFrame(step: number = 1);

  • previous frame

    player.pluginMap.framePlay.prevFrame(step: number = 1);

Example

// next frame
player.pluginMap.framePlay.nextFrame(1);
//Next frame, jump 10 frames
player.pluginMap.framePlay.nextFrame(10);
//Previous frame
player.pluginMap.framePlay.prevFrame(1);
//Previous frame, jump 10 frames
player.pluginMap.framePlay.prevFrame(10);