ios - MPRemoteCommandCenter : UI disappears after I press the pause button -
i'm implementing mpremotecommandcenter
radio streaming app. works far audio play screen locked , ui appears volume control , pause button visible.
as press pause button audio stops , whole audio control ui disappears can not unpause audio playing pressing play button expect.
the method pauseevent
gets called on pressing pause button. see below.
is able give me hints i've gone wrong?
here code:
- (id) init { if (self = [super init]) { _streaming = no; _rcc = [mpremotecommandcenter sharedcommandcenter]; mpremotecommand *pausecommand = [_rcc pausecommand]; [pausecommand setenabled:yes]; [pausecommand addtarget:self action:@selector(pauseevent)]; mpremotecommand *playcommand = [_rcc playcommand]; [playcommand setenabled:yes]; [playcommand addtarget:self action:@selector(playevent)]; } return self; } -(void) pauseevent { [_rcc.playcommand setenabled:yes]; [_rcc.pausecommand setenabled:no]; [self.player pause]; _streaming = no; } -(void) playevent { [self.player play]; [_rcc.playcommand setenabled:no]; [_rcc.pausecommand setenabled:yes]; _streaming = yes; }
just fixed this, reason, if did not set info mpnowplayinginfocenter
that's happens, happened me, added random title , controls remain on screen.
this behavior weird understandable, if remote controls don't have nothing show, think ok dismiss them.
Comments
Post a Comment