How to get/set current volume level in Xamarin froms? - xamarin

How to get device's current volume level and use that inside our application play sound? Also how to get notified about sound level changed by hardware button or software seekbar?

Xamarin.Forms doesn't have Audio API's yet, so you will need to implement the functionality for each platform on your own. However, there seems to be a library called Xamarin Audio Manager and it should do at least some of the things that you require, take a look at it here on GitHub.
You can then use the project as a good starting point for extending it to meet all your needs. Audio API's in both Android and iOS are relatively easy to understand.

Related

Xamarin and play videos with FairPlay or other DRM

I'm trying to stream a content from Azure Media Services, but I can't get it to work, so I'm wondering if it's doable, and if so, how do I achieve it? The content is protected by FairPlay. Similar issues on Android and Windows.
I tried to use Xamarin Media Player but it doesn't work with FairPlay because it requires an ExoPlayer2 implementation which is not yet in the plugin.
I don't think that is possible with the current version of the Xamarin Media Manager. Let me also correct the mistaken assumption about ExoPlayer2. ExoPlayer is a strictly Android only playback component, and so has nothing to do with FairPlay at all, as FairPlay is Apple only technology.
For FairPlay to work, you have to listen to events that are specific for FairPlay to handle the license exchange. Those do not seem to be implemented in Xamarin Media Manager as far as i can see. So you would have to do those platform specific implementations yourself. Information about these can be found on the Apple Developer site.
For Android, you would likely want to go with Widevine, which is implemented in ExoPlayer. I can't find any documentation for Xamarin Media Manager on how to set that up either though.

Mobile Cross-Platform Camera Frames Extraction

Is there any cross-platform framework for mobile apps (Xamarin, Flutter, React-Native, etc.) that allows accessing frames from the camera's feed live?
In other words, is there any way to perform manipulations on live video (frame-by-frame) in cross-platform environments? (Similarly to this tutorial for iOS).
From what it seems, in Flutter for example, it's possible to display a live preview of the camera, but not to access the frames; and beside some ghost-town questions I couldn't find much online about it.
Xamarin allows you to access and use each and every feature of all platforms.
The code will be platform specific but C#. I have one project in my repo where I'm using Xamarin.iOS to overlay rectangle detection onto the camera live feed. You can implement something similar using Xamarin.Android (using Android specific APIs).
You can then create an abstraction which will be consumed from a Xamarin.Forms app or you go with two separate C# based native apps.

xamarin plug and play architecture

I need to create a application which would take the preference of the user when starting the application for the first time and then the appropriate module would be downloaded for the application. Is it possible using xamarin.forms?
Currently we are using xamarin.forms PCL project and creating app for android and iOS using xamarin.forms.
I don't see why not, though you'd likely be tied to Android. Dynamic execution on iOS is not supported, and I'm not sure about Windows. It should be an easy enough test: click a button, download an assembly from somewhere, dynamically load it, then instantiate a class that implements an interface you're looking for. I've been wanting to do a blog post on this very thing, but alas...
Another option which may be iOS compatible is having some code in JavaScript, then download and run it in a WebView. Though that may be more trouble than it's worth.

Do I need to program BLEduino (arduino with BLE)?

I am doing an iOS app, and I have bought the BLEduino, which is an arduino with BLE technology built-in. The question is, do I need to program something in BLEduino? Can I just turn it on, so it can be discoverable, and then code in Xcode for my app to connect with BLEduino, and etc?
The BLEduino comes pre-loaded with the library firmware (i.e. that processes all BLE communication), and the sketch for the Console module (which interacts with the library). That is, you don't need to program anything into the BLEduino to get started. Thus, yes, plug it in, and it should be discoverable.
You don't need to program anything on the iOS side either to get started. You can use the BLEduino iOS app. The BLEduino platform (firmware library, sketches, iOS app) supports 12 different modules. Simply upload to the BLEduino the corresponding sketch for whichever module you want to use, and it will work with the provided app.
Additionally, the BLEduino app is completely open sourced. I would suggest you play with that before doing one from scratch. That way you can see how to use the BLEduino iOS SDK.
Lastly, if you definitely want to do something completely from scratch (i.e. without the BLEduino iOS SDK), then simply make sure that your CoreBluetooth code complies with the BLEduino BLE Profile, and packet structure.
Alternatively, you can upload your own BLE profile to the BLEduino. In that case, you define your own UUIDs, Characteristics, and packet structure.
There's additional information on the documentation, and forum.

is there a library for xamarin for platform specific features?

I'm developing a cross platform (ios/android/wp) app that needs to do basic things like dialing a number, sending a message, sending an email, reading/writing events in the calendar, taking a picture, etc. All those things have different APIs on the different platforms. Is there a library that abstracts those things and implements them on each platform in the platform's native way?
Have a look at these components:
Xamarin.Mobile
Xamarin.Auth
Xamarin.Social
You could also have a look at this project which is intended for use from within Xamarin.Forms projects:
Xamarin.Forms.Labs
Whilst this project includes a lot of GUI controls intended for Xamarin.Forms apps, it does include abstractions for platform specific services such as:
Accelerometer
Cache
Camera (Picture and Video picker, Take Picture, Take Video)
Device (battery info, device info, sensors, accelerometers)
Display
Geolocator
Phone Service (cellular network info, make phonecalls)
SoundService
Text To Speech
Which you could make use of to abstract out your phone calling / taking photo concerns as needed.

Resources