Commit fec7cde9 authored by Olivia Madrid's avatar Olivia Madrid

(feat): Media modal - prevent reopen modal on video click

1 merge request!467WIP: (feat): Media modal
Pipeline #75020745 failed with stages
in 6 minutes and 31 seconds
......@@ -41,6 +41,7 @@ export class MindsVideoDirectHttpPlayer implements OnInit, OnDestroy, MindsPlaye
@Output() triggerMediaModal: EventEmitter<any> = new EventEmitter();
loading: boolean = false;
isModal: boolean = false;
constructor(
protected cd: ChangeDetectorRef,
......@@ -82,6 +83,7 @@ export class MindsVideoDirectHttpPlayer implements OnInit, OnDestroy, MindsPlaye
player.addEventListener('canplaythrough', this._canPlayThrough);
this.loading = true;
this.isModal = document.body.classList.contains('m-overlay-modal--shown');
}
ngOnDestroy() {
......@@ -176,6 +178,11 @@ export class MindsVideoDirectHttpPlayer implements OnInit, OnDestroy, MindsPlaye
}
requestMediaModal() {
// Don't reopen modal if you're already on it
if ( this.isModal ) {
this.toggle();
}
// Mobile users go to media page instead of modal
if (isMobile()) {
this.router.navigate([`/media/${this.guid}`]);
......
......@@ -45,6 +45,7 @@ export class MindsVideoTorrentPlayer implements OnInit, AfterViewInit, OnDestroy
initialized: boolean = false;
loading: boolean = false;
isModal: boolean = false;
protected torrentId: string;
protected torrentReady: boolean = false;
......@@ -137,6 +138,7 @@ export class MindsVideoTorrentPlayer implements OnInit, AfterViewInit, OnDestroy
player.addEventListener('canplaythrough', this._canPlayThrough);
this.infoTimer$ = setInterval(this._refreshInfo, 1000);
this.isModal = document.body.classList.contains('m-overlay-modal--shown');
}
ngAfterViewInit() {
......@@ -359,6 +361,11 @@ export class MindsVideoTorrentPlayer implements OnInit, AfterViewInit, OnDestroy
}
}
requestMediaModal() {
// Don't reopen modal if you're already on it
if ( this.isModal ) {
this.toggle();
}
// Mobile users go to media page instead of modal
if (isMobile()) {
this.router.navigate([`/media/${this.guid}`]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment