Non youtube video duration display

74 views
Skip to first unread message

deirdre...@gmail.com

unread,
Aug 24, 2017, 7:39:39 PM8/24/17
to Google Web Designer beta
Hi, just wondering if anyone has any pointers on having a timer displaying duration or elapsed time for a video, I'm currently using a countdown timer component as a stopgap but would prefer if I could have something that is reading the video duration rather than me typing it in.


Any help would be greatly appreciated :)


San Khong

unread,
Aug 28, 2017, 1:20:05 PM8/28/17
to Google Web Designer beta
You can try using the getDuration() and getCurrentTime() methods on the youtube player object.

On an event, use this custom action:
var ytp = document.getElementById('gwd-youtube_1');
console.log(ytp.a.getDuration());
console.log(ytp.a.getCurrentTime());

where ytp.a is the minified YouTube player object and the youtube component id is gwd-youtube_1

Hope it helps.
San
Google Web Designer team
Reply all
Reply to author
Forward
0 new messages