NSString *path = [[NSBundle mainBundle] pathForResource:@"PTCL" ofType:@"mp4"];
NSURL *videoURL = [NSURL URLWithString:path];
MPMoviePlayerController *moviePlayerController = [[MPMoviePlayerController alloc] initWithContentURL:videoURL];
[moviePlayerController.view setFrame:self.view.frame];
[self.view addSubview:moviePlayerController.view];
moviePlayerController.controlStyle=MPMediaTypeAnyVideo;
moviePlayerController.fullscreen = YES;
[moviePlayerController prepareToPlay];
[moviePlayerController play];
NSString *path = [[NSBundle mainBundle] pathForResource:@"PTCL" ofType:@"mp4"];
path=[NSString stringWithFormat:@"file:/%@",path];
NSURL *videoURL = [NSURL URLWithString:path];
MPMoviePlayerController *moviePlayerController = [[MPMoviePlayerController alloc] initWithContentURL:videoURL];
[moviePlayerController.view setFrame:self.view.frame];
[self.view addSubview:moviePlayerController.view];
moviePlayerController.shouldAutoplay=YES;
moviePlayerController.controlStyle=MPMediaTypeAnyVideo;
moviePlayerController.fullscreen = YES;
[moviePlayerController prepareToPlay];
[moviePlayerController play];
- Datei: ///Users/utkal/Library/Application%20Support/iPhone%20Simulator/7.0.3/Applications/F0B3AD63-7E46 -4069-8845-8B0C05425CD2/CosMos.app/PTCL.mp4
ich erhalte diese videURL Weg für den ersten CodeMPMoviePlayerController Nicht spielen Lokale Datei
- Datei: ///Users/utkal/Library/Application%20Support/iPhone%20Simulator/7.0.3/Applications/F0B3AD63-7E46-4069-8845-8B0C05425CD2/CosMos.app/PTCL.mp4
Ich bekomme diesen videURL-Pfad für den zweiten Code.
ich alos haben verwenden
NSURL *videoURL = [[NSURL alloc]init];
videoURL = [[NSBundle mainBundle] URLForResource:@"PTCL" withExtension:@"mp4"];
Aber mein Video-Player zeigen immer diese Datei geladen wird und nichts passiert. Ich weiß, wo ich Fehler mache, aber mein Glück. Bitte korrigieren Sie meinen Fehler oder sagen Sie mir, wenn eine andere Möglichkeit, lokale Videodatei zu spielen. Bitte.
bitte versuchen Sie es: NSURL * videoURL = [NSURL fileURLWithPath: Pfad]; – Horst
@horst Das funktioniert auch nicht. Ich habe das gleiche Problem. – user623396
Ich habe das gleiche Problem, wenn Sie dieses Problem haben, sagen Sie mir. –