通过触摸停止并启动MPMoviePlayerController

时间:2011-09-16 02:28:53

标签: mpmovieplayercontroller

我做了

  player.shouldAutoplay = YES;
  [player setEndPlaybackTime:initPlay];

它工作正常,然后在

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
      if ([touches count] == 1) {
          [player play];
      }
    }

即使触摸发生并且播放命令发生也不起作用,但如果我尝试再次设置setEndPlaybackTime,那么stil不会播放?我只是希望它在用户触摸屏幕之后继续播放任何想法?

1 个答案:

答案 0 :(得分:0)

视频是否必须重绕到开头?你试过了吗?

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
  if ([touches count] == 1) {
      player.initialPlaybackTime = 0.0;
      [player play];
  }
}

请参阅http://developer.apple.com/library/ios/#documentation/MediaPlayer/Reference/MPMoviePlayerController_Class/Reference/Reference.html

值为-1也可能有效。