iam using mediaplayercontroller in iphone and in this i am able to run video from my app resorce folder but when i want to play youtube video on it then i Found Server is not Configured Error i am able to run it through two method 1)by openurl 2)mapview but when i passes url to it then it not play video i have download the sample code from apple site and i found same error for that server is not configured.. nad after seraching in thenet that this is erroo of bad url which i got from the url is it correct or not i am not sure..i am writing my code here
// has the user entered a movie URL?
if (self.movieURLTextField.text.length > 0)
{
NSURL *movieURL = [NSURL URLWithString:self.movieURLTextField.text];
if (movieURL)
{
if ([movieURL scheme]) // sanity check on the URL
{
MoviePlayerAppDelegate *appDelegate = (MoviePlayerAppDelegate *)[[UIApplication sharedApplication] delegate];
// initialize a new MPMoviePlayerController object with the specified URL, and
// play the movie
[appDelegate initAndPlayMovie:movieURL];
}
}
}
waiting for the fruitful result….thanks
You can’t directly link to the YouTube video from the MPMoviePlayerController. You need to open up a UIWebView and link to the resource from there. UIWebView detects that it is a YouTube video and handles it appropriately with the YouTube mobile app, which will subsequently return to your app. See http://iphoneincubator.com/blog/audio-video/how-to-play-youtube-videos-within-an-application
Edit: To autoplay, you’ll need to find the play button in the UIWebView and send it a press event(UIControlEventTouchUpInside). The following link has an excellent example. http://boydlee.com/2010/05/auto-playing-a-youtube-video-inside-uiwebview/