Я ищу способ проверить, не является ли мой iframe узким местом (и если да, переключитесь на другой источник)
Есть ли способ добиться этого с помощью API производительности?
В настоящее время у меня есть это на моем (Angular) Frontend:
<app-player>
<div id = "my-iframe" class = "flex flex-col flex-auto w-full xs:p-2">
<iframe src = "source1.com" title = "MyIframe" allowfullscreen = "" scrolling = "no" frameborder = "0" allow = "autoplay; fullscreen" sandbox = "allow-modals allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox" width = "100%" height = "100%"></iframe>
</div>
</app-player>
ngAfterViewInit(): void{
const iframe = this.twitchPlayerContainer.nativeElement.querySelector('[title = "MyIframe"]');
console.info(iframe); // --> Gets the Element
setInterval(function(){
const resources = performance.getEntries();
console.info(resources); // WORKS
const resourcesIframe = iframe.performance.getEntries();
console.info(resourcesIframe); // TypeError: Cannot read property 'getEntries' of undefined
}, 3000);
}
Есть ли способ получить ресурсы iframe?



![Безумие обратных вызовов в javascript [JS]](https://i.imgur.com/WsjO6zJb.png)


В вашем случае Iframe.children [0] .src должен предоставить вам src Iframe. Я считаю, что из-за того, что вы ссылаетесь на родительский div вместо фактического iframe, вы получаете неожиданные результаты.