Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
VideoLAN
VLC-iOS
Commits
9562ec1a
Commit
9562ec1a
authored
Jan 02, 2014
by
Felix Paul Kühne
Browse files
playback: stabilize and rationalize meta data retrieval
parent
55c2cdfa
Changes
3
Hide whitespace changes
Inline
Side-by-side
Sources/VLCMovieViewController.m
View file @
9562ec1a
...
...
@@ -30,7 +30,7 @@
#define FORWARD_SWIPE_DURATION 30
#define BACKWARD_SWIPE_DURATION 10
@interface
VLCMovieViewController
()
<
UIGestureRecognizerDelegate
,
AVAudioSessionDelegate
>
@interface
VLCMovieViewController
()
<
UIGestureRecognizerDelegate
,
AVAudioSessionDelegate
,
VLCMediaDelegate
>
{
VLCMediaListPlayer
*
_listPlayer
;
VLCMediaPlayer
*
_mediaPlayer
;
...
...
@@ -377,8 +377,10 @@
MLFile
*
item
=
self
.
mediaItem
;
media
=
[
VLCMedia
mediaWithURL
:[
NSURL
URLWithString
:
item
.
url
]];
item
.
unread
=
@
(
NO
);
}
else
if
(
!
self
.
mediaList
)
}
else
if
(
!
self
.
mediaList
)
{
media
=
[
VLCMedia
mediaWithURL
:
self
.
url
];
[
media
parse
];
}
NSMutableDictionary
*
mediaDictionary
=
[[
NSMutableDictionary
alloc
]
init
];
...
...
@@ -828,38 +830,10 @@
{
VLCMediaPlayerState
currentState
=
_mediaPlayer
.
state
;
if
(
currentState
==
VLCMediaPlayerStateBuffering
)
{
/* attach delegate */
_mediaPlayer
.
media
.
delegate
=
self
;
/* let's update meta data */
MLFile
*
item
=
self
.
mediaItem
;
NSString
*
title
;
NSString
*
artist
;
NSString
*
albumName
;
if
(
item
)
{
if
(
item
.
isAlbumTrack
)
{
title
=
item
.
albumTrack
.
title
;
artist
=
item
.
albumTrack
.
artist
;
albumName
=
item
.
albumTrack
.
album
.
name
;
self
.
artworkImageView
.
image
=
[
VLCThumbnailsCache
thumbnailForMediaFile
:
item
];
}
}
else
{
NSDictionary
*
metaDict
=
_mediaPlayer
.
media
.
metaDictionary
;
if
(
metaDict
)
{
title
=
metaDict
[
VLCMetaInformationTitle
];
artist
=
metaDict
[
VLCMetaInformationArtist
];
albumName
=
metaDict
[
VLCMetaInformationAlbum
];
self
.
artworkImageView
.
image
=
[
VLCThumbnailsCache
thumbnailForMediaItemWithTitle
:
title
Artist
:
artist
andAlbumName
:
albumName
];
}
}
if
(
!
self
.
artworkImageView
.
image
)
{
self
.
trackNameLabel
.
text
=
title
;
self
.
artistNameLabel
.
text
=
artist
;
self
.
albumNameLabel
.
text
=
albumName
;
}
else
self
.
trackNameLabel
.
text
=
[
NSString
stringWithFormat
:
@"%@ – %@ — %@"
,
title
,
artist
,
albumName
];
if
(
self
.
trackNameLabel
.
text
.
length
<
1
)
self
.
trackNameLabel
.
text
=
[[
_mediaPlayer
.
media
url
]
lastPathComponent
];
[
self
performSelectorInBackground
:
@selector
(
_updateExportedPlaybackInformation
)
withObject
:
nil
];
[
self
_updateDisplayedMetadata
];
}
if
(
currentState
==
VLCMediaPlayerStateError
)
{
...
...
@@ -867,8 +841,9 @@
[
self
performSelector
:
@selector
(
closePlayback
:)
withObject
:
nil
afterDelay
:
2
.];
}
if
((
currentState
==
VLCMediaPlayerStateEnded
||
currentState
==
VLCMediaPlayerStateStopped
)
&&
_listPlayer
.
repeatMode
==
VLCDoNotRepeat
)
[
self
performSelector
:
@selector
(
closePlayback
:)
withObject
:
nil
afterDelay
:
2
.];
if
((
currentState
==
VLCMediaPlayerStateEnded
||
currentState
==
VLCMediaPlayerStateStopped
)
&&
_listPlayer
.
repeatMode
==
VLCDoNotRepeat
)
{
if
([
_listPlayer
.
mediaList
indexOfMedia
:
_mediaPlayer
.
media
]
==
_listPlayer
.
mediaList
.
count
-
1
)[
self
performSelector
:
@selector
(
closePlayback
:)
withObject
:
nil
afterDelay
:
2
.];
}
UIImage
*
playPauseImage
=
[
_mediaPlayer
isPlaying
]?
[
UIImage
imageNamed
:
@"pauseIcon"
]
:
[
UIImage
imageNamed
:
@"playIcon"
];
[
_playPauseButton
setImage
:
playPauseImage
forState
:
UIControlStateNormal
];
...
...
@@ -1258,6 +1233,52 @@
}
}
-
(
void
)
mediaDidFinishParsing
:(
VLCMedia
*
)
aMedia
{
[
self
_updateDisplayedMetadata
];
}
-
(
void
)
mediaMetaDataDidChange
:(
VLCMedia
*
)
aMedia
{
[
self
_updateDisplayedMetadata
];
}
-
(
void
)
_updateDisplayedMetadata
{
MLFile
*
item
=
self
.
mediaItem
;
NSString
*
title
;
NSString
*
artist
;
NSString
*
albumName
;
if
(
item
)
{
if
(
item
.
isAlbumTrack
)
{
title
=
item
.
albumTrack
.
title
;
artist
=
item
.
albumTrack
.
artist
;
albumName
=
item
.
albumTrack
.
album
.
name
;
self
.
artworkImageView
.
image
=
[
VLCThumbnailsCache
thumbnailForMediaFile
:
item
];
}
}
else
{
NSDictionary
*
metaDict
=
_mediaPlayer
.
media
.
metaDictionary
;
if
(
metaDict
)
{
title
=
metaDict
[
VLCMetaInformationTitle
];
artist
=
metaDict
[
VLCMetaInformationArtist
];
albumName
=
metaDict
[
VLCMetaInformationAlbum
];
self
.
artworkImageView
.
image
=
[
VLCThumbnailsCache
thumbnailForMediaItemWithTitle
:
title
Artist
:
artist
andAlbumName
:
albumName
];
}
}
if
(
!
self
.
artworkImageView
.
image
)
{
self
.
trackNameLabel
.
text
=
title
;
self
.
artistNameLabel
.
text
=
artist
;
self
.
albumNameLabel
.
text
=
albumName
;
}
else
{
self
.
trackNameLabel
.
text
=
[
NSString
stringWithFormat
:
@"%@ – %@ — %@"
,
title
,
artist
,
albumName
];
}
if
(
self
.
trackNameLabel
.
text
.
length
<
1
||
[
self
.
trackNameLabel
.
text
isEqualToString
:
@" — — "
])
self
.
trackNameLabel
.
text
=
[[
_mediaPlayer
.
media
url
]
lastPathComponent
];
[
self
performSelectorInBackground
:
@selector
(
_updateExportedPlaybackInformation
)
withObject
:
nil
];
}
-
(
void
)
_updateExportedPlaybackInformation
{
if
(
!
_mediaItem
)
{
...
...
Sources/VLCPlaylistViewController.m
View file @
9562ec1a
...
...
@@ -441,9 +441,12 @@ static NSString *kDisplayedFirstSteps = @"Did we display the first steps tutoria
list
=
[[
VLCMediaList
alloc
]
init
];
MLFile
*
file
;
VLCMedia
*
media
;
for
(
NSInteger
x
=
count
-
1
;
x
>
-
1
;
x
--
)
{
file
=
[(
MLAlbumTrack
*
)
tracks
[
x
]
files
].
anyObject
;
[
list
addMedia
:[
VLCMedia
mediaWithURL
:
[
NSURL
URLWithString
:
file
.
url
]]];
media
=
[
VLCMedia
mediaWithURL
:
[
NSURL
URLWithString
:
file
.
url
]];
[
media
parse
];
[
list
addMedia
:
media
];
}
[(
VLCAppDelegate
*
)[
UIApplication
sharedApplication
].
delegate
openMediaList
:
list
atIndex
:[
tracks
indexOfObject
:
selectedObject
]];
}
else
...
...
compileVLCforiOS.sh
View file @
9562ec1a
...
...
@@ -12,7 +12,7 @@ CONFIGURATION="Release"
NONETWORK
=
no
SKIPLIBVLCCOMPILATION
=
no
TESTEDVLCKITHASH
=
86594f0a0
TESTEDVLCKITHASH
=
55461fb6a
TESTEDMEDIALIBRARYKITHASH
=
9c6382eb1
usage
()
...
...
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