Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLC-Android
Manage
Activity
Members
Labels
Plan
Issues
528
Issue boards
Milestones
Wiki
Code
Merge requests
14
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VideoLAN
VLC-Android
Commits
5ca88812
Commit
5ca88812
authored
7 years ago
by
Geoffrey Métais
Browse files
Options
Downloads
Patches
Plain Diff
RendererDelegate: Load VLC instance in background
parent
990069b9
No related branches found
Branches containing commit
No related tags found
Loading
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
vlc-android/src/org/videolan/vlc/RendererDelegate.kt
+11
-5
11 additions, 5 deletions
vlc-android/src/org/videolan/vlc/RendererDelegate.kt
with
11 additions
and
5 deletions
vlc-android/src/org/videolan/vlc/RendererDelegate.kt
+
11
−
5
View file @
5ca88812
...
...
@@ -19,6 +19,10 @@
*/
package
org.videolan.vlc
import
kotlinx.coroutines.experimental.CoroutineStart
import
kotlinx.coroutines.experimental.async
import
kotlinx.coroutines.experimental.launch
import
kotlinx.coroutines.experimental.android.UI
import
org.videolan.libvlc.RendererDiscoverer
import
org.videolan.libvlc.RendererItem
import
org.videolan.vlc.util.VLCInstance
...
...
@@ -48,19 +52,19 @@ object RendererDelegate : RendererDiscoverer.EventListener, ExternalMonitor.Netw
fun
onRendererChanged
(
renderer
:
RendererItem
?)
}
fun
start
()
{
suspend
fun
start
()
{
if
(
started
)
return
started
=
true
val
libVlc
=
VLCInstance
.
get
()
val
libVlc
=
async
{
VLCInstance
.
get
()
}.
await
()
for
(
discoverer
in
RendererDiscoverer
.
list
(
libVlc
))
{
val
rd
=
RendererDiscoverer
(
libVlc
,
discoverer
.
name
)
mDiscoverers
.
add
(
rd
)
rd
.
setEventListener
(
this
)
rd
.
setEventListener
(
this
@RendererDelegate
)
rd
.
start
()
}
}
fun
stop
()
{
suspend
fun
stop
()
{
if
(!
started
)
return
started
=
false
for
(
discoverer
in
mDiscoverers
)
discoverer
.
stop
()
...
...
@@ -75,7 +79,9 @@ object RendererDelegate : RendererDiscoverer.EventListener, ExternalMonitor.Netw
renderers
.
clear
()
}
override
fun
onNetworkConnectionChanged
(
connected
:
Boolean
)
=
if
(
connected
)
start
()
else
stop
()
override
fun
onNetworkConnectionChanged
(
connected
:
Boolean
)
{
launch
(
UI
,
CoroutineStart
.
UNDISPATCHED
)
{
if
(
connected
)
start
()
else
stop
()
}
}
override
fun
onEvent
(
event
:
RendererDiscoverer
.
Event
?)
{
when
(
event
?.
type
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment