Skip to content

Instantly share code, notes, and snippets.

@hwada
Last active April 17, 2018 14:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hwada/22ea90018069c71fc02566b7db2944c3 to your computer and use it in GitHub Desktop.
Save hwada/22ea90018069c71fc02566b7db2944c3 to your computer and use it in GitHub Desktop.
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