Entity-Now / Edge_tts_sharp

免费调用微软Edge浏览器文本转语音接口
https://www.nuget.org/packages/Edge_tts_sharp
26 stars 8 forks source link

缺少停止播放接口 #2

Closed ZORfree closed 6 months ago

ZORfree commented 7 months ago

简单好用,就是如果文本过长,缺少stopPlay的接口

Entity-Now commented 6 months ago

已解决你提的需求,现在可以这样调用:

// 获取一个PlayerAudio对象
static void getPlayer(string msg, eVoice voice)
{
    var player = Edge_tts.GetPlayer(msg, voice);

    Console.WriteLine("开始播放");
    player.PlayAsync();
    Thread.Sleep(3000);

    Console.WriteLine("暂停播放");
    player.Pause();
    Thread.Sleep(3000);

    Console.WriteLine("继续播放");
    player.PlayAsync();
    Thread.Sleep(5000);

    player.Stop();
    Console.WriteLine("结束播放");
}