1

is there a way to track user's activity on a video embedded using iFrame tag? the metadata am most interested in is current Duration, title, src... ps: YouTube Player API did not work for me :(

Fath
  • 84
  • 7

1 Answers1

2

if it's for youtube as the tag suggest I'd consider using youtube iFrame API as suggested in this post you could use player.playerInfo.currentTime using that API.

now if it's just a <video> in html, you can use the currentTime property you could also find the video element in your youtube iFrame and use that same property, it's gonna work. Basically as long as there is a video html element, you'll have access to this property

JGauthier
  • 261
  • 3
  • 6
  • 1
    thank you for your help. my web app uses different videos from platforms mostly youtube. but I really want a way that works for different videos!! – Fath Nov 18 '21 at 20:21
  • you're welcome. if that answers you question feel free to select it as the answer :)) – JGauthier Nov 18 '21 at 20:24
  • I added an edit to the answer, could solve the issue of multiple players – JGauthier Nov 18 '21 at 20:32