From 7dfe13379ccb51c726b73d5a3379e816b809b50b Mon Sep 17 00:00:00 2001 From: Joe Rayhawk Date: Wed, 9 Nov 2022 21:35:45 -0800 Subject: preview! and program! need to block to avoid strange transition! behavior --- src/obswebsocket.cr | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/obswebsocket.cr b/src/obswebsocket.cr index 66a19f3..8a729d5 100644 --- a/src/obswebsocket.cr +++ b/src/obswebsocket.cr @@ -619,10 +619,14 @@ module OBSWebSocket program! end def program! - @reqchan.send( { nil, OBSWebSocket.req( "SetCurrentProgramScene", UUID.random.to_s, JSON.parse( { "sceneName" => @name }.to_json ) ) } ) + reschan = Channel( JSON::Any ).new + @reqchan.send( { reschan, OBSWebSocket.req( "SetCurrentProgramScene", UUID.random.to_s, JSON.parse( { "sceneName" => @name }.to_json ) ) } ) + reschan.receive # we get weird behavior on transitions unless we block here end def preview! - @reqchan.send( { nil, OBSWebSocket.req( "SetCurrentPreviewScene", UUID.random.to_s, JSON.parse( { "sceneName" => @name }.to_json ) ) } ) + reschan = Channel( JSON::Any ).new + @reqchan.send( { reschan, OBSWebSocket.req( "SetCurrentPreviewScene", UUID.random.to_s, JSON.parse( { "sceneName" => @name }.to_json ) ) } ) + reschan.receive # we get weird behavior on transitions unless we block here end def createinput( iname : String, kind : String, settings : OBSWebSocket::InputSettings | Hash( String, String | Bool | Int64 | Float64 ) | Nil = nil, enabled : Bool = true ) reqdata = ( Hash( String, String | Bool | Int64 | Float64 | Hash( String, String | Bool | Int64 | Float64 ) ) ).new -- cgit v1.2.3