diff --git a/udpstreamer.py b/udpstreamer.py index 4839c7d..4ae552a 100644 --- a/udpstreamer.py +++ b/udpstreamer.py @@ -25,14 +25,14 @@ def __init__( interpolation: str = "smooth", gamma: float = 0.5, ) -> None: - WLEDStreamer.__init__(self, width, height, crop, scale, interpolation, gamma) + self._ip = socket.gethostbyname(host) + self._port = port + self._socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) - self.ip = socket.gethostbyname(host) - self.port = port - self.socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) + WLEDStreamer.__init__(self, width, height, crop, scale, interpolation, gamma) def close(self): - self.socket.close() + self._socket.close() def sendFrame(self, frame: np.ndarray) -> None: frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB) @@ -49,8 +49,8 @@ def sendFrame(self, frame: np.ndarray) -> None: .tobytes() ) - self.socket.sendto(message, (self.ip, self.port)) + self._socket.sendto(message, (self._ip, self._port)) def _loadInfo(self) -> None: - response = requests.get("http://" + self.ip + "/json/info", timeout=5) + response = requests.get("http://" + self._ip + "/json/info", timeout=5) self._wled_info = json.loads(response.text) diff --git a/wledvideo.py b/wledvideo.py index b3c7c50..12c973b 100644 --- a/wledvideo.py +++ b/wledvideo.py @@ -55,7 +55,7 @@ def __init__(self, source: Union[str, int], loop: bool = False) -> None: } STREAMER_CONFIG_DEFAULTS = { "host": "127.0.0.1", - "port": 21234, + "port": 21324, "serial": "", "baudrate": 115200, "width": 0,