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
VideoLAN
VLC-iOS
Commits
39e96176
Commit
39e96176
authored
Mar 03, 2018
by
Mike JS. Choi
Committed by
Carola
Mar 09, 2018
Browse files
[Playback] Enable scrubbing from iOS control center
parent
7acee25e
Changes
3
Hide whitespace changes
Inline
Side-by-side
SharedSources/VLCRemoteControlService.h
View file @
39e96176
...
...
@@ -24,6 +24,7 @@
-
(
void
)
remoteControlService
:(
VLCRemoteControlService
*
)
rcs
jumpBackwardInSeconds
:(
NSTimeInterval
)
seconds
;
-
(
NSInteger
)
remoteControlServiceNumberOfMediaItemsinList
:(
VLCRemoteControlService
*
)
rcs
;
-
(
void
)
remoteControlService
:(
VLCRemoteControlService
*
)
rcs
setPlaybackRate
:(
CGFloat
)
playbackRate
;
-
(
void
)
remoteControlService
:(
VLCRemoteControlService
*
)
rcs
setCurrentPlaybackTime
:(
NSTimeInterval
)
playbackTime
;
@end
...
...
SharedSources/VLCRemoteControlService.m
View file @
39e96176
...
...
@@ -27,6 +27,7 @@ static inline NSArray * RemoteCommandCenterCommandsToHandle()
cc
.
skipForwardCommand
,
cc
.
skipBackwardCommand
,
cc
.
changePlaybackRateCommand
,
cc
.
changePlaybackPositionCommand
,
];
}
...
...
@@ -56,7 +57,7 @@ static inline NSArray * RemoteCommandCenterCommandsToHandle()
commandCenter
.
changeShuffleModeCommand
.
enabled
=
NO
;
commandCenter
.
seekForwardCommand
.
enabled
=
NO
;
commandCenter
.
seekBackwardCommand
.
enabled
=
NO
;
commandCenter
.
changePlaybackPositionCommand
.
enabled
=
NO
;
commandCenter
.
changePlaybackPositionCommand
.
enabled
=
YES
;
NSUserDefaults
*
defaults
=
[
NSUserDefaults
standardUserDefaults
];
NSNumber
*
forwardSkip
=
[
defaults
valueForKey
:
kVLCSettingPlaybackForwardSkipLength
];
...
...
@@ -125,6 +126,11 @@ static inline NSArray * RemoteCommandCenterCommandsToHandle()
[
_remoteControlServiceDelegate
remoteControlService
:
self
setPlaybackRate
:
rateEvent
.
playbackRate
];
return
MPRemoteCommandHandlerStatusSuccess
;
}
if
(
event
.
command
==
cc
.
changePlaybackPositionCommand
)
{
MPChangePlaybackPositionCommandEvent
*
positionEvent
=
(
MPChangePlaybackPositionCommandEvent
*
)
event
;
[
_remoteControlServiceDelegate
remoteControlService
:
self
setCurrentPlaybackTime
:
positionEvent
.
positionTime
];
return
MPRemoteCommandHandlerStatusSuccess
;
}
NSAssert
(
NO
,
@"remote control event not handled"
);
APLog
(
@"%s Wasn't able to handle remote control event: %@"
,
__PRETTY_FUNCTION__
,
event
);
return
MPRemoteCommandHandlerStatusCommandFailed
;
...
...
Sources/VLCPlaybackController.m
View file @
39e96176
...
...
@@ -1263,6 +1263,13 @@ typedef NS_ENUM(NSUInteger, VLCAspectRatio) {
{
self
.
playbackRate
=
playbackRate
;
}
-
(
void
)
remoteControlService
:(
VLCRemoteControlService
*
)
rcs
setCurrentPlaybackTime
:(
NSTimeInterval
)
playbackTime
{
float
positionDiff
=
playbackTime
-
[
self
.
metadata
.
elapsedPlaybackTime
floatValue
];
[
_mediaPlayer
jumpForward
:
positionDiff
];
}
#pragma mark - helpers
-
(
NSDictionary
*
)
mediaOptionsDictionary
...
...
Mike JS. Choi
@mkchoi212
mentioned in commit
93169d9f
·
Mar 09, 2018
mentioned in commit
93169d9f
mentioned in commit 93169d9f60dbc38d984739e3f2ac2331a15d836b
Toggle commit list
Write
Preview
Supports
Markdown
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