My code can upload the video to YouTube successfully, I want to get the embed link of the uploaded video, and put this link to another website, so that I can see the video from that website.
How can I get that link?
I use code below to upload the video, but I can not see any useful information from the returned ticket.
GDataServiceTicket *ticket;
ticket = [service fetchEntryByInsertingEntry:entry
forFeedURL:url
delegate:self
didFinishSelector:#selector(uploadTicket:finishedWithEntry:error];
Is there anyone can help me out here?
Thanks a lot
You should be able to get the url from the entry object in your callback handler.
- (void)uploadTicket:(GDataServiceTicket *)ticket
finishedWithEntry:(GDataEntryYouTubeVideo *)videoEntry
error:(NSError *)error {
if (error == nil) {
NSString *url = [[[[video mediaGroup] mediaContents] objectAtIndex:0] URLString];
}
}
Related
I am an ios developer,i am working on app in which i needs to send video on twitter.But i searched and found that we can only post link of Video,but cannot post the video itself in iPhone sdk.
Can anyone suggest me what to do,if i need to post video on twitter.
You can use TWRequest class with
- (void)addMultiPartData:(NSData *)data withName:(NSString *)name type:(NSString *)type
I am not sure if uploading video is possible.
More on using TWRequest https://dev.twitter.com/docs/ios/posting-images-using-twrequest
I just suggest you to look over the TwitVid documentation From bellow link:
http://twitvid.pbworks.com/w/page/22556295/FrontPage
UPDATE:
i use this type of logic in 4.3 with shareKit
NSString *urlstr =[YorURL stringByReplacingOccurrencesOfString:#" " withString:#""];
[urlstr retain];
NSString *apiEndpoint = [NSString stringWithFormat:#"http://tinyurl.com/api-create.php?url=%#",urlstr];
[apiEndpoint retain];
NSLog(#"\n\n APIEndPoint : %#",apiEndpoint);
NSString *shortURL = [NSString stringWithContentsOfURL:[NSURL URLWithString:apiEndpoint]
encoding:NSASCIIStringEncoding
error:nil];
[shortURL retain];
NSLog(#"Long: %# - Short: %#",urlstr,shortURL);
NSString *txtShare=[NSString stringWithFormat:#"You watching Your %#",shortURL];
SHKItem *item = [SHKItem text:txtShare];
[SHK setRootViewController:self];
[SHKTwitter shareItem:item];
hope this help you...
Thanks to the uploading media new API, you can share video to twitter. And I have tried it, it works.
Please check this: https://github.com/liu044100/SocialVideoHelper
You just need to call this class method.
+(void)uploadTwitterVideo:(NSData*)videoData account:(ACAccount*)account withCompletion:(dispatch_block_t)completion;
Hope it can resolve your problem.
I successfully posted content and (Links)URL using Google Plus API in iphone.
Using Following code:
googleShare =[[[GooglePlusShare alloc] initWithClientID:#"my key"] autorelease];
[googleShare setDelegate:self];
appDelegate.shareGOOGLe =googleShare;
NSString *inputURL = #"";
NSURL *urlToShare = [inputURL length] ? [NSURL URLWithString:inputURL] : nil;
NSLog(#"%#",urlToShare);
NSString *inputText = #"TEst Sharing testing from iOS 5.0";
NSString *text = [inputText length] ? inputText : nil;
NSLog(#"%#",text);
[[[[googleShare shareDialog]
setURLToShare:urlToShare]
setPrefillText:shareMessge] open];
But I want to post images to google plus.
Can any one help me?
Thanks in advance.
It is currently not possible to share images on Google+ with the Google+ iOS SDK.
This is possible to share a Image with google plus
- (IBAction) didTapShare: (id)sender {
id<GPPNativeShareBuilder> shareBuilder = [[GPPShare sharedInstance] nativeShareDialog];
[shareBuilder attachImage:[UIImage imageNamed:#"yourImagename.png"]];
[shareBuilder open];
}
Referenced from https://developers.google.com/+/mobile/ios/share/
#Chirag... You should see Flipboard application for iPhone/iPad. It shares the link,comment and Image on Google+ account. Please take a look and let me know if i am wrong at any point.
These are the links will help:
Link Shows how and what can be shared.
https://developers.google.com/+/mobile/ios/share/
at the bottome of link 1, it mentions "Attaching media to your shared posts. You can attach pictures and movies to your posts for your users to share to their stream."
https://developers.google.com/+/mobile/ios/share/media
Link 2 shows the code snippet to share the media ; images and videos
Following is the Code snippet to share Image on google+
- (IBAction) didTapShare: (id)sender {
id<GPPNativeShareBuilder> shareBuilder = [[GPPShare sharedInstance] nativeShareDialog];
// Set any prefilled text that you might want to suggest
[shareBuilder setPrefillText:#"Achievement unlocked! I just scored 99 points. Can you beat me?"]
NSString *fileName = #"samplemedia1";
[shareBuilder attachImage:[UIImage imageNamed:fileName];
[shareBuilder open];
}
I was wondering if anyone had any information of code that they have used to upload an image to Picasa. I really only need the code to upload images, I have everything working to get the image feed and view it, but going the other way is giving me a problem.
Google does not really provide any good documentation for how to do this. Any help would be greatly appreciated, thanks in advance!
Check this code:
GDataServiceGooglePicasaWeb* service =
[[GDataServiceGooglePicasaWeb alloc] init];
[service setUserCredentialsWithUsername:#"my.account#gmail.com"
password:#"mypasswd"];
// get the URL for the album
NSURL *albumURL = [GDataServiceGooglePicasaWeb
picasaWebFeedURLForUserID:#"my.account" albumID:nil
albumName:#"MyBestPhotos" photoID:nil kind:nil access:nil];
// set a title and description for the new photo
GDataTextConstruct *title, *desc;
title = [GDataTextConstruct textConstructWithString:#"Sunset Photo"];
desc = [GDataTextConstruct textConstructWithString:#"A nice day"];
GDataEntryPhoto *newPhoto = [GDataEntryPhoto photoEntry];
[newPhoto setTitle:title];
[newPhoto setPhotoDescription:desc];
// attach the photo data
NSData *data = [NSData dataWithContentsOfFile:#"/SunsetPhoto.jpg"];
[newPhoto setPhotoData:data];
[newPhoto setPhotoMIMEType:#"image/jpeg"];
// now upload it
GDataServiceTicket *ticket;
ticket = [service fetchPicasaWebEntryByInsertingEntry:newPhoto
forFeedURL:albumURL
delegate:self
didFinishSelector:#selector(addPhotoTicket:finishedWithEntry:)
didFailSelector:#selector(addPhotoTicket:failedWithError:)];
Source: http://googlemac.blogspot.com/2007/06/picasa-web-albums-meets-google-data.html
- (void)postToWall {
FBStreamDialog* dialog = [[[FBStreamDialog alloc] init] autorelease];
dialog.userMessagePrompt = [NSString stringWithFormat: subjectTitle]; //subjectTitle works here but not as name where i need it.
NSString *src = #"http://www.sample.com/image.png";
NSString *name = storyLink; //<---------------------------------works with storyLink but not subjectTitle. I need subjectTitle to work here
NSString *href = storyLink;
NSString *attachment = [NSString stringWithFormat:#"{\"name\":\"%#\",\"media\":[{\"type\":\"image\", \"src\":\"%#\", \"href\":\"%#\"}]}", name, src, href];
dialog.attachment = attachment;
[dialog show];
}
i want to add image from photo library instred of http://www.sample.com/image.png to the facebook wall.
can anyone provides me help ....
Thanks in advance ......
You can access the URL's of the iPhoto library items using the UIImagePickerController and its delegate method.
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
When the user picks a photo the URL will be in the dictionary under the key UIImagePickerControllerMediaURL
Probably this Stack Overflow Question about uploading images to Facebook might help you.
Also Sharekit is a nice framework to add Social features to you iPhone App. I think it has facility to share images. You can check it out at Sharekit official website.
I'm currently creating a twitter client for iphone.
Basically, I have three kinds of url types I want to handle:
Standard URL's (e.g. http://www.msn.com)
YouTube URL's
URL's containing links to a stream.
When a user clicks a link.. instead of launching the web view and letting the webview decide whether to load quicktime player & youtube player, I want to be able to handle it within the app.
i.e. how can i code something like:
check link
if link = link.youtube then
load youtube player
if link = link.mp3 stream then
load quicktime player
else
load in webview
Checking youtube is easy, you can just check the domain like
[NSString rangeOfSubstring:#"youtube.com"].location != NSNotFound
The mp3 stream is not so hard, you check for the last extension by getting the last "." and then check it agains the set of video stream format like:
NSArray *possibleExtensions = [url componentsSeparatedByString:#"."];
NSString *extension = [possibleExtensions objectAtIndex:([possibleExtensions count] - 1)];
NSSet *extensionSet = [NSSet setWithObjects: #"mp4", #"mov", #"m4v", #"mpv", #"3gp", nil];
BOOL isStream = [extensionSet containsObject:extension];
If you want to check for normal link, you can use Regular expression:
NSString *regrexUrl = #"\\b((?:[\\w-]+://?|www[.])[^\\s()<>]+(?:\\([\\w\\d]+\\)|(?:[^\\p{Punct}\\s]|/)))";
// Based on http://daringfireball.net/2009/11/liberal_regex_for_matching_urls
NSString *urlString = [YOUR_STRING_HERE stringByMatching:NCPARSER_REGEX_URL capture:1];
if (urlString) {
NSLog(#"It is an url");
}