-
Notifications
You must be signed in to change notification settings - Fork 540
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add tuya webrtc support #1379
base: master
Are you sure you want to change the base?
Add tuya webrtc support #1379
Conversation
This is awesome! @romasku, perhaps you can also add your new source instructions/information to the README? I want to give it a try. |
@felipecrs I've updated Readme to include an example, it's the same parameters as for Tuya's demo. |
@romasku it works! Awesome! One issue though, it only works the first time. If I stop the stream and try to access it again, it fails with: To make it work again, I have to restart go2rtc. |
@pergolafabio I think you should try your famous pet feeder against this. |
Hmm, looks interesting, though, I never got the camera stream working with that webrtc-demo-go app... I have now a working stream through the tuna cloud integration... But gonna try this one indeed!! |
is there an easy way to test this as an addon? or better wait to get merged in master? |
In my case I cloned the repo and built the executable, and ran it in my machine, not in HA. |
hmm, build the binary too, add the stream url with correct params, but i got black screen, and this is my log:
|
@pergolafabio, try a different Tuya camera if you have, just in case. It also didn't work for one of mine. |
i only have one :) |
Lucky you!!! Tuya is trash 😅 |
Hey @romasku , i see you added a new commit, is that helpfull for me? i have some issues getting the stream, see the logs above... thnx for looking into it! |
Hi, I've fixed the "uid not exist" issue (hopefully). Also, the current code uses global variables (the same as the original Tuya code), which can lead to issues if you try to open multiple streams at once. I'll try to work on this part later. @pergolafabio |
hmm, i was testing on http , since i just used the compiled binary, is https maybe needed? for the browser? |
If you use |
ok, i check later |
btw, i remember testing the webrtc-demo-go app , i never got that working either, also black screen |
As I see from logs, HA Tuya Cloud uses RTSP stream (AFAIK), so it is a different API. But you can check if this official Tuya web app works: https://protect-eu.ismartlife.me/login (maybe select a different region), as it uses WebRTC the same way as the webrtc-demo-go app. |
Tested that link, and i see the stream there, so thats already a good sign :-) |
tested again, with new version, i dont hear any audio either, strange that the other link does work?
|
@pergolafabio, if this doesn't work for you but HA does, then the following options would also work: |
I'm already using your script, but I want to avoid setting up tuya cloud integration, since that's the only one working getting the actual stream... |
@pergolafabio, Can you please also check using different go2rtc streamers? In my case, MSE streamer sometimes causes a black screen for my tuya camera. |
@pergolafabio, you don't need to have the Tuya Cloud integration set up if you use: |
I tested that one before, I didn't work, was a long time ago, will check again :-) |
It's a different one. It works the same way as Tuya Cloud integration does, except that it doesn't require Home Assistant. Also, it allows you to select between RTSP and HLS. Some cameras only work through HLS, not WebRTC nor RTSP. |
Ok, will test that later, and if doesn't work I let you know on discord... I also want to have this one working :-) no need for extra scripts :+) @romasku , I will test those other links later, I also see you enabled debug, you want me to do some testing again? |
@romasku any idea if 2-way audio is also supposed to work? I see the sendonly track in the stream info, but it doesn't seem to work. |
About two-way audio: It should work, but it is Tuya:). It should be as simple as setting |
Do you mean I should do something from my side, or do you mean your implementation already handles it? |
I've enabled two-way audio according to Tuya docs, but it doesn't work for me. If it works https://protect-eu.ismartlife.me/login but doesn't work here, please let me know. You can verify that it sends some audio using http://localhost:1984/network.html (or http://homeassistant.local:1984/network.html. To use it in HA just overwrite default go2rtc-1.8.4 binary and restart WebRTC addon. To build for arm (assuming you run HA on Raspberry) use |
Thanks a lot, I will try and let you know. |
I tested on : https://protect-eu.ismartlife.me/playback but still struggling why this PR doesnt work? i only see black video, no audio is working as well, tried last commit too.. what can i do to test/troubleshoot? :-( EDIT: just tested on another Windows, but still same behaviour :-( |
@romasku, another thing to take into consideration is the stream quality. IIRC, you can select the quality (SD/HD) when requesting the WebRTC configs. Perhaps you can make it a parameter as well? |
Thanks! As I remember, |
hey @romasku , is this maybe related? |
@AlexxIT, for your information, I tried compiling both master and this PR, and this is the comparison:
The uncompressed binaries:
If that's too big, maybe you'll have a need for |
These are unexpectedly good results. Anyway, I'll look into this PR when I have time. |
Hello,
I ported https://github.com/tuya/webrtc-demo-go to go2rtc to add direct support for Tuya cameras.
It worked for me (I could see the video feed through the go2rtc web interface), but I'm a complete newbie to Golang, so I need help to make this code clean enough. Please guide me, I'll try to do my best.
Also, another major problem I encountered is that ICE sessions should be
pion.ICERoleControlled
even though it's incorrect according to the standard. So I had to hack my way around this issue usingSDPTypePranswer
. Do you have any suggestions on how to handle this situation properly?I guess these issues are related: