Audio recording in Xamarin.forms - c#

I have a xamarin.forms project which has to record the audio and save it localy on the app.
Is there any plugin / api which can be used to achieve this?
Also I would like to know the source of the recorind ie. whether it is being recorded from microphone or is it from handsfree (speaker) without using microphone.

There is no plugin that I know of that does this. you could create a generic service interface called IRecorder which has the functionality you need and then implement the IRecorder interface in the platform specific projects using called AndroidRecorder etc using the dependency service
when implementing your platform specific code you can use these samples
Android
iOS
Windows 10

There is an open-source plugin for working with audio recorder in Xamarin.Forms :
https://github.com/NateRickard/Plugin.AudioRecorder

You can use the dependency service to access platform-specific APIs such as AVAudioRecorder on iOS or MediaRecorder on Android.

Related

Programmatically loading native libraries in Xamarin

Our Xamarin app supports some device-specific hardware features for a specific Android device packing an RFID scanner. We don't like to clutter up our basic app with stuff related to this device, so we created a separate Xamarin library containing the logic for this device, which is built to be an Asset of the Droid project. During statup of the app, we check if we are on this specific device and if we are, we programmatically load the hardware specific Xamarin library using Assembly.Load(...) and activate it.
The problem we run into is that the manufacturer of the device provided us with some native android libraries (.so files) that must be used. Normally you would include those in the Droid project with build action AndroidNativeLibrary, but since we want to encapsulate all stuff related to this device in a separate project, we don't want to do this. We have tried the following:
To add them to the device specific Xamarin library with build action AndroidNativeLibrary, but then the app cannot find them. They are probably not saved to disk and therefore they cannot be found.
To add them to the device specific Xamarin library with build action Embedded Resource and save them to disk when the library is started, but none of the locations, where the app searches for native libraries it needs, is accessible. Therefore the app cannot find them and the library cannot work.
I am starting to think that Android has shielded this kind of behavior off, but I am still hoping for some of you to help me with a good trick. Thanks in advance.

Xamarin Forms Manage Alarm Clock

Is it posible to manage the alarm clock from Android and iOS with the same Xamarin Forms code?
I have seen that its possible with nativ code.
thanks!
No.
Xamarin.Forms is essentially an absraction layer over native code.
You will be able to create a user interface that shared between each platform you target, but you will need to write your own abstraction of the native platform API(s) that you wish to consume to get the behavior that you desire. As stated above, you can utilise the Dependency Service to achieve this.

Perform real time continuous speech recognition using Xamarin and Microsoft Speech Service API

I saw on the documentation of the Bing Speech API that it is possible to stream a recording microphone input to the REST service (https://learn.microsoft.com/en-us/azure/cognitive-services/speech/home):
Real-time continuous recognition. The speech recognition API enables
users to transcribe audio into text in real time, and supports to
receive the intermediate results of the words that have been
recognized so far.
However, I was not able to find a sample showing how this could be achieved in a cross-platform fashion using Xamarin Forms.
I have found the following tutorial: https://developer.xamarin.com/guides/xamarin-forms/cloud-services/cognitive-services/speech-recognition/
But in this, the audio stream sent to the API is an already existing audio file, what I would like to achieve, however, is to stream the microphone input of the device running the app (Android, iOS, UWP).
Any insight would be appreciated.
I am afraid that there are no libraries compatible with Xamarin that support real-time Microsoft Speech API. The only compatible is the Bing Speech API which uses the REST protocol and does not offer the real-time transcription.
The real-time transcription requires Speech Service WebSocket protocol which is fully documented. You could implement this interface yourself, but it may be quite a complex task to do it reliably.
There are however native libraries for iOS and Android which do support the real-time streaming functionality. You can see tutorial for iOS and tutorial for Android.
What you could do then is use Xamarin Binding Libraries to bind the native libraries into your Xamarin project. For Java library see this tutorial and for Objective-C library see this tutorial.
Especially creating the Objective-C binding might be a daunting task and it is usually easier to create a Objective-C library that will act as a facade, which then uses the native library. You will know the interface of your facade library and you will then be able to create the binding more easily. You may also consider asking the Xamarin team to create the binding for you, as they maintain a growing collection of third-party library bindings on GitHub.
I have a cross platform solution using Bing Speech. Got the IOS working. Never tested the Android solution.
There is a great library here that should fit your needs:
https://github.com/NateRickard/Xamarin.Cognitive.BingSpeech

Audio player in xamarin.forms

I am looking for a audio player feature to add to my app, I would like to have a play, stop/pause, and progessbar option for the player. I reffered to https://developer.xamarin.com/samples/monodroid/Example_WorkingWithAudio/. I want to implement the feature for android, iOS, and windows.
Are there any available plugins which I can use or any other reference link which can help..
Take a look at the Xamarin-Forms-Labs Plugin it has a Audioservice.
Here is the code for the interface.
And here an usage example
For those who are facing the same issue, you can achieve this by creating the audio player yourself with help of dependency service and native (platform specific) api's.

How to embed vlc in my windows form application with c#

I'm trying to make an app that can control my IP cameras.VLC media player can do this but I don't know how to embed it in my app to add features to it like capture a picture.What should I do?
The VideoLAN Wiki has links about the .Net Interface to VLC as well as C# bindings for libvlc, which is the underlying library of VLC.
You will find there several projects such as VLCdotNet which seems to be something that you can use.
You can also get into the .Net Interface to VLC by looking at the sources of the DMediaPlayer on CodePlex.

Categories