MPMoviePlayer - qora ekran - iOS 5 - hech qanday videoni ijro etish

Ushbu Kod iOS 4 da kino o'ynash uchun ishladi:

-(IBAction)playMovie:(id)sender
{
    NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"testbild1" ofType:@"m4v"]];
    MPMoviePlayerController *moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];
    UIView *testview = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 200, 200)];

    [testview addSubview:moviePlayer.view];
    [self.view addSubview:testview];
    //[self.view addSubview:moviePlayer.view];
    //[moviePlayer setFullscreen:YES animated:YES];
}  

- (void)moviePlaybackComplete:(NSNotification *)notification  
{  
    MPMoviePlayerController *moviePlayerController = [notification object];  
    [[NSNotificationCenter defaultCenter] removeObserver:self  
                                                    name:MPMoviePlayerPlaybackDidFinishNotification  
                                                  object:moviePlayerController];  

    [moviePlayerController.view removeFromSuperview];  
    //[moviePlayerController release];  
}  

Keling, faqat blackscreen olish. Hech qanday nazorat yo'q. Video yo'l to'g'ri, men buni sinab ko'rdim. Tugmani bosish bilan faqat oq rangli ko'rinishni qo'shsam, u ishlaydi. Shuning uchun usul chaqiriladi.

Oldindan rahmat!

4

2 javoblar

.H faylga qo'yib, masalani hal qildim

MPMoviePlayerController *moviePlayer;

iOS 5 iOS 5 iOS 4-dan farqli o'laroq ishlaydi.

.M fayl bo'lishi kerak:

moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];
13
qo'shib qo'ydi
PhoneGap bilan ishlash mumkinmi? Bu tuzumdan foydalanib tuzatishni qanday amalga oshirish kerakligiga ishonchim komil emas
qo'shib qo'ydi muallif bafromca, manba
bu men uchun ishlamaydi
qo'shib qo'ydi muallif ios, manba
Xuddi shu narsani (boshqa loyihada) men shu tarzda qildim va qasddan shu tarzda qo'ydim va u mukammal ishladi. Menimcha, bu shunday. Sizning hissangiz uchun tashakkur.
qo'shib qo'ydi muallif DAS, manba
WTF. Yana bir loyihada yana bir xatoga yo'l qo'ygan va bu QO`LDaR yechimidir.
qo'shib qo'ydi muallif DAS, manba

Agar siz iOS 5.0 yoki 5.1-da bo'lsangiz, filmingizni tekshiring. Quyidagi kabi sozlamalar mavjud.

[moviePlayer setControlStyle: MPMovieControlStyleFullscreen];

Agar shunday bo'lsa, [moviePlayer setFullScreen: YES animatsiya: YES]; MPMoviePlayerWillExitFullscreenNotification yoki MPMoviePlayerDidExitFullscreenNotification nomi o'rniga MPMoviePlayerPlaybackDidFinishNotification bildirishnomasi chaqiriladi

1
qo'shib qo'ydi