2013-07-31 59 views
0

感謝您的幫助,我有一個電影播放器​​,我想阻止用戶通過電影向前擦洗,但我不在乎他們是否倒退(倒帶)。我正在檢測回放狀態何時發生變化,然後測試「MPMoviePlayerDidSeekingForward」MPMoviePlayer當用戶尋求前進時,你如何檢測?

問題是,無論方向如何,playbackState總是在向前查找。

由於各種原因,我無法制作自己的自定義播放器,我需要使用標準的MPMoviePlayer。

下面是代碼:

- (void)moviePlayerPlaybackStateDidChangeNotificationReceived:(NSNotification *)notification { 

    //movie playback has started go to full screen. 

    if(_player.fullscreen == NO){ 
     _player.fullscreen = YES; 
    } 

    //prevent user from scrubbing through the movie 

// #ifdef DEBUG 
//  
//  return; 
// #else 

    if(_player.playbackState == MPMoviePlaybackStateSeekingForward){ 


     NSString *alertMessage = [NSString stringWithFormat:@"you are not allowed to skip the movies" 

     UIAlertView *alert = 
     [[UIAlertView alloc] initWithTitle: @"Warning" 
            message: alertMessage 
            delegate: self 
         cancelButtonTitle: @"Continue" 
         otherButtonTitles: @"Stop", nil]; 
     self.isShowing = YES; 
     [alert show]; 

     [_player pause]; 
     _player.fullscreen = NO; 
    } 
    // #endif 
+0

是不是可能只跟蹤兩個事件之間的位置變化? – millimoose

+0

我假設你是指根據新的播放位置檢查當前運行時間?與此相關的問題是保持一個精確到播放頭位置的定時器,這就是爲什麼我切換到試圖檢測清理方向的原因。 – Nathan

回答

0

你嘗試把[_player endSeeking]

if(_player.playbackState == MPMoviePlaybackStateSeekingForward){聲明?

相關問題