Return to site

Xamarin Tvos Play Streaming Mediamultiprogramem

broken image


  1. IOS AutoPlay Shows Previous Video · Issue #726 - GitHub
  2. See Full List On Devblogs.microsoft.com
  3. Code Xamarin: Play Audio In Xamarin Forms Using Xam.Plugin ..
  4. TvOS
There may be a few occasions when you want to take a screenshot of your app, such as for sending to support. Xamarin.Forms doesn't have this functionality; hence we will have to create a custom renderer for iOS and Android to capture the screen.
See full list on devblogs.microsoft.com

Xamarin Blog An open source mobile platform for building Android, iOS, macOS, watchOS, and tvOS apps with.NET. Delivering Rich Media Experiences with the Xamarin.Forms Video Player. Jan 09, 2019 Play Audio in Xamarin Forms using Xam.Plugin.SimpleAudioPlayer A light-weight and easy to use cross-platform audio player for Windows UWP, Xamarin.iOS, Xamarin.Android, Xamarin.Mac, Xamarin.tvOS and Xamarin.Forms. Load wav and mp3 files from any location including a shared library. Works well for sound effects or music. Xamarin wraps low level native APIs so you are able to access sensors and other platform specific features. Xamarin.iOS projects compile to.app files that can be deployed to Apple mobile devices. Xamarin.Android projects compile to.apk files, the application package used for deploying to Android devices.

When contemplating iOS or Android program growth, the majority of us consider Objective-C vs Swift, and Java firstly. Being considered native technology stacks, they're most frequently used cellular development applications in regards to iOS along.


Interface and Dependency Injection

If we want to use this in our class library, we will need to create an interface to use, then use DependencyService or another IoC framework. If you are using a Shared project, you won't need this. See Dependency Injection, if you require more information on this pattern.

Android

Place this code, in your Android project.

IOS AutoPlay Shows Previous Video · Issue #726 - GitHub


App Programming Guide for tvOS
In your MainActivity.cs, add in the following code to register your service. In here, we need to pass through the current activity.

iOS

Place this code in your iOS project.

Usage

Now you can use this service anywhere in your app. Simply use this code to get an instant screenshot of your app.
You can then either save this to file storage.
If you want to display the screenshot, you can assign it to a property in your ViewModel.
Then use a ByteToImageConverter.
To finally display your image in XAML, add the converter to your resource dictionary.
Then use with an image, bound to your ViewModel property.

Mórbido offers podcasts, streaming videos, news, and other content for their fans through a Xamarin app that is available for Android users. Unit fourthird grade reading streets.

Key technologies used

  • Xamarin.Forms
  • Visual Studio 2015
  • Azure Media Services
  • Azure SQL Database
  • Azure Blob storage
  • Azure Virtual Machines

Core project team

  • Ricardo Pons (@RicardoPonsDev) – Senior Developer, Mórbido
  • Vianey Juarez Araujo (@VIANEYsitaa) – Technical Evangelist, Microsoft

Customer profile

Mórbido is a multiplatform content generator. The company started as a film festival, but now their services extend to a website, TV network, film distributor, radio show, social media pages, and a printed magazine.

Mórbido's content revolves around horror, science fiction, and fantasy and generates information on a daily basis on all its platforms for more than 5 million people from all over Latin America.

Problem statement

'The constant and dynamic transformation of the entertainment industry, coupled with the insatiable interest of our fans to consume all kinds of content at all times, everywhere and in all possible devices and our project being a multiplatform generator of content and events throughout Latin America, led us to the conclusion that a mobile app was the only real option we had to concentrate everything; then we started developing an application that had the capacity and strength to satisfy our current needs and allow us to continue growing.' —Pablo Guisa Koestinger, Mórbido CEO

Mórbido needed a mobile app because they have different audience channels, such as the magazine, TV, movies, web page, and social media, and they need this app to gather all of these channels. With it, they will start collecting all the information from their users (or as they call them, fans) because currently they don't have a way to know how many fans are cross-consuming their products. For example, they don't have a way to know how many users who buy the magazine also are viewing the TV channel.

