1

私のビデオは、IOS 8.3 以前のバージョンで問題なく再生されます。しかし、IOS 8.4 Video Player の最近の更新後、動作しなくなりました。動画が再生されず、すぐに MPMoviePlaybackComplete: メソッドに移動します。

Here is my code :

     self.player = [[MPMoviePlayerViewController alloc] initWithContentURL:fileURL];

    [self.player.moviePlayer setFullscreen:YES animated:YES];

      if(subtitlesPathStr){
    [self.player.moviePlayer openSRTFileAtPath:subtitlesPathStr
                                       completion:^(BOOL finished) {

                                           // Activate subtitles

                                           [self.player.moviePlayer showSubtitles];
    [self.navigationController presentMoviePlayerViewControllerAnimated:self.player];

                                       } failure:^(NSError *error) {

                                   NSLog(@"Error: %@", error.description);
           }

             ];
        }else [self.navigationController presentMoviePlayerViewControllerAnimated:self.player];

     [[NSNotificationCenter defaultCenter] addObserver:self
                                                 selector:@selector(MPMoviePlayerLoadStateDidChange:)
                                                     name:MPMoviePlayerLoadStateDidChangeNotification
                                                   object:nil];

        [[NSNotificationCenter defaultCenter] addObserver:self
                                                 selector:@selector(MPMoviePlayerDidEnterFullscreenNotification:)
                                                     name:MPMoviePlayerDidEnterFullscreenNotification
                                                   object:nil];

        [[NSNotificationCenter defaultCenter] addObserver:self
                                                 selector:@selector(MPMoviePlaybackComplete:)    
                                                     name:MPMoviePlayerPlaybackDidFinishNotification
                                                   object:nil];

誰かがこの問題を解決する方法を教えてもらえますか?

4

1 に答える 1

0

再生時間と再生可能時間に基づいて、ビデオのリセット メソッドを追加します。

   - (void)playbackDidFinish:(NSNotification*)aNotification {
        MPMoviePlayerController *moviePlayer = aNotification.object;
        NSNumber *reason = [aNotification.userInfo objectForKey:MPMoviePlayerPlaybackDidFinishReasonUserInfoKey];
        if ([reason intValue] == MPMovieFinishReasonPlaybackEnded) {
            if (moviePlayer.currentPlaybackTime == moviePlayer.playableDuration) {
                [moviePlayer stop];
            }
        }
    }
于 2015-07-23T10:18:59.213 に答える