【问题标题】:How can i add videos to iphone app [duplicate]如何将视频添加到 iPhone 应用程序 [重复]
【发布时间】:2012-10-13 01:35:00
【问题描述】:

可能重复:
Video file formats supported in iPhone

我想知道哪些格式可以放在 iPhone 应用程序中,有一个视图,我想把这个视频放在那里自动开始......

【问题讨论】:

    标签: iphone objective-c ios cocoa-touch video


    【解决方案1】:

    此代码应将 MPMoviePlayerController 添加到您的视图中,并使用已导入项目的视频自动开始播放。

    NSString *filepath = [[NSBundle mainBundle] pathForResource:@"filename" ofType:@"mp4"];
    NSURL    *fileURL    =   [NSURL fileURLWithPath:filepath];
    player = [[MPMoviePlayerController alloc] initWithContentURL:fileURL];
    player.frame = CGRectMake(0, 0, 1024, 768);
    [self.view addSubview:player.view];
    player.fullscreen = NO;
    [player play];
    

    *例如我使用了 .mp4 文件类型

    【讨论】:

      猜你喜欢
      • 2020-12-15
      • 2011-06-30
      • 2012-02-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多