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
cb5cc7e9
Commit
cb5cc7e9
authored
Jun 10, 2015
by
Felix Paul Kühne
Browse files
playback: speed-up continue where you left off (closes #14845)
(cherry picked from commit
00d33fd1
)
parent
c7658cd7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Sources/VLCPlaybackController.m
View file @
cb5cc7e9
...
...
@@ -275,6 +275,8 @@ NSString *const VLCPlaybackControllerPlaybackDidFail = @"VLCPlaybackControllerPl
[
_mediaPlayer
resetEqualizerFromProfile
:
profile
];
[
_mediaPlayer
setPreAmplification
:[
_mediaPlayer
preAmplification
]];
_mediaWasJustStarted
=
YES
;
[
_mediaPlayer
addObserver
:
self
forKeyPath
:
@"time"
options
:
0
context
:
nil
];
[
_mediaPlayer
addObserver
:
self
forKeyPath
:
@"remainingTime"
options
:
0
context
:
nil
];
...
...
@@ -292,7 +294,6 @@ NSString *const VLCPlaybackControllerPlaybackDidFail = @"VLCPlaybackControllerPl
[
self
subscribeRemoteCommands
];
_playerIsSetup
=
YES
;
_mediaWasJustStarted
=
YES
;
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
VLCPlaybackControllerPlaybackDidStart
object
:
self
];
}
...
...
@@ -433,6 +434,16 @@ NSString *const VLCPlaybackControllerPlaybackDidFail = @"VLCPlaybackControllerPl
-
(
void
)
observeValueForKeyPath
:(
NSString
*
)
keyPath
ofObject
:(
id
)
object
change
:(
NSDictionary
*
)
change
context
:(
void
*
)
context
{
if
(
_mediaWasJustStarted
)
{
_mediaWasJustStarted
=
NO
;
if
(
self
.
mediaList
)
{
MLFile
*
item
;
NSArray
*
matches
=
[
MLFile
fileForURL
:
_mediaPlayer
.
media
.
url
];
item
=
matches
.
firstObject
;
[
self
_recoverLastPlaybackStateOfItem
:
item
];
}
}
if
([
self
.
delegate
respondsToSelector
:
@selector
(
playbackPositionUpdated
:)])
[
self
.
delegate
playbackPositionUpdated
:
self
];
}
...
...
@@ -833,29 +844,6 @@ NSString *const VLCPlaybackControllerPlaybackDidFail = @"VLCPlaybackControllerPl
if
(
title
.
length
<
1
)
title
=
[[
_mediaPlayer
.
media
url
]
lastPathComponent
];
}
else
if
(
_mediaWasJustStarted
)
{
_mediaWasJustStarted
=
NO
;
if
(
item
)
{
if
(
_mediaPlayer
.
numberOfAudioTracks
>
2
)
{
if
(
item
.
lastAudioTrack
.
intValue
>
0
)
_mediaPlayer
.
currentAudioTrackIndex
=
item
.
lastAudioTrack
.
intValue
;
}
if
(
_mediaPlayer
.
numberOfSubtitlesTracks
>
2
)
{
if
(
item
.
lastSubtitleTrack
.
intValue
>
0
)
_mediaPlayer
.
currentVideoSubTitleIndex
=
item
.
lastSubtitleTrack
.
intValue
;
}
CGFloat
lastPosition
=
.
0
;
NSInteger
duration
=
0
;
if
(
item
.
lastPosition
)
lastPosition
=
item
.
lastPosition
.
floatValue
;
duration
=
item
.
duration
.
intValue
;
if
(
lastPosition
<
.
95
&&
_mediaPlayer
.
position
<
lastPosition
&&
(
duration
*
lastPosition
-
duration
)
<
-
60000
)
_mediaPlayer
.
position
=
lastPosition
;
}
}
/* populate delegate with metadata info */
...
...
@@ -911,6 +899,30 @@ setstuff:
}
-
(
void
)
_recoverLastPlaybackStateOfItem
:(
MLFile
*
)
item
{
if
(
item
)
{
if
(
_mediaPlayer
.
numberOfAudioTracks
>
2
)
{
if
(
item
.
lastAudioTrack
.
intValue
>
0
)
_mediaPlayer
.
currentAudioTrackIndex
=
item
.
lastAudioTrack
.
intValue
;
}
if
(
_mediaPlayer
.
numberOfSubtitlesTracks
>
2
)
{
if
(
item
.
lastSubtitleTrack
.
intValue
>
0
)
_mediaPlayer
.
currentVideoSubTitleIndex
=
item
.
lastSubtitleTrack
.
intValue
;
}
CGFloat
lastPosition
=
.
0
;
NSInteger
duration
=
0
;
if
(
item
.
lastPosition
)
lastPosition
=
item
.
lastPosition
.
floatValue
;
duration
=
item
.
duration
.
intValue
;
if
(
lastPosition
<
.
95
&&
_mediaPlayer
.
position
<
lastPosition
&&
(
duration
*
lastPosition
-
duration
)
<
-
60000
)
_mediaPlayer
.
position
=
lastPosition
;
}
}
-
(
void
)
recoverDisplayedMetadata
{
if
([
self
.
delegate
respondsToSelector
:
@selector
(
displayMetadataForPlaybackController
:
title
:
artwork
:
artist
:
album
:
audioOnly
:
)])
...
...
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