0
我需要在一層UIView上播放MPMoviePlayerController。但只有聲音出來,沒有視頻。MPMoviePlayerController空白層
theMovie = [[MPMoviePlayerController alloc] initWithContentURL:movieURL];
[theMovie prepareToPlay];
theMovie.view.frame = CGRectMake(0, 0, 200, 150);
[theMovie setControlStyle:MPMovieControlStyleDefault];
[theMovie setFullscreen:NO animated:YES];
theMovie.shouldAutoplay = YES;
[theMovie setContentURL:movieURL];
[self addSubview:theMovie.view];
[theMovie play];
我只有黑屏,只有音頻。這是因爲我調用UIView作爲圖層,而不是子視圖?因爲我的要求是將UIView作爲圖層調用。
嗨,我有碰撞與訊息話題終止應用程序由於未捕獲的異常「NSInvalidArgumentException」,理由是:「一個AVPlayerItem不能AVPlayer'.Thanks的多個實例相關聯.. – user3231429
嘗試設置sourceType後設置的contentURL像下面的moviePlayerController_ = [[MPMoviePlayerViewController alloc] init]; moviePlayerController_.movieSourceType = MPMovieSourceTypeStreaming; [moviePlayerController_.moviePlayer setContentURL:url]; (來自:http://stackoverflow.com/questions/12041260/an-avplayeritem-cannot-be-associated-with-more-than-one-instance-of-avplayer) – MCMatan
嗨,現在的崩潰消失了,但屏幕是仍然是空白的,只有音頻播放。感謝btw .. – user3231429