TzuHuanTai / PiCamera.js

WebRTC Connection and Video Stream for Raspberry Pi Camera.
https://www.npmjs.com/package/picamera.js
GNU Affero General Public License v3.0
2 stars 1 forks source link

Documentation is sparse #3

Open thomergil opened 2 days ago

thomergil commented 2 days ago

I believe this is a cool project and I'd like to use it, but I'm having a difficult time creating a fully working example from the documentation you provided. In particular, it's unclear what the role of MQTT is and why the client cannot connect to the RTC server directly. It would be best if I could open a port and have it work without MQTT.

Be that as it may, if we need MQTT for this, then I'll run my own mosquitto, as your documentation suggests. But I'm having a difficult time getting your example to work in that scenario. For example, mqttPath isn't valid for mosquitto. I'm going as far as running mosquitto in strace to figure out whether piCamera.js is even connecting.

All in all, more complete documentation would be fantastic, especially where it concerns running mosquitto locally.

TzuHuanTai commented 2 days ago

You're right, why the p2p can't just connect to server directly. The server side is usually behind NAT, assign an dynamic ip by using 5G internet carriers, we need to know where the server is in advance before buiding p2p connection, so there is a server as a register to help the client side know where the destination is. Here explain the signaling mechanism while building webrtc connection. There are several options, I just choose MQTT. And here is the signaling process about this project.

The intranet or public servers that use static IPs without NAT, it is possible to connect directly using the latest WebRTC protocols, WHIP&WHEP, However, I haven't implemented it yet.

Here is my mosquitto settings fyi. The mqtt server is behind the nginx with the router /mqtt. I'll try what if no router for my mqtt later, whether I can just leave the mqttPath empty.

TzuHuanTai commented 2 days ago

After testing, I can directly connect to my mosquitto if without nginx proxy and the mqttPath is empty! The allow_anonymous true is the different in /etc/mosquitto/mosquitto.conf

...
listener 8083
protocol websockets
allow_anonymous true
...
thomergil commented 21 hours ago

https://github.com/TzuHuanTai/PiCamera.js/pull/14 should address my concerns.