Interface description
The following describes the real- time video API of the cmsv6player.min.js plug- in. Support PC/mobile browser, support h264/h265 video format
The plug- in needs to be loaded before use, see: Initialize plug- in
Set the window title
setVideoInfo(index, title)
| Parameter name |
Parameter type |
Must |
Example |
Parameter meaning |
| index |
number |
Yes |
0 |
Window subscript (starts at 0) |
| title |
string |
Yes |
channel- 1 |
Window Title |
Play live video
startVideo(index, jsession, devIdno, channel, stream, isVideo)
| Parameter name |
Parameter type |
Must |
Example |
Parameter meaning |
| index |
number |
Yes |
0 |
Window subscript (starts at 0) |
| jsession |
string |
Yes |
66d754dd7f41473dbd2 |
Session number returned by user login |
| devIdno |
string |
Yes |
013300000001 |
Device# |
| channel |
number |
Yes |
0 |
Device channel (starting from 0) |
| stream |
number |
is |
1 |
video stream 1 represents sub- stream, 0 represents main stream |
| isVideo |
boolean |
Yes |
true |
Please pass this parameter as true |
Stop playing video
stopVideo(index)
| Parameter name |
Parameter type |
Must |
Example |
Parameter meaning |
| index |
number |
Yes |
0 |
Window subscript (starts at 0) |
Reset the video window
reSetVideo(index)
| Parameter name |
Parameter type |
Must |
Example |
Parameter meaning |
| index |
number |
Yes |
0 |
Window subscript (starts at 0) |
Set the minimum video buffer duration
setBufferTime(index, time)
| Parameter name |
Parameter type |
Must |
Example |
Parameter meaning |
| index |
number |
Yes |
0 |
Window subscript (starts at 0) |
| time |
number |
is |
2 |
is mainly used to adjust the video delay. when the cached data reaches the minimum buffer duration, it will be played. Unit: seconds |
Set the maximum video buffering duration
setBufferTimeMax(index, time)
| Parameter name |
Parameter type |
Must |
Example |
Parameter meaning |
| index |
number |
Yes |
0 |
Window subscript (starts at 0) |
| time |
number |
is |
6 |
is mainly used to adjust the video delay. when the cached data reaches the maximum buffer duration, fast playback is performed. Unit: seconds |
Real- time video callback events
Parameter Type Definition
| Parameter name |
Parameter meaning |
| start |
Start playback |
| pause |
|
| stop |
Stop |
| play |
Play again after a pause or stop |
| sound |
Turn on sound |
| slide |
Mute |
| PicSave |
Screenshot |
Use Example
See also: https://v7.cmsv8.com/808gps/open/player/video-demo.html
https://v7.cmsv8.com/808gps/open/player/videoExampleH5.html?lang=en
https://v7.cmsv8.com/808gps/open/player/RealPlayVideo.html?account=cmsv6&password=cmsv6&vehiIdno=S66666&lang=en
https://v7.cmsv8.com/808gps/open/player/RealPlayVideo.html?jsession=66d754dd7f41473dbd2&vehiIdno=S66666&lang=en
Sample code
// The video plug- in must be initialized before it can be called.
// Play video
function playVideo() {
// Stop playing video
cmsv6player.stopVideo(0);
// Set the video window title
cmsv6player.setVideoInfo(0, "vehicle1- CH1");
// Play video
cmsv6player.startVideo(0, "66d754dd7f41473dbd2", "013300000001", 0, 1, true);
}
// Stop playing video
function stopVideo() {
cmsv6player.stopVideo(0);
}
// Resetting the video window will stop the video playback and will clear the window title
function reSetVideo() {
cmsv6player.reSetVideo(0);
}
// Video callback event- the video plug- in directly calls the onTtxVideoMsg interface.
function onTtxVideoMsg(index,type) {
if(type == "start") {
// index window to start playing the video
} else if (type == "pause") {
// index window, pause the video
} else if (type == "stop") {
// index window, stop playing the video
} else if (type == "play") {
// index window, play again after pause or stop
} else if (type == "sound") {
// index window, turn on the sound
} else if (type == "sound") {
// index window, mute
} else if (type == "PicSave") {
// index window, screenshot
}
}