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
d0f9f0cd
Commit
d0f9f0cd
authored
May 15, 2013
by
Gleb Pinigin
Browse files
Implement handling play/pause remote events
parent
b61096d9
Changes
1
Hide whitespace changes
Inline
Side-by-side
AspenProject/VLCMovieViewController.m
View file @
d0f9f0cd
...
...
@@ -119,6 +119,47 @@
return
self
;
}
#pragma mark - remote events
-
(
void
)
viewDidAppear
:(
BOOL
)
animated
{
[
super
viewDidAppear
:
animated
];
[[
UIApplication
sharedApplication
]
beginReceivingRemoteControlEvents
];
[
self
becomeFirstResponder
];
}
-
(
void
)
viewDidDisappear
:(
BOOL
)
animated
{
[
super
viewDidDisappear
:
animated
];
[[
UIApplication
sharedApplication
]
endReceivingRemoteControlEvents
];
[
self
resignFirstResponder
];
}
-
(
BOOL
)
canBecomeFirstResponder
{
return
YES
;
}
-
(
void
)
remoteControlReceivedWithEvent
:(
UIEvent
*
)
event
{
switch
(
event
.
subtype
)
{
case
UIEventSubtypeRemoteControlPlay
:
[
_mediaPlayer
play
];
break
;
case
UIEventSubtypeRemoteControlPause
:
[
_mediaPlayer
pause
];
break
;
case
UIEventSubtypeRemoteControlTogglePlayPause
:
[
self
play
:
nil
];
break
;
default:
break
;
}
}
#pragma mark - controls visibility
-
(
BOOL
)
gestureRecognizer
:(
UIGestureRecognizer
*
)
gestureRecognizer
shouldReceiveTouch
:(
UITouch
*
)
touch
...
...
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