diff --git a/package.json b/package.json index 10141b5..9bbd843 100644 --- a/package.json +++ b/package.json @@ -95,6 +95,7 @@ "strict-event-emitter-types": "^2.0.0", "style-loader": "1.0.0", "terser-webpack-plugin": "1.4.1", + "three-dots": "^0.2.0", "ts-pnp": "1.1.4", "typescript": "3.7.2", "url-loader": "2.1.0", diff --git a/src/broadcast/rtc_streamer.ts b/src/broadcast/rtc_streamer.ts index 2029169..c9ff002 100644 --- a/src/broadcast/rtc_streamer.ts +++ b/src/broadcast/rtc_streamer.ts @@ -110,6 +110,7 @@ export class WebRTCStreamer extends Streamer { const data = JSON.parse(evt.data); switch (data.kind) { case "HELLO": + this.onStateChange("CONNECTING"); console.log("WS HELLO, our client ID is " + data.connectionId); this.dispatch(BroadcastState.setWsID(data.connectionId)); if (this.state !== "HELLO") { @@ -258,6 +259,11 @@ export class WebRTCStreamer extends Streamer { return "NOT_CONNECTED"; } } + console.log( + "Relevant values: ", + this.pc?.iceConnectionState, + this.ws?.readyState + ); switch (this.pc.iceConnectionState) { case "connected": case "completed": diff --git a/src/navbar/index.tsx b/src/navbar/index.tsx index feb8c5b..d7e4ca9 100644 --- a/src/navbar/index.tsx +++ b/src/navbar/index.tsx @@ -1,4 +1,4 @@ -import React, { useRef, useEffect } from "react"; +import React, { useRef, useEffect, useState } from "react"; import { useDispatch, useSelector } from "react-redux"; import Clock from "react-live-clock"; @@ -40,6 +40,17 @@ export function NavBar() { const broadcastState = useSelector((state: RootState) => state.broadcast); const settings = useSelector((state: RootState) => state.settings); const redirect_url = encodeURIComponent(window.location.toString()); + + const [connectButtonAnimating, setConnectButtonAnimating] = useState(false); + + const prevRegistrationStage = useRef(broadcastState.stage); + useEffect(() => { + if (broadcastState.stage !== prevRegistrationStage.current) { + setConnectButtonAnimating(false); + } + prevRegistrationStage.current = broadcastState.stage; + }, [broadcastState.stage]); + return ( <>