简体   繁体   中英

Issue with MatDialog and Iframe

I have some issues working with Angular material MatDialog and an Iframe which is Libcast. When I am changing the size of the window or set the video as fullscreen, there are different issues I met. On Chrome: the video starts over and I can see that's the window is refresh. On Modzilla: the video crash when I turn on full screen and it goes back to the no-fullscreenpage.

I have tried to add directly the Iframe in the MatDialog with the developper tool and I don't meet any issues, it's working perfectly.

  private openLibcastResource(resource: Resource) { this.dialog.open(VideoComponent, { data: {url: resource.sourceInfo.src}, }); } 

 @Component({ selector: 'app-video', templateUrl: './video.component.html', }) export class VideoComponent implements OnInit { constructor(@Inject(MAT_DIALOG_DATA) public data: any, public dialogRef: MatDialogRef<VideoComponent>, private sanitizer: DomSanitizer) { } ngOnInit() { } public videoUrl() { return this.sanitizer.bypassSecurityTrustResourceUrl(this.data.url); } } 

  <iframe [src]="videoUrl()" class="libcast_player" width="560" height="450" frameborder="0" scrolling="no" allowfullscreen="allowfullscreen" style="opacity: 1; visibility: visible;"></iframe> 

Do you have any ideas of what's happening ?

The getUrl() was called each time I was modifing the window size. So the Video was reset and that's why it was crashing for fullscreen also.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM