mfkl / libvlc-nuget

NuGet packaging setup for LibVLC
GNU Lesser General Public License v2.1
61 stars 10 forks source link

LibVLCSharp.Forms.WPF MediaPlayer plays Media in a seperate window #40

Closed noobsoftware closed 2 years ago

noobsoftware commented 2 years ago

I have LibVLCSharp.Forms.WPF and LibVLCSharp.WPF and VideoLAN.LibVLC.Windows installed in my WPF project, and i have the same code as i have in a macOS project for the MediaPlayer and Media in my Xamarin.Forms project (shared code project) and it is my understanding that this should be enough for Xamarin.Forms to be able to play media but the video always opens in a seperate window, i remember reading this in some docs somewhere but i can't find it again. How can i fix this?

To clarify i have a VideoView elementin my xamarin.forms project with a MediaPlayer and when i set the media it opens in a new window instead of the VideoView in Xamarin.Forms.

noobsoftware commented 2 years ago

Got it working from this code:

namespace AwsomeSample.WPF
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : FormsApplicationPage
    {
        public MainWindow()
        {
            InitializeComponent();
            InitDependencies();
            Forms.Init();
            LoadApplication(new AwsomeSample.App());
        }
        void InitDependencies()
        {
            var init = new List<Assembly>
            {
                typeof(VideoView).Assembly,
                typeof(VideoViewRenderer).Assembly
            };
        }
    }
}