代码之家  ›  专栏  ›  技术社区  ›  TechBee

iPad视频加载问题

  •  0
  • TechBee  · 技术社区  · 15 年前

    我正在开发一个基于刷卡的应用程序。每次刷卡时,都会出现一个包含视频和其他资产的页面。每次刷卡时,我都会使用下面的代码。

    nsarray*file=[videofile componentsseparatedByCharactersInset:[nsCharacterSet CharactersSetWithCharactersInString:@“”];

        NSString *moviePath = [[NSBundle mainBundle] pathForResource:[file objectAtIndex:0] ofType:[file objectAtIndex:1]];
    
        if (moviePath != nil) 
        {
            //self.videoTimer = [NSTimer scheduledTimerWithTimeInterval:delayTime target:self selector:@selector(playVideo:) userInfo:nil repeats:NO];
            self.theMovie = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL fileURLWithPath:moviePath]];
            self.theMovie.view.frame = self.bounds;
            self.theMovie.moviePlayer.scalingMode = MPMovieScalingModeAspectFit;
            self.theMovie.moviePlayer.controlStyle = MPMovieControlStyleNone;
            self.theMovie.moviePlayer.movieSourceType = MPMovieSourceTypeFile;
    
            [self addSubview:self.theMovie.view];
            [self.theMovie release];
        }
        else 
        {
            [AssetValidator alertMissingFileInfo:videoFile];
        }
    

    这个很好用。

    我的问题是,每次我刷卡视频都会以延迟和黑屏开始。

    请指导如何解决这个问题。

    当做。

    2 回复  |  直到 10 年前
        1
  •  0
  •   Knodel    15 年前

        2
  •  0
  •   TechBee    10 年前