dkumor / rtcbot

A python WebRTC remote control library
https://rtcbot.readthedocs.io/en/latest/?badge=latest
MIT License
70 stars 30 forks source link

update rtcbot to work with new version of aiortc #9

Closed rasmuspjohansson closed 4 years ago

rasmuspjohansson commented 4 years ago

Tried out the examples again with a fresh install of aiortc There are some stuff that has changed and need to be update. I have got the excamples to work again with the fixes below. SinceI dont understund what Im ding but simply tried to adress the error messages in teh simplest way possible my fixes are most probably not optimal Would be awesome if you had a look at this and updated rtcbot

/rtcbot/examples/basics$ python3 video.py Traceback (most recent call last): File "video.py", line 3, in from rtcbot import CVCamera, CVDisplay File "/usr/local/lib/python3.7/dist-packages/rtcbot/init.py", line 2, in from .connection import RTCConnection File "/usr/local/lib/python3.7/dist-packages/rtcbot/connection.py", line 12, in from .tracks import VideoSender, AudioSender, AudioReceiver, VideoReceiver File "/usr/local/lib/python3.7/dist-packages/rtcbot/tracks.py", line 2, in from aiortc import VideoStreamTrack, AudioStreamTrack ImportError: cannot import name 'AudioStreamTrack' from 'aiortc' (/usr/local/lib/python3.7/dist-packages/aiortc/init.py)

in /usr/local/lib/python3.7/dist-packages/rtcbot/tracks.py

changed referecnes of AudioStreamTRack and VideoStreamTrack to MediaStreamTrack

now the /rtcbot/examples/basics/ examples work

/rtcbot/examples/streaming$ python3 video.py

rasmus@pop-os:~/rtcbot/examples/streaming$ python3 video.py Traceback (most recent call last): File "video.py", line 10, in conn.video.putSubscription(camera) File "/usr/local/lib/python3.7/dist-packages/rtcbot/connection.py", line 163, in putSubscription self.addTrack() File "/usr/local/lib/python3.7/dist-packages/rtcbot/connection.py", line 152, in addTrack self._rtc.addTrack(s.videoStreamTrack) File "/usr/local/lib/python3.7/dist-packages/aiortc/rtcpeerconnection.py", line 371, in addTrack raise InternalError(f'Invalid track kind "{track.kind}"') aiortc.exceptions.InternalError: Invalid track kind "unknown"

in /usr/local/lib/python3.7/dist-packages/rtcbot/tracks.py

added the line

    self.kind = "video"

to the constructor of the _init of the class _videoSenderTrack(MediaStreamTrack):

now the example works

dkumor commented 4 years ago

Looks like everything is working now. Please let me know if there are still issues!