Open SampsaKaskela opened 9 months ago
I tried adding the tokenUri to config by hardcoding the correct uri in and it seemed to work. The issues then ended up being that since my camera requires Authorization header to authenticate then I got 401 response because it was missing from request and there seemed to be no way to add Authorization header to request. After hard coding that into openWebsocket function then the request went through and stream opened. This might be separate issue tho since currently there doesn't seem to be way to include Authorization header to that request and so that request is kind of useless without that functionality.
Describe the bug I'm using BasicPlayer component from media-stream-player. I give it hostname prop which contains my camera hostname (192.168.220.70) and format (RTP_H264). Then when camera starts it begins connecting to following urls:
ws://192.168.220.70/rtsp-over-websocket http://localhost:5173/axis-cgi/rtspwssession.cgi?1701346271345
This is clearly wrong. It should not make request to localhost (that is where my UI is run with Vite) but to hostname that was given so correct would probably be
http://192.168.220.70/axis-cgi/rtspwssession.cgi?1701346271345
To Reproduce Import BasicPlayer component and give it hostname and format RTP_H264. Check console for urls where it tries to connect.
Environment (please complete the following information):
Additional context I suspect the problem might be in WsRtspVideo component that BasicPlayer uses internally. WsRtspVideo component opens Html5VideoPipeline and gives it ws config { uri: "ws url here" }. But when it opens websocket it merges with default config which is calculated like this in current code:
So since it merges default config and given ws config then that tokenUri part ends up being wrong. Fix maybe could be that instead of giving
{ uri: ws }
you would give it{ host: "myHost" }
since defaultConfig function is called withdefaultConfig(config.host, config.scheme)
so in this case it should then calculate uri and tokenUri correctly. Alternatively you could pass{ uri: ws, tokenUri: wsTokenUri }
and that would probably work too.