diff --git a/src/plugins/htmlVideoPlayer/plugin.js b/src/plugins/htmlVideoPlayer/plugin.js
index 7a2e5ff98d..df582ca1c7 100644
--- a/src/plugins/htmlVideoPlayer/plugin.js
+++ b/src/plugins/htmlVideoPlayer/plugin.js
@@ -1,3 +1,5 @@
+import DOMPurify from 'dompurify';
+
import browser from '../../scripts/browser';
import { Events } from 'jellyfin-apiclient';
import { appHost } from '../../components/apphost';
@@ -1317,7 +1319,8 @@ function tryRemoveElement(elem) {
}
if (selectedTrackEvent && selectedTrackEvent.Text) {
- subtitleTextElement.innerHTML = normalizeTrackEventText(selectedTrackEvent.Text, true);
+ subtitleTextElement.innerHTML = DOMPurify.sanitize(
+ normalizeTrackEventText(selectedTrackEvent.Text, true));
subtitleTextElement.classList.remove('hide');
} else {
subtitleTextElement.classList.add('hide');