Fixing controls on mobile

This commit is contained in:
Zoe Roux 2020-10-13 23:39:09 +02:00
parent 2186280d85
commit 0c857c9db1
2 changed files with 9 additions and 5 deletions

View File

@ -1,6 +1,6 @@
<div id="root" <div id="root"
(mouseenter)="this.showControls = true;" (mouseenter)="!isMobile ? this.showControls = true : null"
(mouseleave)="!this.player.paused ? this.showControls = false : null" (mouseleave)="!this.player.paused && !isMobile ? this.showControls = false : null"
[style.cursor]="this.showControls ? '' : 'none'"> [style.cursor]="this.showControls ? '' : 'none'">
<div class="player data-vjs-player"> <div class="player data-vjs-player">
<video id="player" #player <video id="player" #player

View File

@ -257,7 +257,7 @@ export class PlayerComponent implements OnInit, OnDestroy, AfterViewInit
{ {
if (this.seeking) if (this.seeking)
this.player.currentTime = this.getTimeFromSeekbar(event.pageX); this.player.currentTime = this.getTimeFromSeekbar(event.pageX);
else else if (!AppComponent.isMobile)
this.showControls = true; this.showControls = true;
} }
@ -331,11 +331,15 @@ export class PlayerComponent implements OnInit, OnDestroy, AfterViewInit
} }
videoClicked() videoClicked()
{
if (AppComponent.isMobile)
this.showControls = !this.showControls;
else
{ {
this.showControls = !this.player.paused; this.showControls = !this.player.paused;
if (!AppComponent.isMobile)
this.togglePlayback(); this.togglePlayback();
} }
}
togglePlayback() togglePlayback()
{ {