AlexLiu

 

网上有,拿来改改。挺好用的。比较简单。分享。

- (void) Playback : (id) sender

{

//指定播放的名字和地址

NSString *path = [[NSBundle mainBundle] pathForResource:@"ss" ofType:@"mov"];

// m4a格式也是允许的。

MPMoviePlayerController* theMovie=[[[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:path]] retain];

    [[NSNotificationCenter defaultCenter] addObserver:self

selector:@selector(myMovieFinishedCallback:)

name:MPMoviePlayerPlaybackDidFinishNotification

  object:theMovie];

[theMovie play];

}


- (void) setUpForPlay: (NSNotification *) notification

{

UIButton *button = (UIButton *)[self.view viewWithTag:BUTTON_TAG];

// Prepare button for re-starting

[button setTitle:@"Start" forState:UIControlStateNormal];

[button removeTarget:self action:@selector(stopPlayback:) forControlEvents:UIControlEventTouchUpInside];

[button addTarget:self action:@selector(startPlayback:) forControlEvents: UIControlEventTouchUpInside];

}

分类:

技术点:

相关文章:

  • 2021-11-05
  • 2021-08-13
  • 2022-12-23
  • 2021-12-12
  • 2022-02-21
猜你喜欢
  • 2021-07-04
  • 2022-12-23
  • 2021-09-27
  • 2022-12-23
  • 2022-12-23
  • 2022-02-01
相关资源
相似解决方案