It includes configurations for the s17 server and player settings, effective for all player instances created by H5Player. This configuration must be set before instantiation.
Usage Instruction
playerjs.config = { ...customConfig };
Name | Type | Default Value | Required | Description |
---|---|---|---|---|
baseURL | String | Yes | Custom request prefix. It must include protocol, IP, and port, e.g., https://test-2100.xxxx.com:20551/getway | |
decoderType | Number | 2 | No | The decoding type. 0: wasm, 1: mse, 2: WebCodecs. If the browser doesn't support the specified decoding method, it will automatically downgrade. |
operationTimeout | Number | 60 | No | The operation timeout duration (in seconds). 1. For playback, it is used to detect if seek times out; 2. The loading timeout duration (in seconds). During both live view and playback, it is used to detect if loading times out. |
logLevel | Number | 6 | No | Log level, 0-4, from low to high, representing 0-trace, 1-debug, 2-info, 3-warn, 4-error, 5-fatal, 6-off (no logs printed) |
hardwareAcceleration | Number | 0 | No | Whether to enable hardware decoding for WebCodecs. 0-browser auto-select, 1-hardware decoding, 2-software decoding. Only effective when decoderType = 2. If live view requires higher real-time performance, set this to 2, though it will sacrifice some performance. |
fullRatio | Number | 0 | No | The threshold value for the stretch ratio when filling the screen - if below this value, the content will not be stretched and will be displayed at its original aspect ratio. Value range: 0-1. (V2.0.3) |
Description
When a video contains mosaic information and needs to be displayed, the AI mosaic capability can be used to obscure certain key visuals, such as faces.
Configuration Items
Name | Type | Default Value | Required | Description |
---|---|---|---|---|
mosaic | Number | 0 | No | Whether to apply mosaic: 0 - No mosaic, 1 - Plugin mosaic (effective with wasm decoding), and 2 - Front-end mosaic. For high confidentiality, set decoderType to 0 and mosaic to 1. |
mosaicType | Number | 1 | No | 0: Blur effect; 1: Mosaic |
Example
Description
ADAS overlay information display: The displayed information includes lane markings, alarm identifiers, vehicle markers, pedestrian markers, current speed, and distance to the vehicle ahead.
DMS overlay information display: The displayed information includes alarm identifiers for driver phone usage, distracted driving, and seat belts not fastened.
AEB information acquisition: It mainly includes forward collision used for OSD overlay.
Bucket information display: It mainly displays the bucket tooth position of the excavator to determine if any bucket teeth are missing.
Configuration Items
Name | Type | Default Value | Required | Description |
---|---|---|---|---|
adas | Boolean | false | No | It specifies whether to enable the ADAS information display. |
dms | Boolean | false | No | It specifies whether to enable the alarm DMS information display. |
aeb | Boolean | false | No | It specifies whether to enable the AEB alarm information. |
bucket | Boolean | false | No | It specifies whether to enable the bucket information display. |
allowAlarms | number[] | undefined | undefined | No | List of alarm IDs. After enabling ADAS or DMS, specify which alarm types are allowed to be displayed. If no alarms need to be displayed, pass []. See alarm types below. |
langs | object[] | undefined | No | Term configuration, see term configuration table |
showCurves | string[] | undefined | No | List of curves to display. Options: distance (front vehicle distance curve), speed (speed curve), ttc (alarm duration curve). Pass empty array [] to hide all curves |
aiUnit | object | undefined | No | AI display units. Speed (default km/h), distance (default m). Refer to unit reference table for configuration options |
Alarm List
Alarm Type ID | Description |
---|---|
0 | Driver abnormal alarm |
1 | Seat belt not fastened alarm |
2 | Left/right distraction alarm |
3 | Looking down distraction alarm |
4 | Phone usage alarm |
5 | Smoking alarm |
6 | Yawning alarm |
7 | Obstruction alarm |
8 | Fatigue alarm |
9 | Infrared blocking glasses alarm |
10 | Forward collision alarm |
11 | Vehicle too close alarm |
12 | Lane departure alarm (left) |
13 | Lane departure alarm (right) |
Distance Unit Mapping Table
Key | Description |
---|---|
1 | Meter (m) |
2 | Foot (ft) |
Speed Unit Mapping Table
Key | Description |
---|---|
1 | Kilometer per hour (km/h) |
2 | Mile per hour (mph) |
Example
Description
The placeholder plugin can provide a custom placeholder image or text during playback when there is no video stream, offering a visual cue in the absence of video.
Configuration Items
Name | Type | Default Value | Required | Description |
---|---|---|---|---|
placeholder | Boolean | No | It specifies whether to enable video placeholder mask. |
Example
Description
When the device experiences an abnormal disconnection due to network fluctuations, this configuration can trigger automatic reconnection.
Only live view is supported.
Configuration Items
Name | Type | Default Value | Required | Description |
---|---|---|---|---|
reconnectCount | number | 3 | No | Number of disconnection reconnections. The default value is 3. If you want to disable the connection, please pass 0 |
reconnectTime | number | 10 | No | The default reconnection interval is 10 seconds |
reconnectAgainCount | number | 0 | No | Number of additional reconnection attempts after reconnectCount is exhausted. Default is 0. |
reconnectAgainTime | number | 0 | No | Interval for additional reconnection attempts in seconds. Default is 0. Used for reconnection after reconnectCount is exhausted. |
Example
Description
In playback scenarios, the interval and format for progress callbacks can be set.
Configuration Items
Name | Type | Default Value | Required | Description |
---|---|---|---|---|
timeHookInterval | Number | 500 | No | The frequency at which the playback time callback onTimeChange hook is pushed, in milliseconds, must be at least 40 ms. |
timeFormatter | String | YYYY-MM-DD HH:mm:ss | No | The time format for the time callback hook. |
Example
Description
In cases of poor network conditions, users may want to buffer for a period before starting play to ensure smooth play.
Configuration Items
Name | Type | Default Value | Required | Description |
---|---|---|---|---|
needStartBuffer | Boolean | false | No | It specifies whether to enable first-frame buffering, used for playback of very short evidence or under poor network conditions. |
bufferTime | Number | 0 | No | The start playback buffer duration (in seconds). After the first frame or channel is stuck and the buffer reaches this value, the buffering ends. When this configuration item is set to 0, this function is disabled, which means that after buffering, the received data will be played immediately. |
Example
Description
GB28181, standard JT1078 and other devices have no absolute RTC time, and need to use the reconnection mode, so the waiting interval between closing and opening can be configured
Configuration Items
Name | Type | Default Value | Required | Description |
---|---|---|---|---|
seekRecWaitTime | Number | 500 | No | Wait interval, in ms |
The playerjs.defaultHeaders configuration item. When the media service requires authentication, this configuration item must be configured. The specific parameters depend on the media service interface.
Usage Instruction
Basic Configuration Items
Name | Type | Default Value | Required | Description |
---|---|---|---|---|
_tenantId | Number | 2 | No | The tenant ID, optional. |
_appId | Number | 1 | No | The application ID, optional. |
_token | String | No | token | |
_sign | String | No | sign |
Custom request headers are also allowed.
The H5Player version loader is used for asynchronous loading and quick switching of SDKs, avoiding SDK version conflicts. It is a compressed JS file that can be used as a static resource in the project or stored on a server for loading. Once the version loader is successfully loaded in the project, the videoSDKVM object will be added to the global window. All subsequent loading, switching, etc. of H5Player need to be implemented through this object.
Note: It is recommended to use this manager to load H5Player in internal projects.
Properties
Methods
Loading Timing
It is recommended to preload when entering the video play page.
Example