diff options
author | Joe Rayhawk <jrayhawk@fairlystable.org> | 2022-11-09 21:35:45 -0800 |
---|---|---|
committer | Joe Rayhawk <jrayhawk@fairlystable.org> | 2022-11-09 21:35:45 -0800 |
commit | 7dfe13379ccb51c726b73d5a3379e816b809b50b (patch) | |
tree | 63180cc41fce64db90be7b35990f24d6f0a27ad6 /src/obswebsocket.cr | |
parent | 84f2682942d3b0c6665746fe3dcf2dbad090c47d (diff) | |
download | crystal-obs-websocket-7dfe13379ccb51c726b73d5a3379e816b809b50b.tar.gz crystal-obs-websocket-7dfe13379ccb51c726b73d5a3379e816b809b50b.zip |
preview! and program! need to block to avoid strange transition! behavior
Diffstat (limited to 'src/obswebsocket.cr')
-rw-r--r-- | src/obswebsocket.cr | 8 |
1 files 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 |