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
07525dd4
Commit
07525dd4
authored
7 years ago
by
Geoffrey Métais
Browse files
Options
Downloads
Patches
Plain Diff
Update current playlist media meta once loaded
parent
6f2b2c0d
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
vlc-android/src/org/videolan/vlc/media/MediaWrapperList.java
+15
-0
15 additions, 0 deletions
vlc-android/src/org/videolan/vlc/media/MediaWrapperList.java
vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
+10
-5
10 additions, 5 deletions
vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
with
25 additions
and
5 deletions
vlc-android/src/org/videolan/vlc/media/MediaWrapperList.java
+
15
−
0
View file @
07525dd4
...
...
@@ -22,10 +22,13 @@ package org.videolan.vlc.media;
import
android.support.annotation.Nullable
;
import
org.videolan.medialibrary.Medialibrary
;
import
org.videolan.medialibrary.media.MediaWrapper
;
import
org.videolan.vlc.VLCApplication
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.ListIterator
;
public
class
MediaWrapperList
{
private
static
final
String
TAG
=
"VLC/MediaWrapperList"
;
...
...
@@ -169,6 +172,18 @@ public class MediaWrapperList {
return
mVideoCount
==
0
;
}
public
synchronized
void
updateWithMLMeta
()
{
final
ListIterator
<
MediaWrapper
>
iter
=
mInternalList
.
listIterator
();
final
Medialibrary
ml
=
VLCApplication
.
getMLInstance
();
while
(
iter
.
hasNext
())
{
final
MediaWrapper
media
=
iter
.
next
();
if
(
media
.
getId
()
==
0L
)
{
final
MediaWrapper
mw
=
ml
.
findMedia
(
media
);
if
(
mw
.
getId
()
!=
0
)
iter
.
set
(
mw
);
}
}
}
@Override
public
String
toString
()
{
StringBuilder
sb
=
new
StringBuilder
();
...
...
This diff is collapsed.
Click to expand it.
vlc-android/src/org/videolan/vlc/media/PlaylistManager.kt
+
10
−
5
View file @
07525dd4
...
...
@@ -15,7 +15,10 @@ import org.videolan.libvlc.Media
import
org.videolan.libvlc.MediaPlayer
import
org.videolan.medialibrary.Medialibrary
import
org.videolan.medialibrary.media.MediaWrapper
import
org.videolan.vlc.*
import
org.videolan.vlc.BuildConfig
import
org.videolan.vlc.PlaybackService
import
org.videolan.vlc.R
import
org.videolan.vlc.VLCApplication
import
org.videolan.vlc.gui.preferences.PreferencesActivity
import
org.videolan.vlc.gui.preferences.PreferencesFragment
import
org.videolan.vlc.gui.video.VideoPlayerActivity
...
...
@@ -113,11 +116,10 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
val
audio
=
type
==
Constants
.
PLAYLIST_TYPE_AUDIO
val
currentMedia
=
settings
.
getString
(
if
(
audio
)
"current_song"
else
"current_media"
,
""
)
if
(
""
==
currentMedia
)
return
@launch
val
locations
=
settings
.
getString
(
if
(
audio
)
"audio_list"
else
"media_list"
,
""
)
!!
.
split
(
" "
.
toRegex
()).
dropLastWhile
({
it
.
isEmpty
()
}).
toTypedArray
()
val
locations
=
settings
.
getString
(
if
(
audio
)
"audio_list"
else
"media_list"
,
""
).
split
(
" "
.
toRegex
()).
dropLastWhile
({
it
.
isEmpty
()
}).
toTypedArray
()
if
(
Util
.
isArrayEmpty
(
locations
))
return
@launch
val
playList
=
async
{
locations
.
map
{
Uri
.
decode
(
it
)
}
.
mapTo
(
ArrayList
<
MediaWrapper
>(
locations
.
size
))
{
medialibrary
.
findMedia
(
MediaWrapper
(
Uri
.
parse
(
it
)))
}
locations
.
map
{
Uri
.
decode
(
it
)
}.
mapTo
(
ArrayList
<
MediaWrapper
>(
locations
.
size
))
{
MediaWrapper
(
Uri
.
parse
(
it
))
}
}.
await
()
// load playlist
shuffling
=
settings
.
getBoolean
(
if
(
audio
)
"audio_shuffling"
else
"media_shuffling"
,
false
)
...
...
@@ -138,7 +140,10 @@ class PlaylistManager(val service: PlaybackService) : MediaWrapperList.EventList
private
fun
onPlaylistLoaded
()
{
service
.
onPlaylistLoaded
()
launch
(
UI
,
CoroutineStart
.
UNDISPATCHED
)
{
determinePrevAndNextIndices
()
}
launch
(
UI
,
CoroutineStart
.
UNDISPATCHED
)
{
determinePrevAndNextIndices
()
launch
{
mediaList
.
updateWithMLMeta
()
}
}
}
fun
play
()
=
player
.
play
()
...
...
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