Code: Select all
VideoCtrlDataSet.StreamSourcesRow myStream;
public ViewVideo(VideoCtrlDataSet.StreamSourcesRow aStream)
{
InitializeComponent();
myStream = aStream;
}
private void ViewVideo_Load(object sender, EventArgs e)
{
vlcVideo.AddToPlayList("udp://@" + myStream.MulticastIP + ":" + myStream.Port, "", null);
vlcVideo.Play();
//MessageBox.Show(vlcVideo.VideoSize.Height.ToString());
this.Size = vlcVideo.VideoSize;
this.Text = "Height: " + this.Size.Height + " Width: " + this.Size.Width;
}
Code: Select all
this.vlcVideo.AllowVideoAdjustments = false;
this.vlcVideo.Volume = 50;
I'm probably missing something basic here, but could anyone explain how to initalize the NativeLibVlc-object? Compiling the DLL is no problem, I can add the user control to a form, but where to go next?be sure you call Initialize() on the NativeLibVlc object before making any other calls to it.
Code: Select all
string[] initOptions = { "vlc",
"--no-one-instance",
"--no-overlay",
"--no-snapshot-preview",
"--no-drop-late-frames",
"--disable-screensaver" };
Code: Select all
public partial class Form1 : Form
{
VLanControl.VlcUserControl vlc = new VLanControl.VlcUserControl();
Timer timer;
bool sizingNeeded;
public Form1()
{
InitializeComponent();
vlc.Parent = this;
vlc.Dock = DockStyle.Fill;
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
this.sizingNeeded = true;
this.vlc.AddAndPlay(@"YourMediaFile.ext", "");
this.timer = new Timer(this.components);
this.timer.Interval = 500;
this.timer.Tick += timer_Tick;
this.timer.Start();
}
void timer_Tick(object sender, EventArgs e)
{
if(this.sizingNeeded && (this.vlc.State == VLanControl.PlayerState.Playing))
{
this.ClientSize = this.vlc.VideoSize;
this.sizingNeeded = false;
}
}
}
Code: Select all
Private Sub PlayVideoFile()
Dim Video As New VLanControl.VlcUserControl
Dim sFilename As String, sTitle As String
Dim Options(2) As String
Video.Parent = Me
Video.Dock = DockStyle.Fill
sFilename = "dvdsimple://E:@1:2" ' Replace this with your video file, stream, dvd path etc..
sTitle = "My Video File"
Options(0) = ":volume=75" ' These can be any of the VLC options, replace as needed
Options(1) = ":audio-track=0"
Video.ClearPlayList()
Video.AddToPlayList(sFilename, sTitle, Options)
Video.Play()
' At this point, you may want to start a timer or a thread and monitor
' video.isplaying
' video.time
End Sub
You have to copy all the code into Visual Studio and then compile the project. This generates the VLanControl.dll that you can then add to the toolbox.Hi,
Maybe it's a stupid question but where I can find the file VLanControl.dll.
I didn't see a link to download this file on the http://wiki.videolan.org/.Net_Interface_to_VLC
Thanks for your answer.
As zbe I'm wondering, how I can get the playlist.Tappen,
have you seen that :
http://wiki.videolan.org/MediaControlAPI#Full_API
How can you get informations about current playlist ?
Could someone post exactly how to "Dispose of things properly"? I want to make sure I'm doing things correctly.Sorry I don't do VB.NET, but in C# you'd create a new Windows Application project named Foo and save it. Then copy VLanControl.dll, VLanControl.pdb, libvlc.dll, and the plugins directory to the Foo\Foo\bin\Debug directory of the new project. Add a reference to VLanControl.dll in the new project by Browsing to the same bin\Debug directory.
In Form1.cs of the new project you could put
Change the name of the media file and you have yourself a simple player application. This doesn't Dispose of things properly but it's the smallest useful project I can think of.Code: Select all
public partial class Form1 : Form { VLanControl.VlcUserControl vlc = new VLanControl.VlcUserControl(); Timer timer; bool sizingNeeded; public Form1() { InitializeComponent(); vlc.Parent = this; vlc.Dock = DockStyle.Fill; } protected override void OnLoad(EventArgs e) { base.OnLoad(e); this.sizingNeeded = true; this.vlc.AddAndPlay(@"YourMediaFile.ext", ""); this.timer = new Timer(this.components); this.timer.Interval = 500; this.timer.Tick += timer_Tick; this.timer.Start(); } void timer_Tick(object sender, EventArgs e) { if(this.sizingNeeded && (this.vlc.State == VLanControl.PlayerState.Playing)) { this.ClientSize = this.vlc.VideoSize; this.sizingNeeded = false; } } }
If you follow the example I quoted in my last post, you just need the correct string the following line...I'm curious how I might go about accessing VLC's live stream downloading capability through the DLL? I'm writing a C# application that needs this ability... I wrote a custom implementation of MMS (a pain) and thought I'd try out the DLL.
Basically I have live streams at a designated address that can be MMS/RTSP/HTTP and I want to save them to a local file. The VLC player has this functionality but I was wanting to accomplish the same thing without playing the files locally, just doing a raw download to ASF.
Any ideas or samples?
Thanks,
D
Code: Select all
this.vlc.AddAndPlay(@"YourMediaFile.ext", "");
Users browsing this forum: No registered users and 13 guests