Search code examples
iphoneobjective-cioscocoa-touchgdata

Set a YouTube video's privacy using GData Obj-C


I know I can set a video as 'Private', while uploading it to Youtube, by :

GDataYouTubeMediaGroup *mediaGroup = [GDataYouTubeMediaGroup mediaGroup];
[mediaGroup setIsPrivate:YES];

Is there a similar way to set a video as 'Unlisted', while uploading it ?

Thanks in advance.


Solution

  • Since I wasn't using an updated version of the GData APIs, first I had to make the changes listed here :

    [ http://code.google.com/p/gdata-objectivec-client/source/detail?r=669 ]

    Then I used the following code to set the video as 'Unlisted', while uploading it to Youtube :

    GDataEntryYouTubeUpload *entry;
    entry = [GDataEntryYouTubeUpload uploadEntryWithMediaGroup:mediaGroup
                                                          data:data
                                                          MIMEType:mimeType
                                                          slug:filename];
    
    [entry addAccessControl:[GDataYouTubeAccessControl
                            accessControlWithAction:@"list" permission:@"denied"]];
    

    Make sure the video is NOT set as 'Private' for this to work :

    [mediaGroup setIsPrivate:NO];
    

    Got some major help from :

    [ http://groups.google.com/group/gdata-objectivec-client/browse_thread/thread/da69a5ecbb6dfa42?fwc=1 ]