के साथ वीडियो नहीं चला सकता है मैंने निम्नलिखित ViewController.m के साथ एक नई परियोजना बनाई है। जब मैं ऐप चलाता हूं तो मैं अपेक्षित मूल/आकार (38, 100, 250, 163) का एक बॉक्स देख सकता हूं लेकिन यह काला है और कोई वीडियो नहीं चल रहा है। वहाँ Xcode में एक अजीब उत्पादन होता है:MPMoviePlayerViewController
2012-08-23 15:36:45.559 VideoTest1[11398:c07] [MPAVController] Autoplay: Disabling autoplay for pause
2012-08-23 15:36:45.560 VideoTest1[11398:c07] [MPAVController] Autoplay: Disabling autoplay
2012-08-23 15:37:18.186 VideoTest1[11398:c07] [MPAVController] Autoplay: Skipping autoplay, disabled (for current item: 1, on player: 0)
ध्यान दें कि वीडियो Videora iPhone कनवर्टर के साथ बदला है और Xcode में ठीक खेलता है (इसलिए यह एक वीडियो समस्या नहीं है) है; वीडियो का मार्ग ठीक है क्योंकि जब मैं डेमो-आईफोन 1 निर्दिष्ट करता हूं (जो अस्तित्व में नहीं है) मुझे शून्य अपवाद मिलता है। मैंने सिम्युलेटर और आईफोन पर कोशिश की: हमेशा ब्लैक बॉक्स। कोई विचार?
#import "ViewController.h"
#import <MediaPlayer/MediaPlayer.h>
@interface ViewController()
@end
@implementation ViewController
- (void)moviePlaybackComplete:(NSNotification *)notification
{
MPMoviePlayerController *moviePlayerController = [notification object];
[[NSNotificationCenter defaultCenter] removeObserver:self
name:MPMoviePlayerPlaybackDidFinishNotification
object:moviePlayerController];
[moviePlayerController.view removeFromSuperview];
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
NSString *filepath = [[NSBundle mainBundle] pathForResource:@"demo-iPhone" ofType:@"mp4"];
NSURL *fileURL = [NSURL fileURLWithPath:filepath];
MPMoviePlayerController *moviePlayerController = [[MPMoviePlayerController alloc] initWithContentURL:fileURL];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlaybackComplete:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:moviePlayerController];
[moviePlayerController.view setFrame:CGRectMake(38,
100,
250,
163)];
[self.view addSubview:moviePlayerController.view];
[moviePlayerController play];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}
@end
क्या आपने किसी अन्य वीडियो के साथ प्रयास किया है। शायद एक mp4 vimeo से डाउनलोड किया? –
स्टीव, वीडियो वास्तव में ठीक है क्योंकि यह मेरे दूसरे ऐप में बिल्कुल उसी कोड के साथ खेलता है। लेकिन अभी भी अंतर नहीं पता कर सकते हैं। बीटीडब्ल्यू मैंने एक्सकोड आउटपुट जोड़ा। शायद यह आपको कुछ विचार देगा कि यह समस्या क्या है। – maxgrinev