Skip to content

Commit

Permalink
Fix googlecast
Browse files Browse the repository at this point in the history
  • Loading branch information
pjcollins committed Jun 18, 2024
1 parent ab96f71 commit 798cda6
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 55 deletions.
10 changes: 8 additions & 2 deletions googlecast/macios/GoogleCast.Binding/GoogleCast.Binding.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,14 @@

<Target Name="NativeDependencies">
<PropertyGroup>
<GoogleCastiOSSdkVersion>4.8.0</GoogleCastiOSSdkVersion>
<GoogleCastiOSSdkUrl>https://dl.google.com/dl/chromecast/sdk/ios/GoogleCastSDK-ios-$(GoogleCastiOSSdkVersion)_dynamic_xcframework.zip</GoogleCastiOSSdkUrl>
<!-- TODO: Update this URL once a new official cast SDK is released.
The 4.8.x versions of the Google Cast SDK contains a bug that breaks the cast button on physical iOS devices:
https://issuetracker.google.com/issues/298066142
<GoogleCastiOSSdkVersion>4.8.1</GoogleCastiOSSdkVersion>
<GoogleCastiOSSdkUrl>https://dl.google.com/dl/chromecast/sdk/ios/GoogleCastSDK-ios-$(GoogleCastiOSSdkVersion)_dynamic.zip</GoogleCastiOSSdkUrl>
-->
<GoogleCastiOSSdkUrl>https://github.com/react-native-google-cast/google-cast-sdk-dynamic-xcframework-no-bluetooth/archive/refs/tags/4.7.1.zip</GoogleCastiOSSdkUrl>
</PropertyGroup>

<DownloadFile SourceUrl="$(GoogleCastiOSSdkUrl)" DestinationFolder="$([System.IO.Path]::GetFullPath($(MSBuildProjectDirectory)/../native/build/deps))">
Expand Down
3 changes: 3 additions & 0 deletions googlecast/macios/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ This folder contains a slim binding for the Google Cast SDK.
```

### Configure
To deploy this sample to a physical iOS device you will need to open `native/MauiGoogleCast.xcodeproj`
in Xcode and configure the signing team/settings in Targets -> MauiGoogleCast -> Signing & Capabilities.

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

[0]: https://developers.google.com/cast
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@
/* Begin PBXBuildFile section */
64B9934B2B97A71D00BAFB55 /* MauiGoogleCast.h in Headers */ = {isa = PBXBuildFile; fileRef = 64B9934A2B97A71D00BAFB55 /* MauiGoogleCast.h */; settings = {ATTRIBUTES = (Public, ); }; };
64B993572B97A7B300BAFB55 /* MauiGoogleCast.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64B993562B97A7B300BAFB55 /* MauiGoogleCast.swift */; };
D0D666252C06BE5F005451D1 /* GoogleCast.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0D666232C06BD7B005451D1 /* GoogleCast.xcframework */; };
D0D666262C06BE5F005451D1 /* GoogleCast.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = D0D666232C06BD7B005451D1 /* GoogleCast.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
D0A597A62C211F9D00C52635 /* GoogleCast.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0A597A42C211EE600C52635 /* GoogleCast.xcframework */; };
D0A597A72C211F9D00C52635 /* GoogleCast.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = D0A597A42C211EE600C52635 /* GoogleCast.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
D0D666272C06BE5F005451D1 /* Embed Frameworks */ = {
D0023C6E2C210F8100EFDC57 /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
D0D666262C06BE5F005451D1 /* GoogleCast.xcframework in Embed Frameworks */,
D0A597A72C211F9D00C52635 /* GoogleCast.xcframework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -31,15 +31,15 @@
64B993472B97A71D00BAFB55 /* MauiGoogleCast.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = MauiGoogleCast.framework; sourceTree = BUILT_PRODUCTS_DIR; };
64B9934A2B97A71D00BAFB55 /* MauiGoogleCast.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MauiGoogleCast.h; sourceTree = "<group>"; };
64B993562B97A7B300BAFB55 /* MauiGoogleCast.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MauiGoogleCast.swift; sourceTree = "<group>"; };
D0D666232C06BD7B005451D1 /* GoogleCast.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = GoogleCast.xcframework; path = "build/deps/GoogleCastSDK-ios-4.8.0_dynamic_xcframework/GoogleCast.xcframework"; sourceTree = "<group>"; };
D0A597A42C211EE600C52635 /* GoogleCast.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = GoogleCast.xcframework; path = "build/deps/google-cast-sdk-dynamic-xcframework-no-bluetooth-4.7.1/GoogleCast.xcframework"; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
64B993442B97A71D00BAFB55 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
D0D666252C06BE5F005451D1 /* GoogleCast.xcframework in Frameworks */,
D0A597A62C211F9D00C52635 /* GoogleCast.xcframework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -75,7 +75,7 @@
64B993512B97A7A200BAFB55 /* Frameworks */ = {
isa = PBXGroup;
children = (
D0D666232C06BD7B005451D1 /* GoogleCast.xcframework */,
D0A597A42C211EE600C52635 /* GoogleCast.xcframework */,
);
name = Frameworks;
sourceTree = "<group>";
Expand All @@ -102,7 +102,7 @@
64B993432B97A71D00BAFB55 /* Sources */,
64B993442B97A71D00BAFB55 /* Frameworks */,
64B993452B97A71D00BAFB55 /* Resources */,
D0D666272C06BE5F005451D1 /* Embed Frameworks */,
D0023C6E2C210F8100EFDC57 /* Embed Frameworks */,
);
buildRules = (
);
Expand Down
2 changes: 1 addition & 1 deletion googlecast/macios/sample/GoogleCastButtonHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ protected override NativeGoogleCastButton CreatePlatformView()
#if IOS
var b = new GoogleCastButton();
b.Frame = new CoreGraphics.CGRect(0, 0, 24, 24);
b.TintColor = UIKit.UIColor.Gray;
b.TintColor = UIKit.UIColor.Orange;
return b;
#else
return null;
Expand Down
6 changes: 0 additions & 6 deletions googlecast/macios/sample/MainPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@
<VerticalStackLayout
Padding="30,0"
Spacing="25">
<Image
Source="dotnet_bot.png"
HeightRequest="185"
Aspect="AspectFit"
SemanticProperties.Description="dot net bot in a race car number eight" />

<Label
Text="Google Cast Demo"
Style="{StaticResource Headline}"
Expand Down
75 changes: 37 additions & 38 deletions googlecast/macios/sample/MainPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,38 +1,37 @@
namespace GoogleCast.Sample;

public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
}

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

if (googleCastManager is null)
{
googleCastManager = new GoogleCast.GoogleCastManager();
googleCastManager.Configure();

#if IOS
await Permissions.RequestAsync<Permissions.NetworkState>();
#endif
}
}

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",
"video/mp4",
"Big Buck Bunny",
"Big Buck Bunny (open-source movie)",
"https://peach.blender.org/wp-content/uploads/title_anouncement.jpg",
100,
100);
}
}

namespace GoogleCast.Sample;

public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
}

GoogleCast.GoogleCastManager? googleCastManager;

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

if (googleCastManager is null)
{
googleCastManager = new GoogleCast.GoogleCastManager();
googleCastManager.Configure();

#if IOS
await Permissions.RequestAsync<Permissions.NetworkState>();
#endif
}
}

void OnLoadMediaBtnClicked(object sender, EventArgs e)
{
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)",
"https://peach.blender.org/wp-content/uploads/title_anouncement.jpg",
100,
100);
}
}

0 comments on commit 798cda6

Please sign in to comment.