Last active
April 17, 2018 14:48
-
-
Save hwada/22ea90018069c71fc02566b7db2944c3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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