I need to do action for next and previous button event for ios video player, here am using mpmovieplayerviewcontroller.
Asked
Active
Viewed 89 times
0
-
You can refer here [http://stackoverflow.com/questions/1134578/next-previous-buttons-on-iphone-mpmovieplayercontroller] – tuledev Aug 18 '15 at 06:02
-
is that possible to get next and previous button events for MPMediaplayerviewcontroller – Vetrivel P Aug 18 '15 at 07:26
1 Answers
0
MPMoviePlayerController
fires off MPMoviePlayerPlaybackStateDidChangeNotification
when either the Prev or Next is tapped. There's no way to be notified whether each one is tapped.
The only way I found, was to create my own custom controls for backward and forward, adding a target to it to perform an action:
[prevBtn addTarget:self action:@selector(onClick:)
forControlEvents:UIControlEventTouchUpInside];
[nextBtn addTarget:self action:@selector(onClick:)
forControlEvents:UIControlEventTouchUpInside];
Then in your onClick
method:
(void)onClick:(UIButton*)sender
{
if (sender == prevBtn)
{
// Do whatever when prevBtn is tapped
}
else if (sender == nextBtn)
{
// Do whatever when nextBtn is tapped
}
}
FYI: you must set the player's controlStyle
property to MPMovieControlStyleNon
to hide the default controls.

Pangu
- 3,721
- 11
- 53
- 120