How To Check Status of uploaded video using Objective-c library (Direct upload)

128 views
Skip to first unread message

Tester sphinx

unread,
May 25, 2012, 2:17:38 AM5/25/12
to Google Data APIs Objective-C Client Library Discussion
I am using objective-c library of Google Data API 2.0 to upload the
video and It's uploading the video to my account but I want to know
the status of the uploaded video ,

as per as doc

If you upload a video using the direct upload method, then the Upload
API response will contain a <link> tag for which the value of the rel
attribute is self. To check the status of the uploaded video, send a
GET request to the URL identified in this <link> tag.

<link rel='self' type='application/atom+xml'
href='https://gdata.youtube.com/feeds/api/users/default/uploads/
Video_ID'/>


And I am using direct upload and implements the callback function "-
(void)uploadTicket:(GDataServiceTicket *)ticket
finishedWithEntry:(GDataEntryYouTubeVideo *)videoEntry
error:(NSError *)error {
" but I don't know how do I get above link with rel == self and HOW
DO I CALL THIS LINK???

HOW TO MAKE GET REQUEST USING gdata's objective-c library?

Greg Robbins

unread,
May 25, 2012, 3:31:34 AM5/25/12
to gdata-objec...@googlegroups.com
The Obj-C library uses the resumable upload protocol, not the older direct uploading method.

When fetching entries in the uploads feed, the state of each upload is available from its video entry as

GDataYouTubePublicationState *pubState = [videoEntry publicationState];
NSString *stateName = [pubState name];
if ([stateName isEqual:kGDataYouTubePubStateProcessing]) {
   // Still processing
} else { ... check other states...


Tester sphinx

unread,
May 25, 2012, 9:06:28 AM5/25/12
to Google Data APIs Objective-C Client Library Discussion
Hey thanks man ! but right now I am getting the status "processing"
in
- (void)uploadTicket:(GDataServiceTicket *)ticket
finishedWithEntry:(GDataEntryYouTubeVideo *)videoEntry
error:(NSError *)error

I have some task which should begin only after the video get
published , so I need to keep the track of when does this uploaded
video get published or rejected ?
right now I am sending the following request

-(void) getVideoStatus
{
// NSString *devKey = @"My dev key";

GDataServiceGoogleYouTube *service = [self youTubeService];
[service setUserCredentialsWithUsername:@"XXXX...@gmail.com"
password:@"XXXX"];

//[service setYouTubeDeveloperKey:devKey];


NSURL *url = [GDataServiceGoogleYouTube
youTubeGetVideoStatus:@"0hlGP_olENM"]; //[[NSUserDefaults
standardUserDefaults] objectForKey:@"Video"]];
[service fetchPublicEntryWithURL:url entryClass:
[GDataYouTubePublicationState class] delegate:self
didFinishSelector:@selector(serviceTicket:finishedWithObject:error:)];


}

- (void)serviceTicket:(GDataServiceTicketBase *)ticket
finishedWithObject:(GDataYouTubePublicationState *)object error:
(NSError *)error
{
NSLog(@"rsponse %@",[object description]);
}

in call back function when I print the description , it prints :
log : {content:
unparsed:<app:control>,<author>,<category>,<gd:comments>,<id>,<link>,<media:group>,<published>,<title>,<updated>,<yt:accessControl>
unparsedAttr:gd:etag}

And as per as google's documents

<entry gd:etag='W/"Ak4ER347eCp7ImA9WxRRF0k."'>
<id>tag:youtube,2008:video:b5bbb2beb5a7d9ca</id>
<app:control>
<app:draft>yes</app:draft>
<yt:state name='rejected'
reasonCode='tooLong'
helpUrl='http://www.youtube.com/t/community_guidelines'>
Video is too long.
</yt:state>
</app:control>
<yt:private/>
</entry>

You can check the status of a user's unpublished videos by retrieving
the user's uploaded videos feed. Entries in that feed that have not
been published will contain the <app:control> tag. Please note that
unpublished videos include videos that are still being processed, that
failed to upload or that were rejected after being uploaded.

so getting "<app:control>" in the response means video is in still in
processing or rejected

Here My concern is "HOW DO I PARSE THE RESPONSE COMING IN
serviceTicket:finishedWithObject:error TO GET THE VIDEO'S UPLOAD
STATUS "


please help

Greg Robbins

unread,
May 26, 2012, 1:18:04 AM5/26/12
to gdata-objec...@googlegroups.com
I suspect you will have to check the uploads feed periodically to determine when a video has finished processing. 

There is a separate discussion group on use of the YouTube API, https://developers.google.com/youtube/forum/discussion

I do not understand the code included in your message.

Tester sphinx

unread,
May 28, 2012, 2:09:30 AM5/28/12
to gdata-objec...@googlegroups.com
yes the code is little clumsy

here I explain the code I have call

-(void) getVideoStatus
{
   // NSString *devKey = @"XXXXX";

   
    GDataServiceGoogleYouTube *service = [self youTubeService];
    [service setUserCredentialsWithUsername:@"1...@gmail.com"
                                   password:@"123"];
   
    //[service setYouTubeDeveloperKey:devKey];


    NSURL *url =   @"https://gdata.youtube.com/feeds/api/videos/videoid?v=2"



  [service fetchPublicEntryWithURL:url entryClass:[GDataYouTubePublicationState class] delegate:self didFinishSelector:@selector(serviceTicket:finishedWithObject:error:)];
   
}

- (void)serviceTicket:(GDataServiceTicketBase *)ticket  finishedWithObject:(GDataObject *)object error:(NSError *)error

{
    NSLog(@"rsponse %@",[object description]);
   
}

So here in the response of serviceTicket:finishedWithObject:error method I got the GDataObject which might represent all xml feed of of provided videoid and now I want to fetch "app:control" tag from that xml to check the status of video!!!!1






--
You received this message because you are subscribed to the Google Groups "Google Data APIs Objective-C Client Library Discussion" group.
To post to this group, send email to gdata-objec...@googlegroups.com.
To unsubscribe from this group, send email to gdata-objectivec-...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gdata-objectivec-client?hl=en.

Aadil Shaik

unread,
May 28, 2012, 2:47:58 AM5/28/12
to gdata-objec...@googlegroups.com

hi all i want to upload the video to the YouTube from my iphone can any one please share the sample code ..... i ll be very much thank full to u ....



 Thanks in Advance ...
--

 Thanks & Regards.......? 
       Aadil Shaik
       iPhone Application Developer.

Reply all
Reply to author
Forward
0 new messages