I am fetching a video using official Youtube data API, and through that I am getting the response in the following format,
contentDetails: { definition: "hd", dimension: "2d", duration: "PT9M36S", licensedContent: true, projection: "rectangular",}
This duration is incorrect since the video itself is one second short, i.e. of 9 minute 35 second.This happened in each of the 6 video that I uploaded. And while viewing the embedded video, the duration fluctuate by 1 second back and forth. This prevents us from tracking user progress of the given video. Though we have solved it using some workaround, but the issue still exists and unaddressed, so dropping the question here.
If anyone can tell me why this might happens and if the issue as direct as it seems why it isn't being corrected, since this seems, prima facie, to be very minor issue on the backend, which can be easily fix.Also, the only official place to report any issue with API seems to be stackoverflow as stated by them, but some similar question on stackoverflow itself doesn't have official addressal or response from google's team. Hope it can be resolved through this post.
Steps to recreate the issue:
- Get a Youtube api key
- Fetch video content details from youtube api using the below command"https://www.googleapis.com/youtube/v3/videos?id=${youtubeVideoId}&key=${youtubeApiKey}&part=snippet,contentDetails"
You will notice that it is one second greater than the actual video length.