【发布时间】:2010-06-30 14:48:56
【问题描述】:
我的 iPhone 是 iOS4(3.1.3 更新)。 我尝试了这段代码。
#import <UIKit/UIKit.h>
@interface testViewController : UIViewController {
}
@end
//-------------------------------------------------
#import <MediaPlayer/MediaPlayer.h>
#import "testViewController.h"
@implementation testViewController
- (void)viewDidLoad {
[super viewDidLoad];
NSBundle *Bundle = [NSBundle mainBundle];
NSString *moviePath = [Bundle pathForResource:@"test" ofType:@"MOV"];
NSURL *videoURL = [[NSURL fileURLWithPath:moviePath] retain];
MPMoviePlayerViewController *theMovie = [[MPMoviePlayerViewController alloc] initWithContentURL:videoURL];
[self presentMoviePlayerViewControllerAnimated:theMovie];
theMovie.moviePlayer.movieSourceType = MPMovieSourceTypeFile;
[theMovie.moviePlayer play];
}
- (void)dealloc {
[super dealloc];
}
@end
当我运行应用程序时,视频不起作用,只是播放声音。 这段代码有什么问题?
谢谢。
【问题讨论】:
-
我在我的应用程序中遇到了同样的问题。 Here is a link to my solution.