LibVLC and MediaPlayer instanciations
Hello,
There is something that bothers me about the instantiation of the LibVLC and MediaPlayer classes. In the LibVLCSharp.Forms.Shared.VideoView class, there are two properties MediaPlayer and LibVLC with some public setters. So, the developer can think that he can create its own instance of LibVLC and pass it to the VideoView. But, it's not the case, the instanciation is always done by the platform specific VideoView. Why we shouldn't give the posibility to the developer to set himself the LibVLC and MediaPlayer properties ? In my opinion, it should be a better separation of concerns if the instanciation is done in the LibVLCSharp.Forms.Shared.VideoView class in case the developper didn't set himself the properties (and we can remove the CliOptions property) :
public class VideoView : View
{
private LibVLC _libVLC;
public LibVLC LibVLC
{
get => _libVLC ?? (_libVLC = new LibVLC());
set => _libVLC = value;
}
private MediaPlayer _mediaPlayer;
public MediaPlayer MediaPlayer
{
get => _mediaPlayer ?? (_mediaPlayer = new MediaPlayer(LibVLC));
set => _mediaPlayer = value;
}
}
What do you think about it ?
Cordially, Stephane.