Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Threading.Tasks;
- using OBS_IRL_STREAM.Models.Entities;
- using OBSWebsocketDotNet;
- namespace OBS_IRL_STREAM.Models.Services.Application
- {
- public class OBSService : IOBSService
- {
- protected OBSWebsocket _obs = new OBSWebsocket();
- public void SetOBS(OBSWebsocket _obs)
- {
- this._obs = _obs;
- }
- public Task ConnectOBS(string ip, string password)
- {
- try
- {
- if(!_obs.IsConnected)
- {
- _obs.Connect(ip, password);
- }
- }
- catch(Exception e)
- {
- Console.WriteLine(e);
- }
- return null;
- }
- public Task ToggleStreamOBS()
- {
- try
- {
- if(_obs.IsConnected)
- {
- _obs.ToggleStreaming();
- }
- }
- catch(Exception e)
- {
- Console.WriteLine(e);
- }
- return null;
- }
- public Task ToggleRecordingOBS()
- {
- try
- {
- if(_obs.IsConnected)
- {
- _obs.ToggleRecording();
- }
- }
- catch(Exception e)
- {
- Console.WriteLine(e);
- }
- return null;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement