Device Video Stream
Pull a device's real-time video stream directly via WebSocket. Suitable for custom players, recording, real-time analysis, and similar scenarios.
Endpoint
ws://127.0.0.1:23158/player/DEVICE_IDConnect directly to local port 23158 to pull the video stream.
| Parameter | Description |
|---|---|
| DEVICE_ID | Target device ID, e.g. P72578581E07 |
Output
After a successful connection, the server continuously pushes an H.264 baseline raw stream to the client.
Basic Usage (Node.js Example)
javascript
const deviceId = 'P72578581E07'
const ws = new WebSocket(`ws://127.0.0.1:23158/player/${deviceId}`)
ws.binaryType = 'arraybuffer'
ws.onmessage = (_event) => {
// _event.data is H.264 baseline raw stream binary data
// Pass it to your decoder / player
}
ws.onclose = () => {
console.log('Video stream connection closed')
}
// Close the connection when the stream is no longer needed
// ws.close()⚠️ Important Behavior
The kernel server continuously monitors all stream-pulling connections for a device (including the iClick console):
- When a device has no stream-pulling clients, the kernel instructs the device to stop pushing, saving bandwidth and compute resources on both ends.
- When your business no longer needs the cast screen data, actively close the WebSocket connection to free device and host-side resources.