diff --git a/LearningHub.Nhs.WebUI/Controllers/LearningSessionsController.cs b/LearningHub.Nhs.WebUI/Controllers/LearningSessionsController.cs index 755c14d62..f6d6efbd8 100644 --- a/LearningHub.Nhs.WebUI/Controllers/LearningSessionsController.cs +++ b/LearningHub.Nhs.WebUI/Controllers/LearningSessionsController.cs @@ -87,6 +87,7 @@ public async Task ScormContent(string filePath) var directory = filePath.Substring(0, filePath.LastIndexOf("/")); fileName = filePath.Substring(filePath.LastIndexOf("/") + 1, filePath.Length - filePath.LastIndexOf("/") - 1); + string extension = Path.GetExtension(fileName); var file = await this.fileService.DownloadFileAsync(directory, fileName); @@ -95,6 +96,11 @@ public async Task ScormContent(string filePath) contentType = "application/octet-stream"; } + if (extension == ".mp4") + { + contentType = "application/x-mpegURL"; + } + result = this.File(file.Content, contentType); bytesServed = file.ContentLength; } diff --git a/LearningHub.Nhs.WebUI/Scripts/vuesrc/resource/ResourceContent.vue b/LearningHub.Nhs.WebUI/Scripts/vuesrc/resource/ResourceContent.vue index 8719af041..d2b4de725 100644 --- a/LearningHub.Nhs.WebUI/Scripts/vuesrc/resource/ResourceContent.vue +++ b/LearningHub.Nhs.WebUI/Scripts/vuesrc/resource/ResourceContent.vue @@ -362,7 +362,6 @@ // ] // } //}; - this.player.load(sourceConfig) .then(() => { console.log("Source loaded successfully!"); @@ -723,7 +722,14 @@ async launchScorm() { var targetWin; var targetWinName = "lhContent" + this.resourceItem.resourceId; + // Use a placeholder window to avoid popup blockers + targetWin = window.open("about:blank", targetWinName, "location=0,menubar=0,resizable=0,width=" + this.resourceItem.scormDetails.popupWidth + ",height=" + this.resourceItem.scormDetails.popupHeight); + // If the pop-up was blocked + if (!targetWin) { + alert("Please allow pop-ups to view this content."); + return; + } var activeContent = await userData.getActiveContent(); if (activeContent.filter(ac => ac.resourceId === this.resourceItem.resourceId).length > 0) {