Skip to content

Commit

Permalink
[googlecast] Fix warnings in the sample app (#17)
Browse files Browse the repository at this point in the history
The google cast sample has been updated to resolve all build warnings
and improve formatting.
  • Loading branch information
pjcollins authored Apr 30, 2024
1 parent 2883b92 commit 03f352a
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 12 deletions.
12 changes: 12 additions & 0 deletions googlecast/macios/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Google Cast Slim Binding
This folder contains a slim binding for the Google Cast SDK.

### Build and Run
```shell
dotnet build sample -t:Run
```

### Configure
For more details, reference the [Get Started][0] page.

[0]: https://developers.google.com/cast
5 changes: 1 addition & 4 deletions googlecast/macios/sample/GoogleCast.Sample.csproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net8.0-ios</TargetFrameworks>
<!-- <TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.19041.0</TargetFrameworks> -->
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
<!-- <TargetFrameworks>$(TargetFrameworks);net8.0-tizen</TargetFrameworks> -->
<TargetFramework>net8.0-ios</TargetFramework>

<!-- Note for MacCatalyst:
The default runtime is maccatalyst-x64, except in Release config, in which case the default is maccatalyst-x64;maccatalyst-arm64.
Expand Down
5 changes: 5 additions & 0 deletions googlecast/macios/sample/MainPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
Aspect="AspectFit"
SemanticProperties.Description="dot net bot in a race car number eight" />

<Label
Text="Google Cast Demo"
Style="{StaticResource Headline}"
SemanticProperties.HeadingLevel="Level1" />

<Label
Text="Click the icon below to start Google Cast"
Style="{StaticResource SubHeadline}"/>
Expand Down
14 changes: 6 additions & 8 deletions googlecast/macios/sample/MainPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@

public partial class MainPage : ContentPage
{
int count = 0;

public MainPage()
{
InitializeComponent();
}

protected override async void OnAppearing()
{
base.OnAppearing();
protected override async void OnAppearing()
{
base.OnAppearing();

if (googleCastManager is null)
{
Expand All @@ -22,13 +20,13 @@ protected override async void OnAppearing()
await Permissions.RequestAsync<Permissions.NetworkState>();
#endif
}
}
}

GoogleCast.GoogleCastManager googleCastManager;
GoogleCast.GoogleCastManager? googleCastManager;

private void OnCounterClicked(object sender, EventArgs e)
{
googleCastManager.LoadMedia("https://www.sample-videos.com/video123/mp4/720/big_buck_bunny_720p_1mb.mp4",
googleCastManager?.LoadMedia("https://www.sample-videos.com/video123/mp4/720/big_buck_bunny_720p_1mb.mp4",
"video/mp4",
"Big Buck Bunny",
"Big Buck Bunny (open-source movie)",
Expand Down

0 comments on commit 03f352a

Please sign in to comment.