2011-09-16 31 views
0

我做了停止和啓動的MPMoviePlayerController通過觸摸

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

和即使發生觸摸和播放命令發生這是行不通的,它工作正常,然後在

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

,但如果我嘗試並再次設置setEndPlaybackTime它stil不會播放?我只是希望它在用戶觸摸屏幕後保持播放任何想法?

回答

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也可以正常工作。

+0

沒有這不適合我(0或-1)。但我確實需要它從現在開始繼續,這就是爲什麼我要設置最初的播放時間。 – h1vpdata

+0

也許提供完整問題的用例可能會有所幫助?我閱讀它的方式是,自動播放視頻,完成後停止播放,並希望在屏幕上觸摸以重新開始播放。你看過http://developer.apple.com/library/ios/documentation/MediaPlayer/Reference/MPMediaPlayback_protocol/Reference/Reference.html#//apple_ref/occ/intfp/MPMediaPlayback/currentPlaybackTime? currentPlaybackTime屬性可能有所幫助。 – nloko