Customizing to use branded colors and styles is simple and for that the steps are exactly the same as they are for the Native Samples. This sample uses all the default implementation and colors for the app. That's it! Now when the Android App is launched, it gets the value set in the CastOptionsProvider and initializes the Cast SDK! Further Customization and Tips Using the Receiver ID that you get from the Chromecast Dashboard as part of the initial setup, the initialization code very simple : This is so that we can enable the service from any page in the Xamarin.Forms layer. Last step is to initialize the Chromecast SDK, which in this sample is done via a ChromecastService. Public class XamSessionManagerListener : SessionManagerListener Initialize Chromecast Service The Video player is using AVPlayer and the setup for that is as you would normally for video playback. PlayerPageRender is where we implement the Video Player for local playback, the Cast Button and setup the Session Hooks into the Cast Sessions. Setup Platform Specific Implementation Xamarin.iOSįor the Xamarin.iOS app, the implementation shows how to implement the player page as a Page Renderer. For a refresher in Custom Renderers in Xamarin Forms, checkout the documentation page. This is the recommended UX Design from Google, which you can read more about in the UX Design Checklist.Īs seen in popular Video Streaming applications as well as the UX Design Checklist, the option to Cast appears on many pages and when in Cast Connected State, the mini player controls are available at the bottom of most app pages, so these Controls are implemented as Custom Renderers in this project. The two UI Components that are native but need to be displayed as components in the Xamarin.Forms shared app code are: First, let's setup the shared UI components, that appear on both the native players as well as the shared views in the Xamarin.Forms project. For session management, the based on the Cast Connection state, the system uses the Video Player session management and the Cast Session Management to control app behavior and state of the UI components.Įach of these events are tied to the State of the Video Player and Chromecast. Each of these controls are a part of the framework with default styling and can be customized as needed. The UI components are the Cast button, the Mini Player and the Expanded Player. Integrating the Cast into the app involves adding three main UI components and adding Session Management between the video player and Cast Framework. The Chromecast framework is developed to work with the Native Video Players or with any other third-party Video Player Control. In this post, we'll see two different ways to implement support into a Xamarin.Forms app. Only caveat being, these frameworks are native to each platform, there is no cross platform Xamarin.Forms implementation for it yet. The Google Chromecast Framework is provided to us as nugets maintained by the Xamarin team, there is no need to create any Binding project for it. Once the steps are completed, make a note of the Application ID, this is all we need to setup the Xamarin app to connect with the receiver. If you choose not to publish the receiver application, be sure to follow the guide to setup a device for development so you can debug the receiver application. To create and setup the default Media Receiver, the steps are very clearly explained in the Google Cast Guide. For more details on customizing the Receiver itself, you can check the Google Documentation. In this post, the sample is built like the Google Cast Samples, using the default Media Receiver with the default video support and styling. ![]() A Receiver Application: this is what hosts the video on the Chromecast Device.A Sender Application: in this post, it will be our Xamarin App.There are 2 main components for a Cast App: Before we get started, there are a few initial steps to be taken. If the video/audio browsing app is built using Xamarin.Forms, this post walks you through how to add the support for video Chromecast through 2 ways, using a Xamarin.Forms Page Renderer or via a embedded native page. If you are creating a video or even audio app, you can add Chromecast Support for it easily. Implementing Chromecast with Xamarin.Forms
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |