与VlcDotNet库展示视频 [英] Display video with VlcDotNet library

查看:1823
本文介绍了与VlcDotNet库展示视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我做了一个C#Windows窗体应用程序在Visual Studio 2012中,从这个网页添加DLL文件:的http:// vlcdotnet。 codeplex.com/
我已经得到视频,使用此代码工作:

I have made a C# Windows Forms Application in Visual Studio 2012 and added dlls from this webpage: http://vlcdotnet.codeplex.com/ I have already gotten video to work with this code:

VlcControl player = new VlcControl();
Vlc.DotNet.Core.Medias.MediaBase media = new 
    Vlc.DotNet.Core.Medias.PathMedia(@"path\movie.avi");
player.Media = media;
player.Play();



但是,这显示在另一个窗口,我有超过没有控制权。我将如何嵌入我的格式的视频?

But that displays it in another window and I have no control over that. How would I embed the video in my form?

我还没有找到如何做到这一点编程的任何文档。大多数人在教程有某种在其工具箱上市VLC控制的,但我没有,所以我需要做的,与代码。

I have not found any documentation on how to do this programmatically. Most people in tutorials have some sort of vlc control listed in their toolbox, but I haven't, so I would need to do that with code.

我已经尝试使用面板VlcControl的父:

I have tried using panel as VlcControl's parent:

player.Parent=panel1;

电影仍然发挥,但没有视频,唯一的声音。
什么样的容器,我应该使用和如何使其显示的视频

Movie still plays, but there is no video, only sound. What kind of container should I use and how to make it show the video?

更多信息:
在这里:的在WPF托管VLC.DotNet控制该说,这是可以嵌入在WPF WindowsFormsHost元素里面的视频。但是,在Windows窗体应用程序,只有ElementHost的提供给我。我可以用它来嵌入的视频,如果是,怎么样?

More information: Here: VLC.DotNet Control Hosted in WPF it is said that it is possible to embed video inside WindowsFormsHost element in WPF. However, in Windows Forms Application, there is only ElementHost available to me. Could I use that to embed videos and if yes, how?

推荐答案

我已经找到了解决办法。我需要播放添加到面板的控制和设置播放器的大小。这是,如果有人将永远需要它:

I have found the solution. I needed to add player to panel's controls and set the player size. Here it is, if anyone will ever need it:

player = new VlcControl();

panel1.Controls.Add(player);

player.BackColor = System.Drawing.Color.Black;
player.ImeMode = System.Windows.Forms.ImeMode.NoControl;
player.Location = new System.Drawing.Point(0, 0);
player.Name = "test";
player.Rate = 0.0F;

player.Size = new System.Drawing.Size(1024, 768);

Vlc.DotNet.Core.Medias.MediaBase media = new 
    Vlc.DotNet.Core.Medias.PathMedia(@"path\movie.avi");
player.Media = media;
player.Play();

这篇关于与VlcDotNet库展示视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