Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 12-09-2011, 03:37 AM   #1 (permalink)
Registered Member
 
Join Date: Apr 2010
Posts: 17
erritikamathur is on a distinguished road
Default MPMoviePlayerController showing black empty screen

i use MPMoviePlayerController to play a local file in my Application Document folder which have i have downloaded for a server URL

Code:
itemMoviePlayerController = [[MPMoviePlayerController alloc] initWithContentURL:fileURL];
 [self.view addSubview:itemMoviePlayerController.view];
 itemMoviePlayerController.fullscreen = YES;
 itemMoviePlayerController.movieSourceType = MPMovieSourceTypeFile;
 itemMoviePlayerController.initialPlaybackTime = -1.0;
 [itemMoviePlayerController play];
When i play .mov file just after i downloaded it ,It shows up a black empty screen & app UI is unusable. But if play same local file next time ,it plays fine. I even verified playState & localState for MPMoviePlayerController they seems fine. What could be reason for black empty screen?
erritikamathur is offline   Reply With Quote
Old 12-09-2011, 03:53 AM   #2 (permalink)
Scan Me !
 
MozyMac's Avatar
 
Join Date: Nov 2009
Posts: 608
MozyMac is on a distinguished road
Send a message via AIM to MozyMac Send a message via MSN to MozyMac Send a message via Yahoo to MozyMac
Default

Is there sound?
MozyMac is offline   Reply With Quote
Old 12-09-2011, 04:21 AM   #3 (permalink)
Registered Member
 
Join Date: Jul 2010
Location: Glasgow
Posts: 58
MBaldo83 is on a distinguished road
Default

I've had that symptom when the .mov file was not encoded using the codec that MPMoviePlayerController understands, which as I remember is H.264.

Check if it's the code that's the problem by making a movie in iTunes that's formatted to work on the iPhone by selecting any movie that plays in iTunes, and selecting advanced - create iPod / iPhone version.

Check if this one will play, if it does, chances are it's the .mov you're downloading is the wrong codec.
MBaldo83 is offline   Reply With Quote
Old 12-09-2011, 05:13 AM   #4 (permalink)
Registered Member
 
Join Date: Apr 2010
Posts: 17
erritikamathur is on a distinguished road
Default

I donot even hear the sound for video.It seems video had ended before it could be played.
Also those videos were the one i created on iPad & upload to server,from where i am basically downloading same file.So i feel its nothing to do with wrong codec
As i mention i am question "When i play same local file next time ,it plays fine"
So it seems too weird
erritikamathur is offline   Reply With Quote
Old 12-09-2011, 05:58 AM   #5 (permalink)
Registered Member
 
Join Date: Jul 2010
Location: Glasgow
Posts: 58
MBaldo83 is on a distinguished road
Default

Quote:
Originally Posted by erritikamathur View Post
As i mention i am question "When i play same local file next time ,it plays fine"
So it seems too weird
Ok, sorry missed that, I guess maybe double check you're getting the correct path to the file you've just downloaded.

Not sure if it'll help, but here's a snippet of how I insert the movie player onto the screen

Code:
self.moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:videoUrl];
            [self.moviePlayer.view setFrame:self.view.bounds];
            [self.view insertSubview:self.moviePlayer.view atIndex:10];
            [self.moviePlayer setFullscreen:YES animated:YES];
            [self.moviePlayer play];
good luck!
MBaldo83 is offline   Reply With Quote
Old 12-09-2011, 06:22 AM   #6 (permalink)
Registered Member
 
Join Date: Apr 2010
Posts: 17
erritikamathur is on a distinguished road
Default

Path is correct for file which i have downloaded & now playing
Also could iPhone 3G play .mov files using MPMediaPlayerController because MPMoviePlayerPlaybackDidFinishNotification gives error log "Unsupported file format"
erritikamathur is offline   Reply With Quote
Old 12-09-2011, 06:28 AM   #7 (permalink)
Registered Member
 
Join Date: Jul 2010
Location: Glasgow
Posts: 58
MBaldo83 is on a distinguished road
Default

Quote:
Originally Posted by erritikamathur View Post
Path is correct for file which i have downloaded & now playing
Also could iPhone 3G play .mov files using MPMediaPlayerController because MPMoviePlayerPlaybackDidFinishNotification gives error log "Unsupported file format"
Could there be any difference with the local .mov that plays fine, and the downloaded .mov that doesn't?

Whenever I export movies for playing on iPhone, I always end up with a .m4v, although it does say in the docs that a .mov should work as well. I had your same black screen when I tried to play a .mov, so I thought it must something in the codec.
MBaldo83 is offline   Reply With Quote
Old 12-09-2011, 07:01 AM   #8 (permalink)
Registered Member
 
Join Date: Apr 2010
Posts: 17
erritikamathur is on a distinguished road
Default

Thanks MBaldo83 for quick responses.
I am actually saving the downloaded copy of video to App document directory then playing it.So i dont see any differences in both cases.
The only thing is same file plays fine next time.It not only plays on first instance
erritikamathur is offline   Reply With Quote
Old 03-09-2012, 12:20 PM   #9 (permalink)
Registered Member
 
Join Date: Jun 2009
Posts: 10
wolkje is on a distinguished road
Default

Quote:
Originally Posted by erritikamathur View Post
Thanks MBaldo83 for quick responses.
I am actually saving the downloaded copy of video to App document directory then playing it.So i dont see any differences in both cases.
The only thing is same file plays fine next time.It not only plays on first instance

Hi there erritikamathur,

I've the same problem when I copy a video file from my photo library to my documents. The video doesn't play the first time. And after restarting the app it magically plays.
Did you solve the problem? It's kinda weird to ask the user to restart the app to play the video.
wolkje is offline   Reply With Quote
Reply

Bookmarks

Tags
ios, mpmovieplayercontroller, video

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 413
13 members and 400 guests
7twenty7, AppsBlogger, David-T, Duncan C, EvilElf, HemiMG, heshiming, iekei, LunarMoon, Murphy, sacha1996, Sami Gh, teebee74
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,676
Threads: 94,127
Posts: 402,915
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jleannex55
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 06:45 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0