Getting a 403 error with Google Drive API v3, the request is not updated in Google API Metrics

Viewed 261

I am using Google Drive API to load videos in HTML5 video player.

<video id='drive-video' width='100%' height='100%' preload='metadata' playsinline>
  <source src='https://www.googleapis.com/drive/v3/files/<videoId>?alt=media&key=<api_key>' type='video/mp4'>
</video>

This works fine. However, when I am watching the video and doing different operations like going forward/backward etc., the video goes blank and I am unable to watch the video for about 15min. After that the video again plays and the same problem continues.

I tried to refresh the page and noticed that the GET request for the video using API is throwing a 403 error. I have checked the Google Chrome Network tab and did not see any response for this request.

Console Error
Google API Quota
Google API Response Headers from Chrome Network Tab
Google API Response from Chrome Network Tab

Also, one weird thing is, when I get the 403 errors, I am not able to see any traffic in my Google Drive Metrics for this API key. It is as if the request is not being sent to Google.

Any help is appreciated.

1 Answers

As @DaImTo points out Google drive is a file directory access API. You should host the videos on YouTube for optimal playback.

Related