summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoe Rayhawk <jrayhawk@fairlystable.org>2022-11-09 21:35:45 -0800
committerJoe Rayhawk <jrayhawk@fairlystable.org>2022-11-09 21:35:45 -0800
commit7dfe13379ccb51c726b73d5a3379e816b809b50b (patch)
tree63180cc41fce64db90be7b35990f24d6f0a27ad6 /src
parent84f2682942d3b0c6665746fe3dcf2dbad090c47d (diff)
downloadcrystal-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')
-rw-r--r--src/obswebsocket.cr8
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