コード例 #1
0
ファイル: Music.cs プロジェクト: GoldiHD/AsukaBot-2.0
        public async void PlayMusicAsync()
        {
            Process     ffmpeg = null;
            AudioStream pcm    = null;

            while (true)
            {
                if (PlayList.Count > 0)
                {
                    await GetAudioClient();

                    if (audioClient == null)
                    {
                        Console.WriteLine("[ERROR]");
                        await Task.Delay(900);
                    }
                    else
                    {
                        ffmpeg = CreateStreamAudio(await PlayList.Peek().Uri());
                        pcm    = audioClient.CreatePCMStream(AudioApplication.Music);
                        try
                        {
                            await ffmpeg.StandardOutput.BaseStream.CopyToAsync(pcm);
                        }
                        finally { await pcm.FlushAsync(); }
                    }
                    PlayList.Dequeue();
                }
            }
        }
コード例 #2
0
 public override async Task FlushAsync(CancellationToken cancelToken)
 {
     await _next.FlushAsync(cancelToken).ConfigureAwait(false);
 }