Reputation: 3
I read from the document here that there's a method setMonetizationDetails(VideoMonetizationDetails monetizationDetails)
, so here's my code
Video videoObjectDefiningMetadata = new Video();
// Set the video to be publicly visible. This is the default
// setting. Other supporting settings are "unlisted" and "private."
VideoStatus status = new VideoStatus();
status.setPrivacyStatus("public");
videoObjectDefiningMetadata.setStatus(status);
//set accesspolicy: allow monetize or not
AccessPolicy accessPolicy = new AccessPolicy();
accessPolicy.setAllowed(false);
VideoMonetizationDetails videoMonetizationDetail = new VideoMonetizationDetails();
videoMonetizationDetail.setAccess(accessPolicy);
videoObjectDefiningMetadata.setMonetizationDetails(videoMonetizationDetail);
/*set snippet*/
YouTube.Videos.Insert videoInsert = youtube.videos()
.insert("monetizationDetails,snippet,statistics,status,contentDetails", videoObjectDefiningMetadata, mediaContent);
it gives an error
GoogleJsonResponseException code: 403 : Forbidden
com.google.api.client.googleapis.json.GoogleJsonResponseException: 403 Forbidden
{
"code" : 403,
"errors" : [ {
"domain" : "youtube.common",
"message" : "Forbidden",
"reason" : "forbidden"
} ],
"message" : "Forbidden"
}
Any one know how to use this method? Thanks
Upvotes: 0
Views: 1165
Reputation: 12877
That method is part of the Content ID API, which is limited to premium partners. More info about partnership: https://www.youtube.com/yt/creators/creator-benefits.html Then you can ask your representative about the API.
Upvotes: 1