TeamDotworld / dahua-rtsp-web

Stream video in web browser
MIT License
55 stars 23 forks source link

Please could you tell how to test the player code #5

Closed Nidheeshv0312 closed 3 years ago

Nidheeshv0312 commented 3 years ago

1.How can we test this player code? 2.Can we use it for live streaming. 3.Does it support h264 and h265

naveenrobo commented 3 years ago
  1. Modify the options in index.js and use webpack to build. Server the output folder.
 var options = {    
 wsURL: "ws://host:port/rtspoverwebsocket",    
 rtspURL: "rtsp://host:port/cam/realmonitor?channel=1&subtype=0",    
 username: "",    
 password: ""
}
  1. Yes! you can use it for live streaming
  2. Decoders available for h264 and h265. But I forgot which one is used in this code.
Nidheeshv0312 commented 3 years ago

Could u please tell me how to use the webpack to compile this code

naveenrobo commented 3 years ago

@Nidheeshv0312 I have updated the code. Run

npm run build

to build the code and then serve the dist folder

Nidheeshv0312 commented 3 years ago

i removed the webpack from my ububtu system and ran the above command, am getting the below ERROR in Error: The loader "dahua-stream-video/node_modules/html-webpack-plugin/lib/loader.js!/dahua-stre am-video/src/index.html" didn't return html.

webpack 5.37.1 compiled with 1 error and 3 warnings in 19734 ms npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! rtsp-over-ws@1.0.0 build: webpack npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the rtsp-over-ws@1.0.0 build script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

naveenrobo commented 3 years ago

Have you installed the dependencies? Don't remove webpack. The above said build command uses webpack for building the project.

  1. Install dependencies

    npm i
  2. Run build command

    npm run build
naveenrobo commented 3 years ago

Also please confirm if your camera model supports rtsp over websocket

Nidheeshv0312 commented 3 years ago

One thing what i found was, there is a space between the below highlightes session" js!/dahua-stre am-" ERROR in Error: The loader "dahua-stream-video/nodemodules/html-webpack-plugin/lib/loader.js!/dahua-stre am-_video/src/index.html" didn't return html.

Nidheeshv0312 commented 3 years ago

I changd the location of the git clone to a smaller path and the above issue is resolved, now seeing this error

rtsp-over-ws@1.0.0 build /tmp/dahua-stream-video webpack

[webpack-cli] Failed to load '/tmp/dahua-stream-video/webpack.config.js' config [webpack-cli] Error: Cannot find module 'clean-webpack-plugin' Require stack:

Nidheeshv0312 commented 3 years ago

i used npm i npm run build now am not having errors, i have got a a folder called "dist" with html files and js files

naveenrobo commented 3 years ago

clean-webpack-plugin is not installed.

Nidheeshv0312 commented 3 years ago

thanksm i installed it now, if i run a websocket server in my pc for providing video data from a file, can i use it instead of using the rtsp

naveenrobo commented 3 years ago

Can you explain how you are providing video data in WebSocket so I could learn from that.

Nidheeshv0312 commented 3 years ago

i used libwebsocket to make a sample application which will take data from mp4 and thenn pusshes it to a websocket

Nidheeshv0312 commented 3 years ago

i had tried using a stream from a camera, H264 was working fine, H265 showing this .

Successfully compiled asm.js code (total compilation time 1869ms) jsFFMPEG.js Construct H265 Codec h265Decoder.js:1:58 H265 Decoder init h265Decoder.js:1:593 [hevc @ 0x53b020] Warning: not compiled with thread support, using thread emulation jsFFMPEG.js:1:2998 firstDiff: 0 h265Session.js:1:8427 Uncaught TypeError: S is null a http://127.0.0.1:8081/index.js:2 init http://127.0.0.1:8081/index.js:2 init http://127.0.0.1:8081/index.js:2 init http://127.0.0.1:8081/index.js:2

http://127.0.0.1:8081/index.js:2 http://127.0.0.1:8081/index.js:2 http://127.0.0.1:8081/index.js:2 index.js:2:25853 101
naveenrobo commented 3 years ago

We haven't checked on H265 as we didn't have any requirement for that. Please help yourself.

Nidheeshv0312 commented 3 years ago

any idea one the websocket server used by the backend

naveenrobo commented 3 years ago

Nope. All I know is it converts rtsp packets to websocket packets and sent across websocket.