@@ -25,12 +25,12 @@ export function createPublisherHook(iceServers = []) {
2525 view . audioBitrate = document . getElementById ( "lex-audio-bitrate" ) ;
2626 view . videoBitrate = document . getElementById ( "lex-video-bitrate" ) ;
2727 view . packetLoss = document . getElementById ( "lex-packet-loss" ) ;
28- view . status = document . getElementById ( "lex-status" ) ;
28+ view . statusStarted = document . getElementById ( "lex-status-started" ) ;
29+ view . statusStopped = document . getElementById ( "lex-status-stopped" ) ;
2930 view . time = document . getElementById ( "lex-time" ) ;
3031
31- view . audioApplyButton = document . getElementById ( "lex-audio-apply-button" ) ;
32- view . videoApplyButton = document . getElementById ( "lex-video-apply-button" ) ;
3332 view . button = document . getElementById ( "lex-button" ) ;
33+ view . applyButton = document . getElementById ( "lex-apply-button" ) ;
3434
3535 view . simulcast = document . getElementById ( "lex-simulcast" ) ;
3636
@@ -42,11 +42,7 @@ export function createPublisherHook(iceServers = []) {
4242 view . setupStream ( view ) ;
4343 } ;
4444
45- view . audioApplyButton . onclick = function ( ) {
46- view . setupStream ( view ) ;
47- } ;
48-
49- view . videoApplyButton . onclick = function ( ) {
45+ view . applyButton . onclick = function ( ) {
5046 view . setupStream ( view ) ;
5147 } ;
5248
@@ -72,8 +68,7 @@ export function createPublisherHook(iceServers = []) {
7268 try {
7369 await view . setupStream ( view ) ;
7470 view . button . disabled = false ;
75- view . audioApplyButton . disabled = false ;
76- view . videoApplyButton . disabled = false ;
71+ view . applyButton . disabled = false ;
7772 } catch ( error ) {
7873 console . error ( "Couldn't setup stream, reason:" , error . stack ) ;
7974 }
@@ -94,10 +89,9 @@ export function createPublisherHook(iceServers = []) {
9489 view . width . disabled = true ;
9590 view . height . disabled = true ;
9691 view . fps . disabled = true ;
97- view . audioApplyButton . disabled = true ;
98- view . videoApplyButton . disabled = true ;
9992 view . bitrate . disabled = true ;
10093 view . simulcast . disabled = true ;
94+ view . applyButton . disabled = true ;
10195 // Button present only when Recorder is used
10296 if ( view . recordStream ) view . recordStream . disabled = true ;
10397 } ,
@@ -111,10 +105,9 @@ export function createPublisherHook(iceServers = []) {
111105 view . width . disabled = false ;
112106 view . height . disabled = false ;
113107 view . fps . disabled = false ;
114- view . audioApplyButton . disabled = false ;
115- view . videoApplyButton . disabled = false ;
116108 view . bitrate . disabled = false ;
117109 view . simulcast . disabled = false ;
110+ view . applyButton . disabled = false ;
118111 // See above
119112 if ( view . recordStream ) view . recordStream . disabled = false ;
120113 } ,
@@ -194,9 +187,8 @@ export function createPublisherHook(iceServers = []) {
194187 view . pc . onconnectionstatechange = ( ) => {
195188 if ( view . pc . connectionState === "connected" ) {
196189 view . startTime = new Date ( ) ;
197- view . status . classList . remove ( "bg-red-500" ) ;
198- // TODO use tailwind
199- view . status . style . backgroundColor = "rgb(34, 197, 94)" ;
190+ view . statusStopped . style . display = "none" ;
191+ view . statusStarted . style . display = "block" ;
200192
201193 view . statsIntervalId = setInterval ( async function ( ) {
202194 if ( ! view . pc ) {
@@ -397,7 +389,8 @@ export function createPublisherHook(iceServers = []) {
397389 view . videoBitrate . innerText = 0 ;
398390 view . packetLoss . innerText = 0 ;
399391 view . time . innerText = "00:00:00" ;
400- view . status . style . backgroundColor = "rgb(239, 68, 68)" ;
392+ view . statusStopped . style . display = "block" ;
393+ view . statusStarted . style . display = "none" ;
401394 } ,
402395
403396 toHHMMSS ( milliseconds ) {
0 commit comments