Commit 5a29b0e8 authored by Martin Finkel's avatar Martin Finkel
Browse files

Samples: Update smaller samples to C# 8

parent 3b8a9ba1
......@@ -4,6 +4,7 @@
<TargetFramework>net471</TargetFramework>
<OutputType>WinExe</OutputType>
<PlatformTarget>x86</PlatformTarget>
<LangVersion>8.0</LangVersion>
</PropertyGroup>
<ItemGroup>
......
......@@ -12,36 +12,35 @@ namespace LibVLCSharp.GTK.Sample
// Initializes the GTK# app
Application.Init();
using (var libvlc = new LibVLC())
using (var mediaPlayer = new MediaPlayer(libvlc))
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,
"http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4",
FromType.FromLocation);
mediaPlayer.Play(media);
myWin.DeleteEvent += (sender, args) =>
{
// Create the window in code. This could be done in glade as well, I guess...
Window myWin = new Window("LibVLCSharp.GTK.Sample");
myWin.Resize(800, 450);
// Creates the video view, and adds it to the window
VideoView videoView = new VideoView { MediaPlayer = mediaPlayer };
myWin.Add(videoView);
//Show Everything
myWin.ShowAll();
//Starts playing
using (var media = new Media(libvlc,
"http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4",
FromType.FromLocation))
{
mediaPlayer.Play(media);
}
myWin.DeleteEvent += (sender, args) =>
{
mediaPlayer.Stop();
videoView.Dispose();
Application.Quit();
};
Application.Run();
}
mediaPlayer.Stop();
videoView.Dispose();
Application.Quit();
};
Application.Run();
}
}
}
......@@ -4,7 +4,7 @@
<TargetFramework>netcoreapp2.0</TargetFramework>
<Platforms>AnyCPU;x64;x86</Platforms>
<RuntimeIdentifiers>win7-x64;win7-x86;osx-x64</RuntimeIdentifiers>
<LangVersion>7.3</LangVersion>
<LangVersion>8.0</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="VideoLAN.LibVLC.Windows" Version="3.0.8" />
......
......@@ -9,16 +9,11 @@ namespace LibVLCSharp.NetCore.Sample
{
Core.Initialize();
using(var libVLC = new LibVLC())
{
var media = new Media(libVLC, "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4", FromType.FromLocation);
using (var mp = new MediaPlayer(media))
{
media.Dispose();
mp.Play();
Console.ReadKey();
}
}
using var libVLC = new LibVLC();
using var media = new Media(libVLC, "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4", FromType.FromLocation);
using var mp = new MediaPlayer(media);
mp.Play();
Console.ReadKey();
}
}
}
......@@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net40</TargetFramework>
<LangVersion>7.3</LangVersion>
<LangVersion>8.0</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="VideoLAN.LibVLC.Windows" Version="3.0.8" />
......
......@@ -9,10 +9,11 @@ namespace LibVLCSharp.Windows.Net40.Sample
{
Core.Initialize();
var libVLC = new LibVLC();
var media = new Media(libVLC, "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4", FromType.FromLocation);
var mp = new MediaPlayer(media);
using var libVLC = new LibVLC();
using var media = new Media(libVLC, "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4", FromType.FromLocation);
using var mp = new MediaPlayer(media);
mp.Play();
Console.ReadKey();
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment