Youtube embed won't go fullscreen (android only)

Hey Dominik

I kinda “solved” it, but it’s all but an elegant solution.

I manually unlocked screen rotation for the video page on Android only, and locked it again when navigating to another page or when touching the native back button.

The second issue, that Android keeps playing in background is solved. When navigating to another page or touching the native back button, I execute this code:

stopVideo() {
        this.videoIframe.nativeElement.setAttribute("src", this.videoIframe.nativeElement.getAttribute("src"));
}

Make sure to add #videoIframe to the iframe element in your HTML template.

<iframe #videoIframe [src]="videoURL" frameborder="0" allowfullscreen></iframe>
```
1 Like