Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Martin Finkel
libvlcsharp-samples
Commits
b211bbac
Commit
b211bbac
authored
Oct 21, 2018
by
Martin Finkel
Browse files
Start discovery from UI thread
parent
dce768ca
Changes
2
Hide whitespace changes
Inline
Side-by-side
Chromecast/Chromecast/MainPage.xaml
View file @
b211bbac
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
xmlns=
"http://xamarin.com/schemas/2014/forms"
xmlns:x=
"http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local=
"clr-namespace:Chromecast"
x:Class=
"Chromecast.MainPage"
>
<StackLayout>
<!-- Place new controls here -->
<Label
Text=
"Welcome to Xamarin.Forms!"
<Label
Text=
"Chromecast with libvlc and LibVLCSharp with Xamarin.Forms!"
HorizontalOptions=
"Center"
VerticalOptions=
"CenterAndExpand"
/>
</StackLayout>
...
...
Chromecast/Chromecast/MainPage.xaml.cs
View file @
b211bbac
...
...
@@ -12,7 +12,7 @@ namespace Chromecast
{
public
partial
class
MainPage
:
ContentPage
{
HashSet
<
RendererItem
>
_rendererItems
=
new
HashSet
<
RendererItem
>();
readonly
HashSet
<
RendererItem
>
_rendererItems
=
new
HashSet
<
RendererItem
>();
LibVLC
_libVLC
;
MediaPlayer
_mediaPlayer
;
RendererDiscoverer
_rendererDiscoverer
;
...
...
@@ -22,21 +22,18 @@ namespace Chromecast
InitializeComponent
();
}
protected
override
void
OnAppearing
()
protected
override
async
void
OnAppearing
()
{
base
.
OnAppearing
();
Task
.
Run
(
async
()
=>
{
// start chromecast discovery
DiscoverChromecasts
();
// start chromecast discovery
DiscoverChromecasts
();
// hold on a bit at first to give libvlc time to find the chromecast
await
Task
.
Delay
(
5
000
);
// hold on a bit at first to give libvlc time to find the chromecast
await
Task
.
Delay
(
2
000
);
// start casting if any renderer found
StartCasting
();
});
// start casting if any renderer found
StartCasting
();
}
/// <summary>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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