0

I'm using "MediaPlayerElement" from LibVLCSharp

https://github.com/videolan/libvlcsharp#mediaplayerelement

<vlc:MediaPlayerElement MediaPlayer="{Binding MediaPlayer}" LibVLC="{Binding LibVLC}" />

I try to play a video that is in "/sdcard/video.mp4"

public void OnAppearing()
{
    Core.Initialize();

    LibVLC = new LibVLC("--verbose=2");


    string filePath = "/sdcard/video.mp4";
    var media = new Media(LibVLC, filePath, FromType.FromPath);
    MediaPlayer = new MediaPlayer(media) { EnableHardwareDecoding = true };
    media.Dispose();

    MediaPlayer.Play();
}

However, i always get the error : "Error with media file:///sdcard/video.mp4"

I tried to change the URI : https://learn.microsoft.com/en-us/windows/uwp/app-resources/uri-schemes and put the video in the app folder/temp folder.

But nothing changes, I always get the error.

This code works when a put this URL like the sample

public void OnAppearing()
{
    Core.Initialize();

    LibVLC = new LibVLC("--verbose=2");

    var media = new Media(LibVLC, new Uri("http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4"));
    MediaPlayer = new MediaPlayer(media) { EnableHardwareDecoding = true };
    media.Dispose();

    MediaPlayer.Play();
}

But i want to play a local video instead.

Arnaud
  • 1
  • 2

0 Answers0