I am working on the app in which the user can upload videos to YouTube. Unless I move my login feature from client login to oauth2 does not work well Now I can successfully authorize the user and get the token, but I do not know how to use this ACCESS token to upload videos to GDATA API methods.
I am using some methods in GDATA which uses a username and password but now I have a dotn username and password. I use_token
- (zero ) Uploaded Video File: (GTMOAuth2Authentication *) auth {[mTitleField setText: [shareVidTitleArr ObjectAutEXx: 0]]; [MDescriptionField setText: [shareVidDescpArrObjectAntindexX: 0]]; [MKWordfield set text: @ "Hi"]; [MCategoryField setText: @ "Entertainment"]; NSString * devKey = [mDeveloperKeyField text]; GDataServiceGoogleYouTube * service = [youTubeService]; [Service set youtubedeveloper: devaki]; NSURL * url = [GDataServiceGoogleYouTubeYouTubeUploadURLForUserID: kGDataServiceDefaultUser]; // NSURL * url = [GDataServiceGoogleYouTubeYouTubeUploadURLForUserID: clientID]; // Load the file data NSArray * searchPath = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, yes); NSString * docDir = [SearchPath ObjectAntIndex: 0]; NSString * Path = [docDir StringBappingSettingsCompany: [shareVidArr objectAtIndex: 0]]; NSDT * Data = [NSData DataWith ContentAffFile: Path]; NSString * filename = [path lastpiece]; NSLog (@ "% @", file name); // Media Group NSString * titleStr = [mTitleField text] collect all the metadata required; Gdatameditialtitle * title = [gdtmediatitial textconstructivity string: title summary]; NSString * Category Str = [mCategoryField Text]; Gidata Media Category * Category = [GdTmedia Caribbean Media Credentialsthreatring: Category STR]; [Class Set Scheme: KGDataMayYUtCreature]; NSString * descStr = [mDescriptionField text]; GatatmediaDescriptions * desc = [gdtmediadeskation textvide: descStr]; NSString * keywordsStr = [mKeywordsField text]; ZetaTamediaKeywords * Keyword = [GidataMediaKeyword's keywordsWithString: Keyword STR]; BOOL is private = MIS private; Gdita YouTube Media Group * Media Group = [Gdita YouTube Media Group Media Group]; [Media group setmedia title: title]; [Media groupmediaDescriptation: desc]; [Media Group Media Category: Category]; [Media group setmedia keyword: keyword]; [Media Group SetIsprit: Ipivate]; // [Media group set property: file name for: @ "VIDID"]; NSString * mimeType = [Gidata devices MIMETypeForAtPath: Path Default MIMEType: @ "Video / QuickTime"]; // Create Upload Entry with Media Group and File Data GDataEntryYouTubeUpload * Entry; Entry = [GdTentry Youtube Upload Upload Entrepreneur Group Group: Media Group Data: Data MimeType: Mimetype Slug: Filename]; SEL Progress = cell = @ selector (Ticket: is Published Bytecount: ofTotalByteCount :); [Service Set-upSubpleload Progress Selector: Progress SEL]; GDATA service ticket * ticket; Ticket = [service fetchEntryByInsertingEntry: Entry for Fred-URL: URL Representative: Self-finisher secretary: @Selector (UploadTicket: ClosingCertry: Error :)); [Auto-setuploadticket: tickets];
}
Here's the full example:
This data uses API v3, which is the new API, GDITA will soon be removed.
Comments
Post a Comment