如何获得axVLCPlugin21来播放axVLCPlugin21控制窗口大小的视频?

时间:2018-11-03 17:26:52

标签: c# vlc libvlc

我正在axVLCPlugin21中播放1280 x 720的视频文件,如下所示:

var file = @"C:\test\Amex.mov";
var convertedURI = uri.AbsoluteUri;
axVLCPlugin21.playlist.add(convertedURI);
axVLCPlugin21.playlist.play();

视频确实可以正常播放,但是它的完整尺寸为1280x720,窗口尺寸是该尺寸的1/3。我的理解是VLC应该自动将视频缩放到axVLCPlugin21控制窗口的大小。我正在使用几天前下载的最新版本的VLC 3.0.4。我正在使用VS2015和.NET 4.5(我也尝试过.NET 4.6和.NET 4.7。完整的VLC应用程序以窗口大小播放视频吗?我需要在axVLCPlugin21中进行设置,以使其自动缩放视频达到控制窗口的大小?

1 个答案:

答案 0 :(得分:0)

  

换句话说,我想要的是将视频适合窗口

我遇到了同样的问题,但是我的项目是C ++,要完成此操作,您需要在InitializeComponent()之后将视频比例设置为1,否则会出现异常。

public ref class MyForm : public System::Windows::Forms::Form
    {
    public:
        MyForm(void)
        {
            InitializeComponent();
            this->axVLCPlugin21->video->scale = 1;
            //
            //TODO: Add the constructor code here
            //
        }
//Rest of the C++ file...

我认为代码在C#中看起来像这样:

public partial class MyForm : Form
    {
    public MyForm()
        {
            InitializeComponent();
            this.axVLCPlugin21.video.scale = 1;
            //
            //TODO: Add the constructor code here
            //
        }
//Rest of the C# file...

您还可以将所有axVLCPlugin21组件包装在一种方法中,以设置其所有视频比例,并在InitializeComponent()之后调用该方法(如果您想要更精美的东西)。

让我知道此解决方案是否对您有用,因为它对我有用。