commit
						888d518e86
					
				@ -423,6 +423,11 @@ export class CoreExternalContentDirective implements AfterViewInit, OnChanges, O
 | 
				
			|||||||
                return;
 | 
					                return;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if (this.isPlayedMedia()) {
 | 
				
			||||||
 | 
					                // Don't update the URL if it's a media that already started playing, otherwise the media will be reloaded.
 | 
				
			||||||
 | 
					                return;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            const newState = await CoreFilepool.getFileStateByUrl(site.getId(), url);
 | 
					            const newState = await CoreFilepool.getFileStateByUrl(site.getId(), url);
 | 
				
			||||||
            if (newState === state) {
 | 
					            if (newState === state) {
 | 
				
			||||||
                return;
 | 
					                return;
 | 
				
			||||||
@ -461,6 +466,29 @@ export class CoreExternalContentDirective implements AfterViewInit, OnChanges, O
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Check if the source affects a media element that is already playing and not ended.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @returns Whether it's a played media element.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    protected isPlayedMedia(): boolean {
 | 
				
			||||||
 | 
					        let mediaElement: HTMLVideoElement | HTMLAudioElement | null = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (this.element.tagName === 'VIDEO') {
 | 
				
			||||||
 | 
					            mediaElement = this.element as HTMLVideoElement;
 | 
				
			||||||
 | 
					        } else if (this.element.tagName === 'AUDIO') {
 | 
				
			||||||
 | 
					            mediaElement = this.element as HTMLAudioElement;
 | 
				
			||||||
 | 
					        } else if (this.element.tagName === 'SOURCE' || this.element.tagName === 'TRACK') {
 | 
				
			||||||
 | 
					            mediaElement = this.element.closest<HTMLVideoElement | HTMLAudioElement>('video,audio');
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (!mediaElement) {
 | 
				
			||||||
 | 
					            return false;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return !mediaElement.paused || (mediaElement.currentTime > 0.1 && !mediaElement.ended);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Wait for the image to be loaded or error, and emit an event when it happens.
 | 
					     * Wait for the image to be loaded or error, and emit an event when it happens.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
 | 
				
			|||||||
@ -123,7 +123,7 @@ export class CoreCourseModuleSummaryComponent implements OnInit, OnDestroy {
 | 
				
			|||||||
            this.packageStatusObserver = CoreEvents.on(
 | 
					            this.packageStatusObserver = CoreEvents.on(
 | 
				
			||||||
                CoreEvents.PACKAGE_STATUS_CHANGED,
 | 
					                CoreEvents.PACKAGE_STATUS_CHANGED,
 | 
				
			||||||
                (data) => {
 | 
					                (data) => {
 | 
				
			||||||
                    if (data.componentId == module.id && data.component == this.component) {
 | 
					                    if (data.componentId === this.module?.id && data.component == this.component) {
 | 
				
			||||||
                        this.getPackageStatus();
 | 
					                        this.getPackageStatus();
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                },
 | 
					                },
 | 
				
			||||||
 | 
				
			|||||||
@ -1967,6 +1967,7 @@ export class CoreCourseHelperProvider {
 | 
				
			|||||||
        completion.state = completion.state === CoreCourseModuleCompletionStatus.COMPLETION_COMPLETE
 | 
					        completion.state = completion.state === CoreCourseModuleCompletionStatus.COMPLETION_COMPLETE
 | 
				
			||||||
            ? CoreCourseModuleCompletionStatus.COMPLETION_INCOMPLETE
 | 
					            ? CoreCourseModuleCompletionStatus.COMPLETION_INCOMPLETE
 | 
				
			||||||
            : CoreCourseModuleCompletionStatus.COMPLETION_COMPLETE;
 | 
					            : CoreCourseModuleCompletionStatus.COMPLETION_COMPLETE;
 | 
				
			||||||
 | 
					        completion.isoverallcomplete = completion.state === CoreCourseModuleCompletionStatus.COMPLETION_COMPLETE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            const response = await CoreCourse.markCompletedManually(
 | 
					            const response = await CoreCourse.markCompletedManually(
 | 
				
			||||||
@ -1985,6 +1986,7 @@ export class CoreCourseHelperProvider {
 | 
				
			|||||||
            completion.state = completion.state === CoreCourseModuleCompletionStatus.COMPLETION_COMPLETE
 | 
					            completion.state = completion.state === CoreCourseModuleCompletionStatus.COMPLETION_COMPLETE
 | 
				
			||||||
                ? CoreCourseModuleCompletionStatus.COMPLETION_INCOMPLETE
 | 
					                ? CoreCourseModuleCompletionStatus.COMPLETION_INCOMPLETE
 | 
				
			||||||
                : CoreCourseModuleCompletionStatus.COMPLETION_COMPLETE;
 | 
					                : CoreCourseModuleCompletionStatus.COMPLETION_COMPLETE;
 | 
				
			||||||
 | 
					            completion.isoverallcomplete = !completion.isoverallcomplete;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            CoreDomUtils.showErrorModalDefault(error, 'core.errorchangecompletion', true);
 | 
					            CoreDomUtils.showErrorModalDefault(error, 'core.errorchangecompletion', true);
 | 
				
			||||||
        } finally {
 | 
					        } finally {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user