1

I'm working on an EyeTracking Windows Forms application that opens a YouTube video on the screen, and starts tracking eye movements while the video is playing. I need to know the video's duration in order to en the EyeTracking Stream.

1) Should I find a method to get the video's duration (like, let's say we have a method for it, YoutubeVideo.GetDuration()), if so, how?

2) Or should I find a way to let my program know that the video has ended, and end my EyeTracking Stream when YouTube video has ended, if so, how?

2 Answers2

0

Someone already asked the same question:

How to get video duration using YouTube API?

Though if you are lazy and don't care too much to work with youtube API, you could (not recommend it myself) download the video and get from the file settings his duration.

Community
  • 1
  • 1
ShlomiRex
  • 321
  • 1
  • 2
  • 10
  • thanks, I want to add both youtube video stream, video from the drive stream, and a picture stream, so it's all necessary. I looked for Youtube API too, but I guess it requires my credit card, and I'm just doing my summer practice, I don't think I can afford that. – Burak Kaan Bilgehan Jul 29 '16 at 13:42
0

As you are looking for the .net libary, consult https://developers.google.com/youtube/v3/docs/videos

specifically, the function you are after is contentDetails.duration

This page will give you some examples on the .net version of the API in use

Takarii
  • 1,612
  • 2
  • 18
  • 29
  • Thanks let my check how it works, I just installed Youtube API (1-2 hours ago), so I don't know what to do for now – Burak Kaan Bilgehan Jul 29 '16 at 13:48
  • Just keep looking at the guidance provided by their examples and play around with the features. You will pick it up eventually – Takarii Jul 29 '16 at 13:57