using System; using System.Collections.Generic; using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; using Steamworks.Data; namespace Steamworks { /// /// Undocumented Parental Settings /// public class SteamVideo : SteamClientClass { internal static ISteamVideo? Internal => Interface as ISteamVideo; internal override void InitializeInterface( bool server ) { SetInterface( server, new ISteamVideo( server ) ); InstallEvents(); } internal static void InstallEvents() { Dispatch.Install( x => OnBroadcastStarted?.Invoke() ); Dispatch.Install( x => OnBroadcastStopped?.Invoke( x.Result ) ); } public static event Action? OnBroadcastStarted; public static event Action? OnBroadcastStopped; /// /// Return true if currently using Steam's live broadcasting /// public static bool IsBroadcasting { get { int viewers = 0; return Internal != null && Internal.IsBroadcasting( ref viewers ); } } /// /// If we're broadcasting, will return the number of live viewers /// public static int NumViewers { get { int viewers = 0; if ( Internal is null || !Internal.IsBroadcasting( ref viewers ) ) return 0; return viewers; } } } }