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 05-27-2011, 01:34 PM   #1 (permalink)
Registered Member
 
Join Date: Apr 2011
Posts: 18
MSP4444 is on a distinguished road
Default Load YouTube Video with MPMoviePlayerController

Hello all,

I've just attempted to load a YouTube with the MPMoviePlayerController and failed miserably. Here's the code I used...

Code:
-(IBAction)playVideo {
    
    NSURL  *movieURL = [NSURL URLWithString:@"http://www.youtube.com/watch?v=Jguhs6GxRvo"];
    MPMoviePlayerController *theMovie = [[MPMoviePlayerController alloc] initWithContentURL:movieURL];
    theMovie.scalingMode = MPMovieScalingModeAspectFit;
    [theMovie play];
    MPMoviePlayerViewController *moviePlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:movieURL];
    [self presentMoviePlayerViewControllerAnimated:moviePlayer];
    
}
The movie player loads but then quits as if it doesn't have anything to play.

Can anyone tell me whether what I'm trying to do is possible. If so, what am I doing wrong?

Cheers
MSP4444 is offline   Reply With Quote
Old 05-27-2011, 01:38 PM   #2 (permalink)
Reading the Documentation
 
baja_yu's Avatar
 
Join Date: Sep 2010
Location: 45.255019,19.844908
Posts: 5,414
baja_yu has a spectacular aura about
Default

The URL should point to a valid and supported media file, not to a web page.
baja_yu is offline   Reply With Quote
Old 05-27-2011, 01:39 PM   #3 (permalink)
Registered Member
 
Join Date: Apr 2011
Posts: 18
MSP4444 is on a distinguished road
Default

Quote:
Originally Posted by baja_yu View Post
The URL should point to a valid and supported media file, not to a web page.
So you're saying it's not possible?
MSP4444 is offline   Reply With Quote
Old 05-27-2011, 01:39 PM   #4 (permalink)
Nuisance Developer
 
Join Date: Jul 2009
Location: Italy
Posts: 4,691
dany_dev is on a distinguished road
Default

Quote:
NSURL *movieURL = [NSURL URLWithString:@"http://www.youtube.com/watch?v=Jguhs6GxRvo"];
lol.....


Basically you can't use MPMoviePlayerController to play a youtube video in this mode.

I advice you to use a UIWebView

How To Play YouTube Videos Within an Application
__________________
dany_dev is offline   Reply With Quote
Old 05-27-2011, 01:44 PM   #5 (permalink)
Registered Member
 
Join Date: Apr 2011
Posts: 18
MSP4444 is on a distinguished road
Default

Quote:
Originally Posted by dany_dev View Post
lol.....


Basically you can't use MPMoviePlayerController to play a youtube video in this mode.

I advice you to use a UIWebView

How To Play YouTube Videos Within an Application
Yes...thanks, helpful :/

I'm very aware of this method. I've only been playing around with to see if it was possible, but seeing as I'm finding it increasingly difficult to obtain a straight answer, I'll assume it's a no.
MSP4444 is offline   Reply With Quote
Old 05-27-2011, 01:47 PM   #6 (permalink)
Knows SQL
 
iisword's Avatar
 
Join Date: Oct 2009
Location: Somewhere the streets are on fire, the sewers are flooded, and the cats are high on catnip
Posts: 529
iisword is on a distinguished road
Default

Youtube uses a php script to get the video's link from a database. Unless you know how to access the php script to obtain the url for the movie, you can't use MPMoviePlayerController.
__________________
iisword is offline   Reply With Quote
Old 05-27-2011, 01:51 PM   #7 (permalink)
Registered Member
 
Join Date: Apr 2011
Posts: 18
MSP4444 is on a distinguished road
Default

Quote:
Originally Posted by iisword View Post
Youtube uses a php script to get the video's link from a database. Unless you know how to access the php script to obtain the url for the movie, you can't use MPMoviePlayerController.
Thanks, appreciate it. Was only a little experiment, so I think I'll abandon it.
MSP4444 is offline   Reply With Quote
Reply

Bookmarks

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: 343
6 members and 337 guests
doffing81, dre, iOS.Lover, jenniead38, Kirkout, Wikiboo
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,663
Threads: 94,120
Posts: 402,898
Top Poster: BrianSlick (7,990)
Welcome to our newest member, LezB44
Powered by vBadvanced CMPS v3.1.0

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