Rida Am
Rida Am

Reputation: 379

Ionic 3 full screen video background on iOS

I am trying to get a full screen background video on my entry component.

Expected: Entry component Screenshot on ionic-lab

It runs fine on android. But not on iOS.

Video background on iOS (iOS emulator): Entry component Screenshot on iOS

Here is some code that i am using to get it like i expect:

CSS:

...

video {
    position: fixed;
    top: 50%;
    left: 50%;
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    z-index: -100;
    transform: translateX(-50%) translateY(-50%);
}

...

HTML:

<ion-header no-border>
     <img src="assets/imgs/logo.png" />
</ion-header>

<ion-content no-scroll>
  <video autoplay muted loop webkit-playsinline playsinline src="video.mp4"></video>
  <ion-slides autoplay="4000" pager loop centeredSlides>
    <ion-slide *ngFor="let slide of slides">
      <h4>{{slide.title}}</h4>
      <p>{{slide.text}}</p>
    </ion-slide>
  </ion-slides>
</ion-content>

<ion-footer no-border>
  <ion-grid>
    <ion-row>
      <ion-col col-12>
        <button mat-raised-button class="btn-booking" color="accent" (click)="push()">
          Zum Buchvorgang
          <mat-icon class="btn-booking-icon">keyboard_arrow_right</mat-icon>
        </button>
      </ion-col>
    </ion-row>
  </ion-grid>
</ion-footer>

Upvotes: 2

Views: 1693

Answers (1)

Rida Am
Rida Am

Reputation: 379

I added fullscreen to <ion-content>. That resolved my problem.

<ion-content fullscreen no-scroll>
  <video autoplay muted loop webkit-playsinline playsinline src="video.mp4"></video>
  <ion-slides autoplay="4000" pager loop centeredSlides>
    <ion-slide *ngFor="let slide of slides">
      <h4>{{slide.title}}</h4>
      <p>{{slide.text}}</p>
    </ion-slide>
  </ion-slides>
</ion-content>

Upvotes: 1

Related Questions