ios - Playing a video from a url -
- (void)viewdidload { [super viewdidload]; mpmovieplayercontroller *player; nslog(@"%@",gotvideo); nsurl *urlstring=[nsurl urlwithstring:gotvideo]; player = [[mpmovieplayercontroller alloc] initwithcontenturl:urlstring]; [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(moviefinishedcallback:) name:mpmovieplayerplaybackdidfinishnotification object:player]; //---play movie--- [player play]; } - (void) moviefinishedcallback:(nsnotification*) anotification { mpmovieplayercontroller *player = [anotification object]; [[nsnotificationcenter defaultcenter] removeobserver:self name:mpmovieplayerplaybackdidfinishnotification object:player]; }
in ios 7.1 simulator video not getting played. please provide suggestions.
you forgot nowadays or add together subview
[self presentmovieplayerviewcontrolleranimated:player]; //---play movie--- [player play]; ios
No comments:
Post a Comment