From a1864316cb27a9edeb8f449faab53e866f6d0fb1 Mon Sep 17 00:00:00 2001
From: srosse <stephane.rosse@frentix.com>
Date: Wed, 26 Feb 2020 16:29:35 +0100
Subject: [PATCH] OO-4543: mute, pause and only after remove the video

---
 .../org/olat/modules/video/ui/_content/video_run.html     | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/olat/modules/video/ui/_content/video_run.html b/src/main/java/org/olat/modules/video/ui/_content/video_run.html
index 3b00fdb4bcc..78c2abb6dbc 100644
--- a/src/main/java/org/olat/modules/video/ui/_content/video_run.html
+++ b/src/main/java/org/olat/modules/video/ui/_content/video_run.html
@@ -97,7 +97,13 @@
 		        		## // try a second time to prevent destroying after a reload
 		        		setTimeout(function() {
 		        			if(jQuery('#$r.getId("o_vid")').length == 0) {
-		        				player.remove();
+		        				try {
+		        					player.setMuted(true);
+		        					player.pause();
+		        					player.remove();
+		        				} catch(e) {
+		        					if(window.console) console.log(e);
+		        				}
 		        			}
 		        		}, 500);
 		        	}
-- 
GitLab