How to play audio from local folder in xamarin forms? - xamarin.forms

Please can some one show me or direct me step by step on How to play audio from local folder in xamarin forms for android and iOS Project?
Thank you.

Put there mp3 in these folders , Android Assets en iOS Recourses
Property
And iOS property
Install this - pluging Xam.Plugin.SimpleAudioPlayer
To play in a Button.Clicked
var player = Plugin.SimpleAudioPlayer.CrossSimpleAudioPlayer.Current;
player.Load("Drup.mp3");
player.Play();

Related

RefreshView when target Platform is UWP then it is not wokring

RefreshView when target paltform is UWP it is not working i.e I'am unable to apply pull to refresh, but on iOS and Android it is Working fine.
RefreshView when target paltform is UWP it is not working
I have to say the RefreshView only avaiable for touch screen, if you use mouse mode, it will not response your drag gestue. please run your app with simulator or touch device.
For more detail please refer to Run UWP apps in the simulator document

Why doesn't this generic code which works for displaying a PDF in iOS, but not in Android?

In the code below I write a PDF file out to the App Data Directory and open it in a Xamarin WebView. This works fine in iOS but in Android nothing displays. Why does this work in iOS but not Android?
I tried saving it to different locations like the CacheDirectory too.
public DocumentViewer(JaxrsGetDocumentResults doc)
{
InitializeComponent();
string directory = FileSystem.AppDataDirectory;
var file = Path.Combine(directory, doc.FileName);
if (!File.Exists(file))
{
File.WriteAllBytes(file, doc.FileBytes);
}
wv.Source = new Uri("file://" + file);
}
I would think this would work the same in Android since Android can load PDF's in its web browser. In other words I can open Chrome in the Android emulator and navigate to a PDF url and it loads. See example below:
The WebView control can display PDF files on the iOS platform, but not on the Android and Windows Phone platforms due to lack of platform support. On the Android and Windows Phone platforms, Mozilla's pdf.js can be used to add this support. pdf.js is a JavaScript library for parsing and rendering PDFs using the HTML5 canvas element.
So on Android, you have to create a custom renderer and use like pdf.js to display the PDF in a Webview.
Here is the official documentation and tutorial on how to achieve that.

Xamarin Forms WatchOS main iOS app couldn’t be found

I am trying to create a watchOS app in an existing Xamarin Forms application in Visual Studio 2017 on Windows. I have followed all the steps listed here. I have also added watchOS app project reference to the main iOS app by selecting add reference option of the references node of the main iOS app. Solution also builds successfully but when I try to launch watchOS app in watch simulator, it instantly throws the below error without even launching the simulator.
Error:
Main iOS app couldn't be found, please make sure you've created an iOS app and it is referencing
Please suggest what I am doing wrong.
I think you have add the watchOS app reference in a wrong place.
You should add the reference in xxx.iOS projecct instead of xxx(xamarin.forms project).
Let me show a screenshot for you:
Update:
Steps:
I create a new MobileApp(Xamarin.forms) project(platform iOS).
Right click on the solution -->add --> new project -->Apple Watch -->watchOS app-->ok.
Right click on the xxx.iOS project --> add---> reference --> check XXX.watchOSApp
Right click on the xxx.WatchOSApp --> Set as Setup Project.
(Clean and rebuild) Run on the appleWatch simulator.

How to use open file dialog in xamarin forms

Please help me, I want to pick the pdf file locally in xamarin forms(cross platform). So on a button click i need to open the file dialog to pick pdf file locally.
This is not something that can be done in a true cross-platform way. For example; on iOS you cannot access the filesystem directly, while on Android and UWP you can.
I have created a NuGet Xamarin.Plugin.FilePicker (Github) (original by rafaelrmou), which tries to solve this for you. On iOS you need iCloud Drive to be configured.
If you do not want to use the plugin you could always look into the code and roll your own.

Why is mp4 video broke in webkit on ios 6

I am developing an IOS app using Flex Mobile. to launch Native ios video player I create an instance of StageWebView and load a URL that is pointing to an MP4 file.
This works great as of ios 5.1.x but I just upgraded a device to IOS 6 and this does not work. the video player launches embedded in the webstageview but shows the X through the play button indicating that it can't play the video.
A preset with lower field dominance should do it. Progressive videos play fine

Resources