Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Alan Ik
LibVLCSharp
Commits
5a29b0e8
Commit
5a29b0e8
authored
Mar 24, 2020
by
Martin Finkel
Browse files
Samples: Update smaller samples to C# 8
parent
3b8a9ba1
Changes
6
Hide whitespace changes
Inline
Side-by-side
Samples/LibVLCSharp.GTK.Sample/LibVLCSharp.GTK.Sample.csproj
View file @
5a29b0e8
...
...
@@ -4,6 +4,7 @@
<TargetFramework>net471</TargetFramework>
<OutputType>WinExe</OutputType>
<PlatformTarget>x86</PlatformTarget>
<LangVersion>8.0</LangVersion>
</PropertyGroup>
<ItemGroup>
...
...
Samples/LibVLCSharp.GTK.Sample/Program.cs
View file @
5a29b0e8
...
...
@@ -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
();
}
}
}
Samples/LibVLCSharp.NetCore.Sample/LibVLCSharp.NetCore.Sample.csproj
View file @
5a29b0e8
...
...
@@ -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" />
...
...
Samples/LibVLCSharp.NetCore.Sample/Program.cs
View file @
5a29b0e8
...
...
@@ -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
();
}
}
}
Samples/LibVLCSharp.Windows.Net40.Sample/LibVLCSharp.Windows.Net40.Sample.csproj
View file @
5a29b0e8
...
...
@@ -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" />
...
...
Samples/LibVLCSharp.Windows.Net40.Sample/Program.cs
View file @
5a29b0e8
...
...
@@ -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
();
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment