Use Vimeo videos inside iPhone/iPad app - iphone

our client's video archive is hosted on vimeo, so I want to know if it is possible to use vimeo videos inside of iOS app so that user could press button and get fullscreen video playing in default video player. Is there any kind of API available for that?
upd: I know that in 2010 there was same question on SO, but maybe things changed during last year.

Get the video id, and load it into a webview using the vimeo player url. It will open the quicktime player in full screen mode on tap of the play button.
urlAddress = [NSString stringWithFormat:#"http://player.vimeo.com/video/%#",videoID];
NSURL *url = [NSURL URLWithString:urlAddress];
self.requestObj = [NSURLRequest requestWithURL:url];
[self.webView loadRequest:requestObj];

You can use YTVimeoExtractor to extract the mp4 url that is usable in MPMoviePlayerViewController.

Related

how to get YouTube Video URL

I am looking for Youtube Downloader app .and to download Video Firstly I need to get the URL of the Running video.How do I get the url of the video which i play.
but when I play any video into the simulator it automatically gives me some information of the url..which is
2013-02-21 12:25:26.518 MyTube[682:14003] [MPAVController] Autoplay: Enabling autoplay
2013-02-21 12:25:26.518 MyTube[682:14003] [MPAVController] Autoplay: Skipping autoplay, disabled (for current item: 0, on player: 1)
2013-02-21 12:25:26.518 MyTube[682:14003] setting movie path: http://r19---sn-a5m7lner.c.youtube.com/videoplayback?mt=1361429411&ipbits=8&fexp=919113%2C927902%2C916716%2C916612%2C901447%2C902545%2C920704%2C912806%2C902000%2C922403%2C922405%2C929901%2C913605%2C925006%2C906938%2C931202%2C908529%2C920201%2C930101%2C926403%2C901451&newshard=yes&key=yt1&signature=2AB1FC44B4EDA0C5DDF4E715FDCA19FFB16E0FF7.732382C58B3C8CBC4840D462940DFE2FEC9FBE53&source=youtube&sver=3&mv=m&expire=1361452937&ms=au&itag=36&el=watch&dnc=1&cp=U0hVRlRQUF9IUUNONV9MSlRKOjVNc1BwWTUxSVR2&upn=r3oQUqMCths&sparams=cp%2Cid%2Cip%2Cipbits%2Citag%2Cratebypass%2Csource%2Cupn%2Cexpire&ip=117.215.128.101&app=youtube_mobile&ratebypass=yes&yms=0PtNsY21DUs&id=2a147a30c3da7601
that means setting movie path url which I needed ..but it comes automatically in the output ..do can i fetch this url ...so that I can download
I am just Playing youtube video into the Webview
[webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:#"http://m.youtube.com"]]];
You can use the YouTube API to fetch the URL. Take a look here and here
Youtube is a little bit tricky in iOS because it's doesn't provide the real video link that obvisioulsy.
There is a good plugin clalled LBYoutubeView which handles to extract the real url for you. You can have a look at the link extractor if you just want to download the video...
Another opportunity is to use the gdata objective c client and and import the extracted link in an UIWebView. But keep in mind that the gdata client doesn't provide you with the real link like the framework above.
And be aware, that UIWebivews in simulators < 6.0 probably do not support playing a youtube video in a UIWebview.
At least here is an example of how to embed a youtube video directly in an UIWebView:
[self.webView loadRequest:[NSURLRequest requestWithURL:
[NSURL URLWithString:
[NSString stringWithFormat:#"%#%#", #"http://www.youtube.com/embed/", #"THEYOUTUBEID"]]]];
You can use HCYoutubeParser:
https://github.com/hellozimi/HCYoutubeParser
NSString *videoUrl = [NSString stringWithFormat:#"https://www.youtube.com/watch?v=%#", videoId];
NSDictionary *videos = [HCYoutubeParser h264videosWithYoutubeURL:[NSURL URLWithString:videoUrl]];
videoUrl = videos[#"small"];

start playing music on spotify from another iphone app

iv created an app but id like to add a feature where when i press a button it opens my spotify app and automatically plays music... if this is even possible that is... iv got most of it done i think, iv got the button and it opens spotify but cant find out how to auto play, has anyone done this or knows how to?
-(IBAction)spotify:(id)sender {
NSString *stringURL = #"spotify:";
NSURL *url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];
}
please help :)
You can open most spotify: URLs (using [[UIApplication sharedApplication] openURL:];) and the Spotify iOS client will open and show them.
There's some documentation here - make sure you use spotify: URIs and not HTTP URLs.
However, the iOS client currently doesn't support autoplay that I'm aware of - it'll be up to the user to push play.
Alternatively, you could use CocoaLibSpotify to embed Spotify playback right inside your app.

How to make vimeo video autoplay on iPhone/iPad?

I'm trying to embed a vimeo video into my app using UIWebView.
Currently my code looks like this and it plays the video fine if you press play, but I would like it to play when the UIWebView loads and I'm not sure how to make that happen.
NSURL *videoURL = [NSURL URLWithString:#"http://player.vimeo.com/video/123456?autoplay=1"];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:videoURL];
UIWebView * SignUpVideo = [[UIWebView alloc] init];
MyVideo.frame = CGRectMake(0,125,781,481);
[self.view addSubview:SignUpVideo];
[MyVideo loadRequest:requestObj];
This is placed under -(void)viewDidLoad
The autoplay URL parameter doesn't work in Mobile Safari either. I'm thinking you may be out of luck unless you can get a URL for a direct stream. But in that case you could use the AVPlayer instead of a web view and have all of the flexibility you need.
Here is an interesting discussion about the vimeo direct link URLs: How can I find download links for vimeo videos? . However, according to that, vimeo doesn't allow that technique so you might want to take a look a the developer APIs here: https://developer.vimeo.com
Best regards.

Handle control buttons of UIwebview youtube video player

I'm creating a youtube videos player which can play a list of youtube video ( given a list of video id). I embedded youtube video into a UIWebview as following:
NSString *htmlFormat = #"<html><head><body style=\"margin:0\"><embed id=\"yt\" src=\"%#\" type=\"application/x-shockwave-flash\" width=\"40\" height=\"30\"></embed></body></html>";
NSString *url = [NSString stringWithFormat:#"http://www.youtube.com/watch?v=%#", videoId];
NSString *html = [NSString stringWithFormat:htmlFormat, url];
[webView loadHTMLString:html baseURL:nil];
What i need are:
Next video is played automatically when player finishes playing current one.
Next video is played when user tap next button in players' control panel
Stop playing list if user tap 'Done' button.
My approach is handling events that may be sent out when player finish playing, users tap control buttons, so i can modify html content to load other videos.
My question are:
Is there better way to play a list of youtube video given a list of video ids?
How to handle such those events?
I found some solutions that suggest handle notification UIMoviePlayerControllerDidExitFullscreenNotification and UIMoviePlayerControllerDidEnterFullscreenNotification, but I can not distinguish between control buttons' events and finish playing event (movie player controller exits fullscreen mode in all the cases). Some suggest using HTML <video> tag, but i dont think it possible.

How play the video using “HTTP Live Streaming” in iphone?

I am new to iphone development,I am parsing a XML URL and display its content in the table, when i click a row , its corresponding parsed tube URL is played using the movie player.I am using media player framework.Here is my code
NSURL *movieURL = [NSURL URLWithString:requiredTubeUrl];
if (movieURL)
{
if ([movieURL scheme])
{
MoviePlayerController *myMovie = [[MoviePlayerController alloc]init];
[myMovie initAndPlayMovie:movieURL];
}
}
This is working fine, but i want to play the video using "HTTP Live Streaming".How can i do that? Any tutorials and sample code would me more helpful.Thanks.
Apple provides and overview and some sample pages with streams. You provide the playlist file (.M3U8) URL to your MPMoviePlayer instance. If your server is set up properly, the .M3U8 file URL should suffice.
http://developer.apple.com/iphone/library/documentation/NetworkingInternet/Conceptual/StreamingMediaGuide/Introduction/Introduction.html#//apple_ref/doc/uid/TP40008332-CH1-DontLinkElementID_29
To implement in for the browser, which applies for a lot to native app development since it directs iphone users to movie app. A lot depends on the proper stream you're wanting to view http://www.ioncannon.net/programming/452/iphone-http-streaming-with-ffmpeg-and-an-open-source-segmenter/
Use MPMoviePlayerController for streaming from server.
-(void)initAndPlayMovie:(NSURL *)movieURL
{
// Initialize a movie player object with the specified URL
MPMoviePlayerController *mp = [[MPMoviePlayerController alloc] initWithContentURL:movieURL];
if (mp)
{
[self.moviePlayer play];
}
}