Integrate on the web
Integrate on the web
Scope and prerequisites
Play live video and recordings in Chrome, Firefox, or Edge without a browser plugin. Talk, PTZ, and snapshot depend on the device. Controls are documented in JavaScript development.
Steps
- Create an app and bind the camera.
- Download the Web Video SDK from Downloads. Host
imou-player.js, the stylesheet, and WasmLib, and setWasmLibPath. - On the server, call
getKitTokenwith theaccessToken. AkitTokenlasts about two hours. Cache it on the server for about one hour. Return only thekitTokento the page. - Create
imouPlayerin the browser. Settokento thekitToken.type1is live and2is playback. UsestreamId1for a wall of cameras.
const player = new imouPlayer({
id: "root",
width: 800,
height: 400,
deviceId: "YOUR_DEVICE_SN",
channelId: 0,
token: "Kt_xxxxxxxx",
type: 1,
streamId: 1,
WasmLibPath: "/WasmLib/",
code: "DEVICE_PASSWORD_OR_SN",
templateMode: "pc",
});
Set Cross-Origin-Opener-Policy and Cross-Origin-Embedder-Policy as described in JavaScript development when you need multithreaded decoding.
Client implementations
When you need a URL for a standard player, use Cloud live from an AppId. Do not pass accessToken into ImouPlayer.
