diff --git a/README.md b/README.md index 2da938c..e74e09a 100644 --- a/README.md +++ b/README.md @@ -30,13 +30,17 @@ Pass `host`, `port` and `password` as keyword arguments. require "obsws" class Main + INPUT = "Mic/Aux" + def run OBSWS::Requests::Client .new(host: "localhost", port: 4455, password: "strongpassword") .run do |client| - # Toggle the mute state of your Mic input - client.toggle_input_mute("Mic/Aux") - end + # Toggle the mute state of your Mic input and print its new mute state + client.toggle_input_mute(INPUT) + resp = client.get_input_mute(INPUT) + puts "Input '#{INPUT}' was set to #{resp.input_muted}" + end end end diff --git a/main.rb b/main.rb index 112fb30..b4f0ce1 100644 --- a/main.rb +++ b/main.rb @@ -1,14 +1,16 @@ require "obsws" class Main + INPUT = "Mic/Aux" + def run - OBSWS::Requests::Client.new( - host: "localhost", - port: 4455, - password: "strongpassword" - ).run do |client| - # Toggle the mute state of your Mic input - client.toggle_input_mute("Mic/Aux") + OBSWS::Requests::Client + .new(host: "localhost", port: 4455, password: "strongpassword") + .run do |client| + # Toggle the mute state of your Mic input and print its new mute state + client.toggle_input_mute(INPUT) + resp = client.get_input_mute(INPUT) + puts "Input '#{INPUT}' was set to #{resp.input_muted}" end end end