1

Video file uploaded using api, its file name is an upload date,Parameters set according to the document.This is the code and result:

 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"}

1 Answers1

0

There is currently an issue with the API where the filename is not set correctly for video uploads. You can follow along on this issue on the issue tracker: https://issuetracker.google.com/114462217

(You can 'star' the issue to be notified of any updates.)