Please only file reports about bugs in AMP here.
The number of ads is showing as undefined inside the data-ad-label template.
You could reproduce the issue, which is rendered as Ad (undefined of undefined), in the AMP playground when the ad is playing.
https://playground.amp.dev/?url=https%3A%2F%2Fpreview.amp.dev%2Fdocumentation%2Fexamples%2Fcomponents%2Famp-ima-video&format=websites&_gl=11prbdkk_ga*YW1wLU43VkhYRWh3S1VEWVRWREdSaUNhalE.
All major browsers.
amp-ima-video-0.1.js
Thanks!
Thanks @ethan-chong!
The issue is inside an external library, https://imasdk.googleapis.com/js/sdkloader/ima3.js, which is not part of the amphtml repo. I'll forward this to an appropriate person at Google to look at.
These get mangled on compilation (see .l, .h):
Nx.prototype.adPosition = Nx.prototype.h;
Nx.prototype.currentTime = Nx.prototype.currentTime;
Nx.prototype.duration = Nx.prototype.duration;
Nx.prototype.totalAds = Nx.prototype.l;
AMP references them here, (handles IMA's event google.ima.AdEvent.Type.AD_PROGRESS):
I can see these props are mangled when read:

ahhh, that makes sense, @alanorozco thanks for the thorough explanation mate!
@ethan-chong Happy to help!
Found out that we can work around this on AMP's side so expect a fix soon (#30249)
@alanorozco legend :) thanks