video plays but no picture - just sound?
-
Edit: if you come across this and want to know how I eventually solved it I gave up on that code below eventually and did this: -(void)playMovieAtURL:(NSURL*)theURL{ mediaPlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:theURL]; [self presentMoviePlayerViewControllerAnimated:mediaPlayer]; mediaPlayer.view.backgroundColor = [UIColor blackColor]; } Original post: This is my code - I took it off the apple site so shouldn't be a problem. It runs in a UITableViewController on the didSelectRowAtIndexPath method. When you select the row the video starts playing - the sound outputs at least - but there's no picture. Any idea why this is? I have included the framework. The video is one off the apple website (a facetime video) that I used for testing. -(void)playMovieAtURL:(NSURL*)theURL{ MPMoviePlayerController* theMovie = [[MPMoviePlayerController alloc] initWithContentURL: theURL]; theMovie.scalingMode = MPMovieScalingModeAspectFill; theMovie.controlStyle = MPMovieControlStyleNone; // Register for the playback finished notification [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(myMovieFinishedCallback:) name: MPMoviePlayerPlaybackDidFinishNotification object: theMovie]; // Movie playback is asynchronous, so this method returns immediately. [theMovie play]; }
-
Answer:
The behaviour of MPMoviePlayerController changed in OS 3.2 - you need to explicitly add the movie player's view to your view hierarchy now - using something like: [aView addSubview:moviePlayerController.view]; moviePlayerController.view.frame = aView.frame; Alternatively you can use an MPMoviePlayerViewController (new in 3.2) to manage the view. If you're targetting both pre- and post-3.2 devices (e.g. iOS 3.1 and 4.0) then you'll need some conditional code to determine the OS the code is running on and handle accordingly. I've used this in previous projects: if ([moviePlayerController respondsToSelector:@selector(setFullscreen:animated:)]) { // Running on OS 3.2 or above // Code to add to a view here... }
Thomas Clayson at Stack Overflow Visit the source
Related Q & A:
- How do I get and Icon for my picture, not just my avatar?Best solution by Yahoo! Answers
- Can I just out any video card in my computer?Best solution by Yahoo! Answers
- How do you make a video clip into a picture?Best solution by answers.microsoft.com
- How do I just take a short clip out of a video?Best solution by ehow.com
- No picture only sound/audio on HD channels?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.