In order to load a youtube movie in an iframe, I have the following in my template:
<iframe [src]="getYouTubeUrl(currentItem.id)" frameborder="0" allowfullscreen></iframe>
In the component I have defined:
getYouTubeUrl(id:string):SafeResourceUrl {
let url:string = `https://www.youtube.com/embed/${id}`;
return this.sanitizer.bypassSecurityTrustResourceUrl(url);
}
Somehow, this function is called infinitely (while the resulting url doesn't change). The result is that the video cannot be loaded. What could be wrong here?