0

I am trying to retrieve metadata of a video file present in my google drive. I can access all the information related to that file (like size, mimetype, etc.). But, when I am trying to retrieve metadata of that video file I am getting a null value. Could you please tell me how can I retrieve metadata of a video file. Thanks in advance.

VideoMediaMetadata video_Media_MetaData=file.getVideoMediaMetadata();
Heen Shaik
  • 1
  • 1
  • 1

1 Answers1

0

AFAIK, a successful HTTP request using Files: list will return a response body which includes videoMediaMetadata in the following structure:

{
  "kind": "drive#fileList",
  "nextPageToken": string,
  "incompleteSearch": boolean,
  "files": [
    "videoMediaMetadata": {
       "width": integer,
       "height": integer,
       "durationMillis": long
    },
    "isAppAuthorized": boolean
  ]
}

However, please note that, as described in Files documentation, videoMediaMetadata is

Additional metadata about video media. This may not be available immediately upon upload.

Thus, it will return null for none as mentioned here.

With this, you may want to try Files: update to update a file's metadata and/or content with patch semantics.

Teyam
  • 7,686
  • 3
  • 15
  • 22
  • Thank you so much for replying. I figured it out. I need to set the field videoMediaMetadata before executing the list(), then the response body would include the metadata of the video file. If possible could you please look into this problem: https://stackoverflow.com/questions/45801256/how-to-partially-download-google-drive-files – Heen Shaik Aug 27 '17 at 17:44
  • @HeenShaik Could you please give more details about "set the field videoMediaMetadata before executing the list()"? Do you do that with update() or something like this? – mshcruz Aug 19 '21 at 03:18