Call another URL at the time of one video playing from url on iphone -
in application i'm playing 2 videos array 1 after another.i want hit url @ time of first video begin play without affecting video playing.
here code have tried playing 2 videos 1 after another,
-(ibaction)playmovie:(id)sender{ i=0; array=[[nsarray alloc] initwithobjects:@"https://s3.amazonaws.com/adplayer/colgate.mp4",@"https://s3.amazonaws.com/ventuno-platform-flv-sep2010/happy_family.mp4",nil]; [self initializplayer]; }
the above action event called when user click on button start playing videos.
-(void)initializplayer{ if(i<[array count]) +=1; else { = 1; } nslog(@"i value:%@",[array objectatindex:i-1]); nsurl *url1=[nsurl urlwithstring:[array objectatindex:i-1]]; mpmovieplayercontroller *movieplayercontroller = [[mpmovieplayercontroller alloc] initwithcontenturl:url1]; [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(movieplaybackcomplete:) name:mpmovieplayerplaybackdidfinishnotification object:movieplayercontroller]; [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(movieplayerplaybackstatedidchange:) name:mpmovieplayerplaybackstatedidchangenotification object:movieplayercontroller]; [self.view addsubview:movieplayercontroller.view]; movieplayercontroller.fullscreen=yes; [movieplayercontroller play];}
in initializplayer method 2 videos playing 1 after another, , 2 notifications there,first 1 used notify when video completed or user press done button.another 1 used notify,
1.videoplay 2.videopause 3.video interrupted 4.videoforward 5.videobackward
-(void)movieplaybackcomplete:(nsnotification *)notification{ nslog(@"movieplaybackcomplete"); mpmovieplayercontroller *movieplayercontroller=[notification object]; [[nsnotificationcenter defaultcenter] removeobserver:self name:mpmovieplayerplaybackdidfinishnotification object:movieplayercontroller]; [movieplayercontroller.view removefromsuperview]; [movieplayercontroller release]; [self initializplayer];}
movieplaybackcomplete notification used notify user when video completed.
-(void) movieplayerplaybackstatedidchange:(nsnotification*)notification { nslog(@"movieplayerplaybackstatedidchange"); mpmovieplayercontroller *movieplayer = notification.object; mpmovieplaybackstate playbackstate = movieplayer.playbackstate; if(playbackstate == mpmovieplaybackstatestopped) { //nslog(@"mpmovieplaybackstatestopped"); } if(playbackstate == mpmovieplaybackstateplaying) { //nslog(@"mpmovieplaybackstateplaying"); } if(playbackstate == mpmovieplaybackstatepaused) { //nslog(@"mpmovieplaybackstatepaused"); } if(playbackstate == mpmovieplaybackstateinterrupted) { nslog(@"mpmovieplaybackstateinterrupted"); } if(playbackstate == mpmovieplaybackstateseekingforward) { nslog(@"mpmovieplaybackstateseekingforward"); } if(playbackstate == mpmovieplaybackstateseekingbackward) { nslog(@"mpmovieplaybackstateseekingbackward********"); }}
movieplayerplaybackstatedidchange notification used notify user if changes made in playbackstate.
my doubt:
at time of first video playing(beginning) want hit url without affecting video.hit 1 more url @ end of first video.
please guide me this.
thank you
Comments
Post a Comment