1

アプリケーションの起動中にビデオをロードするアプリケーションを開発しています。ビデオが再生されて画面から削除されている間、私は大きなジャークを観察します。

私のコードは次のとおりです。

VideoPlayer.m

-(id)initWithVideo: (CGRect)frame file:(NSString *)videoFile 
{
    if (self = [super initWithFrame:frame]) 
    {
        NSArray *file = [videoFile componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"."]];

        NSString *moviePath = [[NSBundle mainBundle] pathForResource:[file objectAtIndex:0] ofType:[file objectAtIndex:1]];

        if (nil != moviePath) 
        {
            if (nil != theMovie) 
            {
                [theMovie.view removeFromSuperview];
            }

            theMovie = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL fileURLWithPath:moviePath]];

            theMovie.view.frame = self.bounds;
            theMovie.moviePlayer.scalingMode = MPMovieScalingModeAspectFit;
            theMovie.moviePlayer.controlStyle = MPMovieControlStyleNone;
            theMovie.moviePlayer.movieSourceType = MPMovieSourceTypeFile;
            theMovie.moviePlayer.fullscreen = NO;           

            [self addSubview:theMovie.view];            
        }
    }

    return self;
}

足りないところを教えてください。

4

1 に答える 1