diff --git a/obs-websocket-dotnet/Types/MediaInputStatus.cs b/obs-websocket-dotnet/Types/MediaInputStatus.cs index c3dc437..c9392a8 100644 --- a/obs-websocket-dotnet/Types/MediaInputStatus.cs +++ b/obs-websocket-dotnet/Types/MediaInputStatus.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json; +using System; +using Newtonsoft.Json; using Newtonsoft.Json.Linq; namespace OBSWebsocketDotNet.Types @@ -12,19 +13,34 @@ public class MediaInputStatus /// State of the media input /// [JsonProperty(PropertyName = "mediaState")] - public string State { get; set; } + internal string StateString { get; set; } + + /// + /// State of the media input + /// + public MediaState? State + { + get + { + if (!Enum.TryParse(StateString, out MediaState state)) + { + return null; + } + return state; + } + } /// /// Total duration of the playing media in milliseconds. `null` if not playing /// [JsonProperty(PropertyName = "mediaDuration")] - public int? Duration { get; set; } + public long? Duration { get; set; } /// /// Position of the cursor in milliseconds. `null` if not playing /// [JsonProperty(PropertyName = "mediaCursor")] - public int Cursor { get; set; } + public long? Cursor { get; set; } /// /// Instantiate from JObject @@ -40,4 +56,16 @@ public MediaInputStatus(JObject body) /// public MediaInputStatus() { } } + + public enum MediaState + { + OBS_MEDIA_STATE_NONE, + OBS_MEDIA_STATE_PLAYING, + OBS_MEDIA_STATE_OPENING, + OBS_MEDIA_STATE_BUFFERING, + OBS_MEDIA_STATE_PAUSED, + OBS_MEDIA_STATE_STOPPED, + OBS_MEDIA_STATE_ENDED, + OBS_MEDIA_STATE_ERROR + } } diff --git a/obs-websocket-dotnet/Types/OBSVideoSettings.cs b/obs-websocket-dotnet/Types/OBSVideoSettings.cs index 87eedfe..77bbf25 100644 --- a/obs-websocket-dotnet/Types/OBSVideoSettings.cs +++ b/obs-websocket-dotnet/Types/OBSVideoSettings.cs @@ -11,36 +11,36 @@ public class ObsVideoSettings /// Numerator of the fractional FPS value /// [JsonProperty(PropertyName = "fpsNumerator")] - public double FpsNumerator { internal set; get; } + public double FpsNumerator { set; get; } /// /// Denominator of the fractional FPS value /// [JsonProperty(PropertyName = "fpsDenominator")] - public double FpsDenominator { internal set; get; } + public double FpsDenominator { set; get; } /// /// Base (canvas) width /// [JsonProperty(PropertyName = "baseWidth")] - public int BaseWidth { internal set; get; } + public int BaseWidth { set; get; } /// /// Base (canvas) height /// [JsonProperty(PropertyName = "baseHeight")] - public int BaseHeight { internal set; get; } + public int BaseHeight { set; get; } /// /// Width of the output resolution in pixels /// [JsonProperty(PropertyName = "outputWidth")] - public int OutputWidth { internal set; get; } + public int OutputWidth { set; get; } /// /// Height of the output resolution in pixels /// [JsonProperty(PropertyName = "outputHeight")] - public int OutputHeight { internal set; get; } + public int OutputHeight { set; get; } } } \ No newline at end of file