feature: Add GetStreams to AudioClient (#1588)
* Added GetStreams * Change return type * Change return type on the interface Co-authored-by: Paulo <pnmanjos@hotmail.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Discord.Audio
|
namespace Discord.Audio
|
||||||
@@ -20,6 +21,9 @@ namespace Discord.Audio
|
|||||||
/// <summary> Gets the estimated round-trip latency, in milliseconds, to the voice UDP server. </summary>
|
/// <summary> Gets the estimated round-trip latency, in milliseconds, to the voice UDP server. </summary>
|
||||||
int UdpLatency { get; }
|
int UdpLatency { get; }
|
||||||
|
|
||||||
|
/// <summary>Gets the current audio streams.</summary>
|
||||||
|
IReadOnlyDictionary<ulong, AudioInStream> GetStreams();
|
||||||
|
|
||||||
Task StopAsync();
|
Task StopAsync();
|
||||||
Task SetSpeakingAsync(bool value);
|
Task SetSpeakingAsync(bool value);
|
||||||
|
|
||||||
|
|||||||
@@ -99,6 +99,12 @@ namespace Discord.Audio
|
|||||||
_token = token;
|
_token = token;
|
||||||
await _connection.StartAsync().ConfigureAwait(false);
|
await _connection.StartAsync().ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IReadOnlyDictionary<ulong, AudioInStream> GetStreams()
|
||||||
|
{
|
||||||
|
return _streams.ToDictionary(pair => pair.Key, pair => pair.Value.Reader);
|
||||||
|
}
|
||||||
|
|
||||||
public async Task StopAsync()
|
public async Task StopAsync()
|
||||||
{
|
{
|
||||||
await _connection.StopAsync().ConfigureAwait(false);
|
await _connection.StopAsync().ConfigureAwait(false);
|
||||||
@@ -379,7 +385,7 @@ namespace Discord.Audio
|
|||||||
|
|
||||||
private async Task RunHeartbeatAsync(int intervalMillis, CancellationToken cancelToken)
|
private async Task RunHeartbeatAsync(int intervalMillis, CancellationToken cancelToken)
|
||||||
{
|
{
|
||||||
//TODO: Clean this up when Discord's session patch is live
|
// TODO: Clean this up when Discord's session patch is live
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await _audioLogger.DebugAsync("Heartbeat Started").ConfigureAwait(false);
|
await _audioLogger.DebugAsync("Heartbeat Started").ConfigureAwait(false);
|
||||||
|
|||||||
Reference in New Issue
Block a user