public async void TestLoadingAndStoppingMedia() { AutoResetEvent _autoResetEvent = new AutoResetEvent(false); var chromecast = await TestHelper.FindChromecast(); var client = new ChromecastClient(); await client.ConnectChromecast(chromecast); var status = await client.LaunchApplicationAsync("B3419EF5"); var media = new Media { ContentUrl = "https://commondatastorage.googleapis.com/gtv-videos-bucket/CastVideos/mp4/DesigningForGoogleCast.mp4" }; MediaStatus mediaStatus; //We are setting up an event to listen to status change. Because we don't know when the video has started to play client.GetChannel <IMediaChannel>().StatusChanged += async(object sender, EventArgs e) => { if (client.GetChannel <IMediaChannel>().Status.First().PlayerState == PlayerStateType.Playing) { mediaStatus = await client.GetChannel <IMediaChannel>().StopAsync(); _autoResetEvent.Set(); } }; mediaStatus = await client.GetChannel <IMediaChannel>().LoadAsync(media); //This checks that within 5000 ms we have loaded video and were able to pause it Assert.True(_autoResetEvent.WaitOne(5000)); }
public async void TestVolume() { var chromecast = await TestHelper.FindChromecast(); var client = new ChromecastClient(); await client.ConnectChromecast(chromecast); var status = await client.GetChannel <ReceiverChannel>().SetVolume(0.1); Assert.Equal(0.1, status.Volume.Level.Value, precision: 1); status = await client.GetChannel <ReceiverChannel>().SetVolume(1.0); Assert.Equal(1.0, status.Volume.Level.Value, precision: 1); }
public async void TestMute() { var chromecast = await TestHelper.FindChromecast(); var client = new ChromecastClient(); await client.ConnectChromecast(chromecast); var status = await client.GetChannel <ReceiverChannel>().SetMute(true); Assert.True(status.Volume.Muted); }
public async void TestStoppingApplication() { var chromecast = await TestHelper.FindChromecast(); var client = new ChromecastClient(); await client.ConnectChromecast(chromecast); var status = await client.LaunchApplicationAsync("B3419EF5"); status = await client.GetChannel <ReceiverChannel>().StopApplication(status.Applications[0].SessionId); Assert.Null(status.Applications); }
public async void TestLoadingMedia() { var chromecast = await TestHelper.FindChromecast(); var client = new ChromecastClient(); await client.ConnectChromecast(chromecast); _ = await client.LaunchApplicationAsync("B3419EF5"); var media = new Media { ContentUrl = "https://commondatastorage.googleapis.com/gtv-videos-bucket/CastVideos/mp4/DesigningForGoogleCast.mp4" }; _ = await client.GetChannel <IMediaChannel>().LoadAsync(media); }