Skip to content

Instantly share code, notes, and snippets.

@hwada hwada/say.cs
Last active Apr 17, 2018

Embed
What would you like to do?
using GoogleCast;
using GoogleCast.Channels;
using GoogleCast.Models.Media;
using System.Linq;
using System.Threading.Tasks;
namespace SayGoogleHome
{
class Program
{
static void Main(string[] args)
{
Say().GetAwaiter().GetResult();
}
static async Task Say()
{
var receiver = (await new DeviceLocator().FindReceiversAsync()).First();
var sender = new Sender();
await sender.ConnectAsync(receiver);
var mediaChannel = sender.GetChannel<IMediaChannel>();
await sender.LaunchAsync(mediaChannel);
var url = "https://www.dropbox.com/s/zc3mzkh4b6l6nub/say.wav?dl=0&raw=1"; // 任意の音声ファイル
var mediaStatus = await mediaChannel.LoadAsync(new Media()
{
//ContentType = "audio/mp3",
ContentId = url
});
await sender.DisconnectAsync();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.