forked from videolan/libvlcsharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
46 lines (36 loc) · 1.24 KB
/
Copy pathProgram.cs
File metadata and controls
46 lines (36 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using Gtk;
using LibVLCSharp.Shared;
using System;
namespace LibVLCSharp.GTK.Sample
{
public class Program
{
public static void Main()
{
Core.Initialize();
// Initializes the GTK# app
Application.Init();
using var libvlc = new LibVLC();
using var mediaPlayer = new MediaPlayer(libvlc);
// Create the window in code. This could be done in glade as well, I guess...
var myWin = new Window("LibVLCSharp.GTK.Sample");
myWin.Resize(800, 450);
// Creates the video view, and adds it to the window
var videoView = new VideoView { MediaPlayer = mediaPlayer };
myWin.Add(videoView);
//Show Everything
myWin.ShowAll();
//Starts playing
using var media = new Media(libvlc,
new Uri("http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"));
mediaPlayer.Play(media);
myWin.DeleteEvent += (sender, args) =>
{
mediaPlayer.Stop();
videoView.Dispose();
Application.Quit();
};
Application.Run();
}
}
}