1

我想上传视频到YouTube,但不知何故它不在Xamarin.Forms (Portable)项目工作。有没有办法通过Xamarin.Forms (Portable)如何上传视频到YouTube [Xamarin.Forms(便携式)]

var initializer = new GoogleAuthorizationCodeFlow.Initializer 
{ 
    ClientSecrets = new ClientSecrets 
    { 
     ClientId = Constants.API.Google.ClientID, 
     ClientSecret = Constants.API.Google.ClientSecret 
    }, 
    Scopes = new[] { YouTubeService.Scope.Youtube } 
}; 
var flow = new AuthorizationCodeFlow(initializer); 
TokenResponse token = flow.LoadTokenAsync("user", CancellationToken.None).Result; 

但每次我在TokenResponse token越来越空,上传0​​的影片,我不知道我应该在的地方user传递flow.LoadTokenAsync("user", CancellationToken.None)

谢谢。

+0

我建议你在客户端库上发布这个问题。 https://github.com/google/google-api-dotnet-client/issues – DaImTo

回答

1

因为我担心Google .Net客户端库目前不支持Xamarin。请参阅问题:Unable to Google.Apis.Auth.PlatformServices in Xamarin.Forms

这是因为GoogleWebAuthorizationBroker需要从Google.Apis.Auth.PlatformServices几类,Google.Apis.Auth.PlatformServices不与Xamarin兼容。

+0

那么,有没有其他方法可以做到这一点? –

+0

未使用官方客户端库。你将不得不自己编码。由于YouTube API不支持服务帐户,因此Chris的建议不起作用。 – DaImTo

+0

所以,你的意思是说,我必须使用HttpClient,对吧? –