Handle cases where the client won't be connected if OBS isn't running
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
c5db9d1f88
commit
0ee045f172
@ -42,7 +42,7 @@
|
||||
"Icon": "images/pluginIcon",
|
||||
"CategoryIcon": "images/pluginIcon",
|
||||
"URL": "https://streamdeck.meow.tf/obsreplay",
|
||||
"Version": "1.0.1",
|
||||
"Version": "1.0.2",
|
||||
"SDKVersion": 2,
|
||||
"OS": [
|
||||
{
|
||||
|
14
replay.go
14
replay.go
@ -88,6 +88,14 @@ func clientForContext(context string) *obsws.Client {
|
||||
return nil
|
||||
}
|
||||
|
||||
if !c.Connected() {
|
||||
err := c.Connect()
|
||||
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
return c
|
||||
}
|
||||
|
||||
@ -131,12 +139,6 @@ func checkClient(host string, port int, password string) string {
|
||||
if !ok {
|
||||
client = &obsws.Client{Host: host, Port: port, Password: password}
|
||||
|
||||
err := client.Connect()
|
||||
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
|
||||
client.AddEventHandler("StreamStatus", streamStatusUpdate(key))
|
||||
client.AddEventHandler("ReplayStarted", loopContextState(key, 1))
|
||||
client.AddEventHandler("ReplayStopped", loopContextState(key, 0))
|
||||
|
Loading…
Reference in New Issue
Block a user