Through this app, Mórbido will have a way to know more about their fans and collect information about them. With this information, they will be able to offer specific promotions, discounts, or advertisements.

Solution, steps and delivery

Why Xamarin

Mórbido selected Xamarin because they are going to going to deliver this app for Universal Windows Platorm (UWP), Android, and iOS, so they wanted to take advantage of Xamarin multiplatform capabilities and reach most of the possible devices used by their fans.

The Mórbido development team is familiar with UWP development, so they already know XAML and C#. The learning curve for Xamarin was smaller than learning each native language for Android and iOS.

Challenges

One of the challenges encountered while developing the app was related to video and audio streaming. Mórbido uses the Smooth Streaming protocol to deliver content. The file name extension of the video that we get is '.ismv', and the Xamarin native player is not compatible with it.

Mórbido decided to use Smooth Streaming in the back end because it offers the possibility to change video resolution in real time depending on the Internet connection speed of the client.

See Full List On Devblogs.microsoft.com

The video-streaming challenge was overcome by playing video through Rox Xamarin Video. This component allows the app to progressively play video from Azure Media Services. Also, this player has play and pause controls.

To use this component, we need to install it from NuGet using the following command:

Implementing the player in the project is really simple. After we get the video URL from the back-end web service, we just have to create a view to build the player. Then we assign the URL by binding.

To play audio, we had to implement the Xamarin MediaManager component. To be able to play a podcast within the app, first we need to get the podcast URL.

After we get the URL, we need to add a specific format for Android (M3U8).

Now the player now can play the podcast.

The next step is to implement the device native player and assign the audio file it will play.

It is important to mention that all of the timing and playback indicators of the file being played must be carried manually in the ViewModel podcast.

Another challenge that we found was presenting the news, because we needed to show the image within the news text title, as shown in the following image.

Ap 1100 driver. Currently, the Xamarin built-in table-row appearance is an image next to text or just plain text, so we needed to create our own. To do so, we needed to add a custom layout and a custom view.

Custom layout

Custom view

Code excerpts

The Mórbido app connects to the back end through HTTP requests. To make it secure, Mórbido implemented OAuth to be able to get the required info in JSON format, so then it could be deserialized and passed to the app in a clear way.

The following code shows how this back-end call is made. The user token is sent within the service call; in this way, we ensure that it is a secure request.

The Mórbido app has a principal dashboard, which creates an HttpClient class that calls the cloud service to get the info to display. A cancellation token is assigned in case the call is cancelled, so the app doesn't have to wait until the service responds. When the method recieves the JSON response, we parse it to a class that can be used by the application.

The resulting window looks like this:

Code Xamarin: Play Audio In Xamarin Forms Using Xam.Plugin ..

To get the podcast feed, it's a similar method, but here we need to get the podcasts by category.

The resulting window looks like this:

To reproduce a selected podcast, we need to get the podcast URL from the web service. To reproduce the content, we need to replace the MPD format with M3U8; then we put the player in stop mode (in case it's currently playing). At this point, we discovered that AudioPlayer doesn't allow you to play the same file more than once. So we added an alternate URL to play in the module, enabling us to play the audio from the service.

The following diagram shows the architecture of the app.

General lessons

It was really difficult to find information regarding streaming integration with Xamarin. We expect this article to help other developers solve this challenge more quickly.

We tried many NuGet packages to implement streaming, but they crashed and closed the application during testing.

Opportunities going forward

This application was launched at the end of March 2017 for Android and is expected to launch for iOS and UWP later in 2017. Mórbido will use Xamarin for these apps, so they can reuse most of the functionality and speed up the development phase for the other devices.

Another opportunity is related to storing metrics from users. In a future stage of the application, they plan to collect metrics from the users on the app, such as how much time a user spends in each section or the most visited section, and then target ads or show content to users depending on the most visited sections (horror, science fiction, and so on).

Network hacking pdf

Xamarin Blog An open source mobile platform for building Android, iOS, macOS, watchOS, and tvOS apps with.NET. Delivering Rich Media Experiences with the Xamarin.Forms Video Player. Jan 09, 2019 Play Audio in Xamarin Forms using Xam.Plugin.SimpleAudioPlayer A light-weight and easy to use cross-platform audio player for Windows UWP, Xamarin.iOS, Xamarin.Android, Xamarin.Mac, Xamarin.tvOS and Xamarin.Forms. Load wav and mp3 files from any location including a shared library. Works well for sound effects or music. Xamarin wraps low level native APIs so you are able to access sensors and other platform specific features. Xamarin.iOS projects compile to.app files that can be deployed to Apple mobile devices. Xamarin.Android projects compile to.apk files, the application package used for deploying to Android devices.

When contemplating iOS or Android program growth, the majority of us consider Objective-C vs Swift, and Java firstly. Being considered native technology stacks, they're most frequently used cellular development applications in regards to iOS along.


Interface and Dependency Injection

If we want to use this in our class library, we will need to create an interface to use, then use DependencyService or another IoC framework. If you are using a Shared project, you won't need this. See Dependency Injection, if you require more information on this pattern.

Android

Place this code, in your Android project.

IOS AutoPlay Shows Previous Video · Issue #726 - GitHub


In your MainActivity.cs, add in the following code to register your service. In here, we need to pass through the current activity.

iOS

Place this code in your iOS project.

Usage

Now you can use this service anywhere in your app. Simply use this code to get an instant screenshot of your app.
You can then either save this to file storage.
If you want to display the screenshot, you can assign it to a property in your ViewModel.
Then use a ByteToImageConverter.
To finally display your image in XAML, add the converter to your resource dictionary.
Then use with an image, bound to your ViewModel property.

Mórbido offers podcasts, streaming videos, news, and other content for their fans through a Xamarin app that is available for Android users. Unit fourthird grade reading streets.

Key technologies used

  • Xamarin.Forms
  • Visual Studio 2015
  • Azure Media Services
  • Azure SQL Database
  • Azure Blob storage
  • Azure Virtual Machines

Core project team

  • Ricardo Pons (@RicardoPonsDev) – Senior Developer, Mórbido
  • Vianey Juarez Araujo (@VIANEYsitaa) – Technical Evangelist, Microsoft

Customer profile

Mórbido is a multiplatform content generator. The company started as a film festival, but now their services extend to a website, TV network, film distributor, radio show, social media pages, and a printed magazine.

Mórbido's content revolves around horror, science fiction, and fantasy and generates information on a daily basis on all its platforms for more than 5 million people from all over Latin America.

Problem statement

'The constant and dynamic transformation of the entertainment industry, coupled with the insatiable interest of our fans to consume all kinds of content at all times, everywhere and in all possible devices and our project being a multiplatform generator of content and events throughout Latin America, led us to the conclusion that a mobile app was the only real option we had to concentrate everything; then we started developing an application that had the capacity and strength to satisfy our current needs and allow us to continue growing.' —Pablo Guisa Koestinger, Mórbido CEO

Mórbido needed a mobile app because they have different audience channels, such as the magazine, TV, movies, web page, and social media, and they need this app to gather all of these channels. With it, they will start collecting all the information from their users (or as they call them, fans) because currently they don't have a way to know how many fans are cross-consuming their products. For example, they don't have a way to know how many users who buy the magazine also are viewing the TV channel.

Through this app, Mórbido will have a way to know more about their fans and collect information about them. With this information, they will be able to offer specific promotions, discounts, or advertisements.

Solution, steps and delivery

Why Xamarin

Mórbido selected Xamarin because they are going to going to deliver this app for Universal Windows Platorm (UWP), Android, and iOS, so they wanted to take advantage of Xamarin multiplatform capabilities and reach most of the possible devices used by their fans.

The Mórbido development team is familiar with UWP development, so they already know XAML and C#. The learning curve for Xamarin was smaller than learning each native language for Android and iOS.

Challenges

One of the challenges encountered while developing the app was related to video and audio streaming. Mórbido uses the Smooth Streaming protocol to deliver content. The file name extension of the video that we get is '.ismv', and the Xamarin native player is not compatible with it.

Mórbido decided to use Smooth Streaming in the back end because it offers the possibility to change video resolution in real time depending on the Internet connection speed of the client.

See Full List On Devblogs.microsoft.com

The video-streaming challenge was overcome by playing video through Rox Xamarin Video. This component allows the app to progressively play video from Azure Media Services. Also, this player has play and pause controls.

To use this component, we need to install it from NuGet using the following command:

Implementing the player in the project is really simple. After we get the video URL from the back-end web service, we just have to create a view to build the player. Then we assign the URL by binding.

To play audio, we had to implement the Xamarin MediaManager component. To be able to play a podcast within the app, first we need to get the podcast URL.

After we get the URL, we need to add a specific format for Android (M3U8).

Now the player now can play the podcast.

The next step is to implement the device native player and assign the audio file it will play.

It is important to mention that all of the timing and playback indicators of the file being played must be carried manually in the ViewModel podcast.

Another challenge that we found was presenting the news, because we needed to show the image within the news text title, as shown in the following image.

Ap 1100 driver. Currently, the Xamarin built-in table-row appearance is an image next to text or just plain text, so we needed to create our own. To do so, we needed to add a custom layout and a custom view.

Custom layout

Custom view

Code excerpts

The Mórbido app connects to the back end through HTTP requests. To make it secure, Mórbido implemented OAuth to be able to get the required info in JSON format, so then it could be deserialized and passed to the app in a clear way.

The following code shows how this back-end call is made. The user token is sent within the service call; in this way, we ensure that it is a secure request.

The Mórbido app has a principal dashboard, which creates an HttpClient class that calls the cloud service to get the info to display. A cancellation token is assigned in case the call is cancelled, so the app doesn't have to wait until the service responds. When the method recieves the JSON response, we parse it to a class that can be used by the application.

The resulting window looks like this:

Code Xamarin: Play Audio In Xamarin Forms Using Xam.Plugin ..

To get the podcast feed, it's a similar method, but here we need to get the podcasts by category.

The resulting window looks like this:

To reproduce a selected podcast, we need to get the podcast URL from the web service. To reproduce the content, we need to replace the MPD format with M3U8; then we put the player in stop mode (in case it's currently playing). At this point, we discovered that AudioPlayer doesn't allow you to play the same file more than once. So we added an alternate URL to play in the module, enabling us to play the audio from the service.

The following diagram shows the architecture of the app.

General lessons

It was really difficult to find information regarding streaming integration with Xamarin. We expect this article to help other developers solve this challenge more quickly.

We tried many NuGet packages to implement streaming, but they crashed and closed the application during testing.

Opportunities going forward

This application was launched at the end of March 2017 for Android and is expected to launch for iOS and UWP later in 2017. Mórbido will use Xamarin for these apps, so they can reuse most of the functionality and speed up the development phase for the other devices.

Another opportunity is related to storing metrics from users. In a future stage of the application, they plan to collect metrics from the users on the app, such as how much time a user spends in each section or the most visited section, and then target ads or show content to users depending on the most visited sections (horror, science fiction, and so on).

Conclusion

TvOS

The impact of this app is related to Mórbido fans and Mórbido itself. Mórbido will begin collecting information about their fans in a database, such as how many people they are reaching and the various countries they are from, and start offering more content. The fans will be affected because they can watch Mórbido movies without a TV channel subscription and listen to the podcast and news related to horror and science-fiction movies.

Additional resources

  • Working with tables and cells in Xamarin




broken image