miroslavpejic85 / mirotalkc2c

✨WebRTC - C2C - Real-time cam-2-cam video calls & screen sharing, end-to-end encrypted, to embed in any website with a simple iframe.
https://c2c.mirotalk.com
GNU Affero General Public License v3.0
232 stars 57 forks source link

how to set videosource explicitly ? #7

Closed zoldaten closed 1 year ago

zoldaten commented 1 year ago

hi ! thanks for sharing amazing project.

i`m on raspberry pi and i want to start up not only with usb-camera (everything works with c270 logitech). my path to csi camera looks like - device: /base/soc/i2c0mux/i2c@1/ov5647@36 and i do not know how to add it to videosources.

as far as i see the main file is - mirotalkc2c/frontend/js/client.js and there i see:

navigator.mediaDevices.enumerateDevices().then((devices) => {
                videoDevices = devices.filter(
                    (device) => device.kind === 'videoinput' && device.deviceId !== 'default',
                );

how to add my device explicitly ?

miroslavpejic85 commented 1 year ago

Hi @zoldaten!

To add your CSI camera device explicitly to the videoDevices list, you can try in this way.

Add a new filter condition to include your CSI camera explicitly. Based on your provided path (device: /base/soc/i2c0mux/i2c@1/ov5647@36), you can check for the deviceId that matches this path.

Here's an example of how you can modify the code to include your CSI camera:

                videoDevices = devices.filter(
                    (device) =>
                        (device.kind === 'videoinput' && device.deviceId !== 'default') ||
                        (device.kind === 'videoinput' && device.deviceId === '/base/soc/i2c0mux/i2c@1/ov5647@36'),
                );

In this modified code, we first check if the device is a video input and not the default. Then, we also explicitly include the device with the deviceId matching your CSI camera's path.

Make sure to adapt the deviceId condition to match the exact deviceId of your CSI camera as it appears in the enumerateDevices() result on your Raspberry Pi.

You're very welcome! I'm glad to hear that you found the project interesting, and I'm here to help with any questions or assistance you might need. If you have any more inquiries or need further assistance in the future, feel free to reach out and join with us on official forum. Here you can ask questions, find a lot of answers, without need to open issues here, that is mostly for confirmed bugs.

Thank you and have a great day!

zoldaten commented 1 year ago

i added but its not working: no in menu. Screenshot_1

at the same time i see in log: [2023-09-06 14:36:12.277] [xss] [T1oE2FFhhI6IWjAtAAAB] XSS Object sanitization done may be it blocks somehow ?

i can use my csi camera with crowsnest and it works: {"devices":[{"allow_dma":true,"captures":[{"format":"YUYV","height":720,"name":"CAMERA:capture","nbufs":3,"width":1280},{"format":"GB10","height":1080,"name":"CAMERA:capture:1","nbufs":3,"width":1920}],"name":"CAMERA","output":false,"path":"/base/soc/i2c0mux/i2c@1/ov5647@36"},{"allow_dma":true,"captures":[{"format":"JPEG","height":720,"name":"SNAPSHOT:capture:mplane","nbufs":3,"width":1280}],"name":"SNAPSHOT","output":{"format":"YUYV","height":720,"name":"SNAPSHOT:output:mplane","nbufs":3,"width":1280},"path":"/dev/video31"},{"allow_dma":true,"captures":[{"format":"H264","height":720,"name":"VIDEO:capture:mplane","nbufs":3,"width":1280}],"name":"VIDEO","output":{"format":"YUYV","height":720,"name":"VIDEO:output:mplane","nbufs":3,"width":1280},"path":"/dev/video11"}],"endpoints":{"rtsp":{"enabled":false},"snapshot":{"enabled":true,"output":"snapshot","uri":"http://192.168.1.100:8080/snapshot"},"stream":{"enabled":true,"output":"stream","uri":"http://192.168.1.100:8080/stream"},"video":{"enabled":true,"output":"video","uri":"http://192.168.1.100:8080/video"},"webrtc":{"enabled":true,"output":"video","uri":"http://192.168.1.100:8080/webrtc"}},"links":[{"sinks":["SNAPSHOT:output:mplane","VIDEO:output:mplane"],"source":"CAMERA:capture"},{"callbacks":["SNAPSHOT-CAPTURE","STREAM-CAPTURE"],"source":"SNAPSHOT:capture:mplane"},{"callbacks":["VIDEO-CAPTURE"],"source":"VIDEO:capture:mplane"}],"outputs":{"snapshot":{"dropped":0,"enabled":true,"frames":0,"height":720,"name":"snapshot_lock","refs":0,"source":"SNAPSHOT:capture:mplane","width":1280},"stream":{"dropped":0,"enabled":true,"frames":0,"height":720,"name":"stream_lock","refs":0,"source":"SNAPSHOT:capture:mplane","width":1280},"video":{"dropped":0,"enabled":true,"frames":834,"height":720,"name":"video_lock","refs":0,"source":"VIDEO:capture:mplane","width":1280}}}

miroslavpejic85 commented 1 year ago

Good, I don't see anything strange in the logs. You can also use OBS Studio as a video source and stream anything!

zoldaten commented 1 year ago

here how it looks like - https://youtu.be/ZaBMq6KLX9E

i open console log to see devices ids and there is no the my csi camera...

zoldaten commented 1 year ago

ok. i fix it ! libcamerify firefox

https://youtu.be/xhaOmX4gW7k

miroslavpejic85 commented 1 year ago

Very good! Thank you for report it.