ios - MPMoviePlayerController automatic pause at second X -


i have automatic stop player @ second x , don't know kind of notification have used. after, when user taps anywhere on screen player continue run video.

- (ibaction)playmovie:(id)sender {     nsstring *filepath   =   [[nsbundle mainbundle] pathforresource:@"movie" oftype:@"m4v"];     nsurl    *fileurl    =   [nsurl fileurlwithpath:filepath];     _movieplayer = [[mpmovieplayercontroller alloc] initwithcontenturl:fileurl];      [[nsnotificationcenter defaultcenter] addobserver:self  selector:@selector(movieplaybackdidfinish:) name:mpmovieplayerplaybackdidfinishnotification object:_movieplayer];      //here don't know notification have used     [[nsnotificationcenter defaultcenter] addobserver:self  selector:@selector(movieplaybackpause:) name:mpmovieplayerplaybackstatedidchangenotification object:_movieplayer];      _movieplayer.controlstyle = mpmoviecontrolstyledefault;     _movieplayer.initialplaybacktime = 2.5;      _movieplayer.shouldautoplay = yes;     [self.view addsubview:_movieplayer.view];     [_movieplayer setfullscreen:yes animated:no];     [_movieplayer play]; } 

i tried catch movie frame , analyzed see if time pause video.

- (void) movieplaybackpause:(nsnotification*)notification{     // check if it's time pause video      if([_movieplayer currentplaybacktime] == 6.0){          [_movieplayer pause];     } } 
  1. which type of notification have use catch current time of video?

thanks in advance responses! kind regards!

you can use nstimer stop video. should exist better way it, timer can well.

[_movieplayer play]; [nstimer scheduledtimerwithtimeinterval:6 //time in seconds                                  target:self                                selector:@selector(movieplaybackpause) //method called when timer completed.                                userinfo:nil                                 repeats:no];     } }  - (void) movieplaybackpause {   [_movieplayer pause]; } 

Comments

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -