Reputation: 301
I have this template on my angular v6.1 application:
But de video on the p tag comes undefined, but in the loadeddata function have the correct value. I have a ngFor loop to read images and videos, for the videos I need the duration, width and heigh for each one of them.
I can't see where I'm doing wrong.
Upvotes: 0
Views: 1471
Reputation: 478
Looks like we have asynchronous code here. Tag p
get its data synchronously, but at the very beginning it is undefined
. Then, when media has finished loading, video gets the data. That's why
the loadeddata function have the correct value
Here is the solution. The only drawback is that url of your video google chrome marks as suspicious, that's why metadata of the video can't be preloaded before you open the video in new tab.
Upvotes: 1