yuhui / launchext-youtube-playback

Extension for Adobe Experience Platform Data Collection Tags (Adobe Launch) to track YouTube video playback
GNU General Public License v3.0
2 stars 2 forks source link

player.getCurrentTime is undefined when video iframe src attribute is dynamically loaded #25

Closed jbeach closed 2 years ago

jbeach commented 2 years ago

Hi,

Great Launch extension (swoon)!

I have an issue though in that many of our site's YouTube videos have dynamically loaded iframe src attribute and the video plays tracking is failing due to this YouTube constructor issue mentioned here: https://stackoverflow.com/a/47415537

I was wondering if you could update the extension to fail more gracefully in this case? e.g. as suggested in the Stack Overflow, set it to 0 or something when player.getCurrentTime() is undefined?

Thanks in advance, Julia

jbeach commented 2 years ago

Either set it to 0 or even better make the tracking wait until it is defined.

jbeach commented 2 years ago

I want to redact this request. I was able to make it work by registering the API ("Enabling YouTube playback tracking") on the iframe.onload event when the iframe.src value is loaded dynamically.

Thanks for this wonderful video tracking plugin.

yuhui commented 2 years ago

Great to hear that it works for you! (And so sorry for the super-late reply.)