mirror of
https://github.com/onyx-and-iris/obsws-ruby.git
synced 2024-11-15 18:50:47 +00:00
update main example to print mute state
This commit is contained in:
parent
59bcf2a338
commit
210d13ba1e
@ -30,12 +30,16 @@ Pass `host`, `port` and `password` as keyword arguments.
|
|||||||
require "obsws"
|
require "obsws"
|
||||||
|
|
||||||
class Main
|
class Main
|
||||||
|
INPUT = "Mic/Aux"
|
||||||
|
|
||||||
def run
|
def run
|
||||||
OBSWS::Requests::Client
|
OBSWS::Requests::Client
|
||||||
.new(host: "localhost", port: 4455, password: "strongpassword")
|
.new(host: "localhost", port: 4455, password: "strongpassword")
|
||||||
.run do |client|
|
.run do |client|
|
||||||
# Toggle the mute state of your Mic input
|
# Toggle the mute state of your Mic input and print its new mute state
|
||||||
client.toggle_input_mute("Mic/Aux")
|
client.toggle_input_mute(INPUT)
|
||||||
|
resp = client.get_input_mute(INPUT)
|
||||||
|
puts "Input '#{INPUT}' was set to #{resp.input_muted}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
16
main.rb
16
main.rb
@ -1,14 +1,16 @@
|
|||||||
require "obsws"
|
require "obsws"
|
||||||
|
|
||||||
class Main
|
class Main
|
||||||
|
INPUT = "Mic/Aux"
|
||||||
|
|
||||||
def run
|
def run
|
||||||
OBSWS::Requests::Client.new(
|
OBSWS::Requests::Client
|
||||||
host: "localhost",
|
.new(host: "localhost", port: 4455, password: "strongpassword")
|
||||||
port: 4455,
|
.run do |client|
|
||||||
password: "strongpassword"
|
# Toggle the mute state of your Mic input and print its new mute state
|
||||||
).run do |client|
|
client.toggle_input_mute(INPUT)
|
||||||
# Toggle the mute state of your Mic input
|
resp = client.get_input_mute(INPUT)
|
||||||
client.toggle_input_mute("Mic/Aux")
|
puts "Input '#{INPUT}' was set to #{resp.input_muted}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user