For the application I'm developing, I need to know the duration of certain YouTube-videos. I'm using the .NET libs for the YouTube API V3.
Requesting the durationMs properties of the FileDetails works for some video's, but returns 'null' for other videos (all fully processed). The video's are all unlisted and are supposed to stay the way, so I'd rather not disclose the ID of the video that's causing issues.
What could be the cause this issue? I'm not getting any errors from the API, and I do get the container (MOV), but properties like the duration are all null.
I have include the the relevant code snippet.
var videosListRequest = youtube.Videos.List("processingDetails,FileDetails");
videosListRequest.Id = file.FileName;
videosListRequest.OauthToken = Authresult.Result.Credential.Token.AccessToken;
VideoListResponse vlr = videosListRequest.Execute();
if (vlr.Items.Count > 0 && vlr.Items[0].ProcessingDetails.ProcessingStatus == "succeeded")
{
file.IsVideoProcessed = true;
int durationInS = (int)(vlr.Items[0].FileDetails.DurationMs / 1000.0);
UpdateVideoStatus(file.Id, ClientId.Value, MediaStatus.READY, durationInS);
}