Merge branch 'feature/shared-content' of https://bitbucket.org/equilibriumito/gabinete-digital-fo into feature/shared-content

This commit is contained in:
Eudes Inácio
2023-12-13 18:21:56 +01:00
8 changed files with 71 additions and 19 deletions
@@ -25,7 +25,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
+12
View File
@@ -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];