mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
fix
This commit is contained in:
@@ -24,7 +24,7 @@ export class VisibilityDirective {
|
||||
entries.forEach(entry => {
|
||||
if (entry.isIntersecting) {
|
||||
this.appVisibility(true);
|
||||
// this.stopvideoService.registerVideo(this.elementRef.nativeElement)
|
||||
this.stopvideoService.registerVideo(this.elementRef.nativeElement)
|
||||
} else {
|
||||
this.elementRef.nativeElement.pause()
|
||||
// Pause video when not visible
|
||||
|
||||
@@ -15,6 +15,13 @@ export class StopvideoService {
|
||||
this.router.events.forEach((event) => {
|
||||
if (event instanceof NavigationEnd && !event.url.includes('/home/publications')) {
|
||||
this.stopAndRemoveAllVideos();
|
||||
// Get all video elements in the document
|
||||
var videoElements = document.querySelectorAll('video');
|
||||
|
||||
// Pause each video element
|
||||
videoElements.forEach(function(video) {
|
||||
video.pause();
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
@@ -25,6 +32,11 @@ export class StopvideoService {
|
||||
this.video.push(tagVideo);
|
||||
}
|
||||
|
||||
registerVideoWithEvent(event: any) {
|
||||
const videoElement: HTMLVideoElement = event.target as HTMLVideoElement;
|
||||
this.video.push(videoElement);
|
||||
}
|
||||
|
||||
stopAndRemoveAllVideos() {
|
||||
for (let i = 0; i < this.video.length; i++) {
|
||||
const video = this.video[i];
|
||||
|
||||
Reference in New Issue
Block a user