mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-21 05:45:50 +00:00
edit actions and video stop
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { Directive, ElementRef, Input } from '@angular/core';
|
||||
|
||||
import { StopvideoService } from "src/app/services/stopvideo.service";
|
||||
@Directive({
|
||||
selector: '[appVisibility]'
|
||||
})
|
||||
@@ -8,7 +8,10 @@ export class VisibilityDirective {
|
||||
intersectionObserver: IntersectionObserver;
|
||||
@Input() appVisibility: (arg: any) => void;
|
||||
|
||||
constructor(private elementRef: ElementRef) {
|
||||
constructor(
|
||||
private elementRef: ElementRef,
|
||||
private stopvideoService: StopvideoService
|
||||
) {
|
||||
const options = {
|
||||
root: null,
|
||||
rootMargin: '0px',
|
||||
@@ -16,12 +19,13 @@ export class VisibilityDirective {
|
||||
};
|
||||
|
||||
|
||||
console.log(this.elementRef.nativeElement.parentElement, "=1=")
|
||||
// this.stopvideoService.registerVideo()
|
||||
|
||||
this.intersectionObserver = new IntersectionObserver(entries => {
|
||||
entries.forEach(entry => {
|
||||
if (entry.isIntersecting) {
|
||||
this.appVisibility(true);
|
||||
this.stopvideoService.registerVideo(this.elementRef.nativeElement);
|
||||
} else {
|
||||
this.elementRef.nativeElement.pause()
|
||||
// Pause video when not visible
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Directive, ElementRef, Input } from '@angular/core';
|
||||
import { StopvideoService } from '../stopvideo.service';
|
||||
|
||||
@Directive({
|
||||
selector: '[appVisibility]'
|
||||
@@ -8,7 +9,10 @@ export class VisibilityDirective {
|
||||
intersectionObserver: IntersectionObserver;
|
||||
@Input() appVisibility: (arg: any) => void;
|
||||
|
||||
constructor(private elementRef: ElementRef) {
|
||||
constructor(
|
||||
private elementRef: ElementRef,
|
||||
private stopvideoService: StopvideoService
|
||||
) {
|
||||
const options = {
|
||||
root: null,
|
||||
rootMargin: '0px',
|
||||
@@ -16,12 +20,11 @@ export class VisibilityDirective {
|
||||
};
|
||||
|
||||
|
||||
console.log(this.elementRef.nativeElement.parentElement, "=1=")
|
||||
|
||||
this.intersectionObserver = new IntersectionObserver(entries => {
|
||||
entries.forEach(entry => {
|
||||
if (entry.isIntersecting) {
|
||||
this.appVisibility(true);
|
||||
this.stopvideoService.registerVideo(this.elementRef.nativeElement)
|
||||
} else {
|
||||
this.elementRef.nativeElement.pause()
|
||||
// Pause video when not visible
|
||||
|
||||
Reference in New Issue
Block a user