Playing local audio files with .NET MAUI
Dave's Tech Blog
by
1y ago
Previously I wrote about playing audio with .NET MAUI on Android, iOS, Mac Catalyst, and Windows. The main problem with my implementation was that the FilePicker for picking local audio files only worked on Windows. On iOS/Android it let you browse the device, and displayed audio files, but it didn’t let you select an audio file. On Mac Catalyst it did nothing at all. I was convinced these were MAUI bugs. Turns out I was completely wrong! The problem was this block of code: var pickedAudio = await FilePicker.Default.PickAsync(new PickOptions{ PickerTitle = "Select audio file", FileTypes ..read more
Visit website
Playing audio with .NET MAUI
Dave's Tech Blog
by
1y ago
Many apps, whether mobile or desktop, require the ability to play audio. That audio may be remote, stored in the app bundle, or be chosen from the user’s device. However, .NET MAUI currently doesn’t have a cross-platform control capable of playing audio. However, all of the underlying platforms that .NET MAUI supports have native controls for playing audio. Android has MediaPlayer, iOS/Mac Catalyst has AVPlayer, and WinUI has MediaPlayerElement (only available in WinAppSDK 1.2-preview). I’ve used these native types to create a cross-platform Audio control. It’s based on the Video control I cre ..read more
Visit website
Playing video with .NET MAUI on Windows
Dave's Tech Blog
by
1y ago
Previously I wrote about playing video with .NET MAUI on Android, iOS, and Mac Catalyst. The problem platform was Windows because WinUI 3 lacked any media playback controls. This has been rectified with the preview release of the WinAppSDK v1.2, which contains the MediaPlayerElement and MediaTransportControls types. If you want to know how to use these types, see Media players. I’ve updated my VideoPlayer code with Windows support, so it’s now a truly cross-platform Video control. This includes the ability to play remote videos, videos embedded in the app, and video's from the file system. As ..read more
Visit website
Behaviors library for .NET MAUI
Dave's Tech Blog
by
1y ago
Many years ago I wrote a behaviours library for Xamarin.Forms. The conventional view was that behaviours extend the functionality of controls, with typical examples validating user text input. Inspired by the then Blend SDK, my thought was that behaviors can be split into two concepts. Behaviours are attached to a control and listen for something to happen. When the something happens, it triggers one or more actions in response. So actions are invoked by behaviours and executed on a specified control. Typical behaviors are listening for an event firing, or data changing. Typical actions are in ..read more
Visit website
Display a map with .NET MAUI
Dave's Tech Blog
by
1y ago
Many apps, whether mobile or desktop, require the ability to show a map. However, .NET MAUI doesn’t currently have a view (control) capable of displaying a map. That’s frustrating because the underlying platforms that .NET MAUI supports all largely have native map views. Android has the MapView. iOS/MacCatalyst has MKMapView. WinUI has…nothing. So, most of the platforms .NET MAUI runs on can display a map, but .NET MAUI itself lacks a cross-platform view to display a map. Therefore I’ve created a very simple cross-platform Map view. It was written primarily for me to understand how to write ha ..read more
Visit website
Playing video with .NET MAUI
Dave's Tech Blog
by
1y ago
Many apps, whether mobile or desktop, require the ability to play video. That video may be remote, stored in the app bundle, or be chosen from the user’s device. However, .NET MAUI currently doesn’t have a view (control) capable of playing video. That’s frustrating because the underlying platforms that .NET MAUI supports all largely have native views for playing video. Android has the VideoView. iOS/MacCatalyst has AVPlayer. WinUI has…nothing yet, but I understand it’s coming soon. So, most of the platforms .NET MAUI runs on can play video, but .NET MAUI itself lacks a cross-platform view to p ..read more
Visit website
Implicit usings in .NET MAUI
Dave's Tech Blog
by
2y ago
NET MAUI Preview 11 now uses implicit usings to reduce the number of using statements you need to specify at the top of each file. For more information about implicit usings, see this blog post. Specifically, from Preview 11 onwards you don’t need to add using statements for the following namespaces, which are all now available implicitly in .NET MAUI projects: Microsoft.Extensions.DependencyInjection Microsoft.Maui Microsoft.Maui.Controls Microsoft.Maui.Controls.Hosting Microsoft.Maui.Controls.Xaml Microsoft.Maui.Graphics Microsoft.Maui.Essentials Microsoft.Maui.Hosting If you’re new to .N ..read more
Visit website
Invoke platform code in .NET MAUI
Dave's Tech Blog
by
2y ago
Xamarin.Forms has the DependencyService class, which is a service locator that enables apps to invoke native platform functionality from cross-platform code. There’s a four step process for using the DependencyService to invoke native platform functionality: Create an interface for the native platform functionality, in cross-platform code. Implement the interface in the required platform projects. Register the platform implementations with the DependencyService. Resolve the platform implementations from cross-platform code, and invoke them. For more information about the process, see Xamarin ..read more
Visit website
Getting FastLED and ArduinoBLE to co-operate
Dave's Tech Blog
by
2y ago
I recently finished building an Arduino-driven Nixie tube device, that I’ve called Fermenixie, which uses the FastLED library to control the RGB LEDs that act as backlights to the tubes. The device also uses a modified version of ArduinoBLE library, that allows you to communicate with a BLE device (specifically, a tilt hydrometer). The library modifications enabled the retrieval of advertising data using the iBeacon protocol. Using FastLED on its own worked perfectly. Using ArduinoBLE on its own worked perfectly. Every time I combined the two, bluetooth communication became unreliable at best ..read more
Visit website
Get data from a tilt hydrometer on an Arduino
Dave's Tech Blog
by
3y ago
A tilt hydrometer is a submersible thermometer and hydrometer for monitoring fermentation. It’s a Bluetooth LE device that reports data via the iBeacon protocol. Specifically, it broadcasts a major and minor value, which represent the temperature and gravity of the liquid its submersed in, via the manufacturer data. These values can be extracted from the manufacturer data and converted into decimal values. The manufacturer data it broadcasts is a hex string, such as the following: 4c000215a495bb30c5b14b44b5121370f02d74de0047042b00 This data breaks down as follows: Apple beacon Type Length ..read more
Visit website

Follow Dave's Tech Blog on FeedSpot

Continue with Google
Continue with Apple
OR