1

使用api上传的视频文件,文件名是上传日期,参数根据文档设置。这是代码和结果:</p>

 String url = "https://photoslibrary.googleapis.com/v1/uploads";
         HttpPost post = new HttpPost(url);
         String accessToken="xxxxxxxxx";
         String fileName = "testVideo.mp4";
         File localFile = new File("xxxxxxxxx");
         post.addHeader("Content-Type","application/octet-stream");
         post.addHeader("Authorization", "Bearer "+accessToken);
         post.addHeader("X-Goog-Upload-File-Name",fileName);
         post.addHeader("X-Goog-Upload-Protocol", "raw");
         InputStream in = new FileInputStream(localFile);
         InputStreamEntity streamEntity = new InputStreamEntity(in);
         post.setEntity(streamEntity);
         excute(post);
        {"id":"ADKWk0uTzr_2wTrcWQpJzx4jZtBOMZlv3ujqkuFIOODpdT4TUpZWRqk20ZZEzbmKLBrW4IYb7db7YAHY4Sok1BQZs8sOQM9-Ow","productUrl":"https://photos.google.com/lr/album/ADKWk0u9Ksoym4niRU9oj1W-","mimeType":"video/mp4","mediaMetadata":{"creationTime":"2017-07-13T10:51:08Z","width":"960","height":"544","video":{"fps":29.9,"status":"READY"}},"filename":"2018-10-09"}
4

1 回答 1

0

API 目前存在一个问题,即未正确设置视频上传的文件名。您可以在问题跟踪器上关注此问题:https ://issuetracker.google.com/114462217

(您可以为问题“加注星标”以收到任何更新的通知。)

于 2018-10-15T23:44:03.513 回答