GitPedia

Dahua rtsp web

Stream video in web browser

From TeamDotworld·Updated March 3, 2026·View on GitHub·
·Archived

**Try the url before using the code below. This will play substream video without much overkill. If this is not working then proceed to next** The project is written primarily in JavaScript, distributed under the MIT License license, first published in 2021. Key topics include: camera, dahua, ip, ip-camera, rtsp.

Dahua - Stream video in browser

Try the url before using the code below. This will play substream video without much overkill. If this is not working then proceed to next

http://host:port/cgi-bin/mjpg/video.cgi?channel=1&subtype=1

RTSP over WS

Stream RTSP over websocket and use RTSP direclty in web browser. Made possible by new feature in Dahua camera which implements rtspoverwebsocket functionality. This would reduce the need for a server to translate the video stream to HLS or DASH to make RTSP work on web browsers. Kudos to Dahua for this thought.

NOTE: Need support for /rtspoverwebsocket support for using this feature

html
<video width=400 height=400 id="videoplayer"></video>
js
import PlayerControl from './src/index.js'; var options = { wsURL: "ws://host:port/rtspoverwebsocket", rtspURL: "rtsp://host:port/cam/realmonitor?channel=1&subtype=0", username: "", password: "" } let player = new PlayerControl(options) player.on("Error", (j) => { if (j) console.log(j.errorCode) }) player.init(document.querySelector("#videoplayer")) player.connect()

NOTE: Audio is currently not supported. This is a working PoC for video stream. Audio Streaming is also possible.

Snapshots

Try this url to take snapshots

http://username:password@host:port/cgi-bin/snapshot.cgi?0

Notice

This project is made possible by using RTSP over WebSocket functionality implemented by Dahua for their IP Cameras. Code available in this project is extracted from an Dahua IP Camera and made to work standalone. We have no intent to commercialize this project.

Contributors

Showing top 2 contributors by commit count.

View all contributors on GitHub →

This article is auto-generated from TeamDotworld/dahua-rtsp-web via the GitHub API.Last fetched: 6/22/2026