Skip to content

Xamarin - How to play an embedded video

Hey,

I had no problem streaming a video, but struggle to create a new media instance from an resource embedded in the shared project in a Xamarin Forms App. We tried many different things to get the video running, but none worked. Therefore, I have the following two questions:

  • How can I get the path to the shared ressource, so that the library can find it? What Fromtype should I (ex. FromType.FromLocation)?
  • If this is not possible, how can I get the correct path to play a resource embedded in a native project and play it in the shared project? (can not use android.resource://.. since MEdia will add suffix File://)

Here is where the file lays within the shared project:

shared

Here is where the file lays within the android project:

aRes

Here are is the code:

https://github.com/BenBausch/Issues/tree/master/VlcVideoApp/VlcVideoApp

Possible Fix: I think the main problem is, that I might use a wrong path.

Thanks in advance and sorry for the struggle :)

Edited by Ben Bausch
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information