Skip to content

Commit c6e1f70

Browse files
authored
Merge pull request #743 from TechnologyEnhancedLearning/Develop/Fixes/LH-TD-4997-Video-Contents-in-eLearning-resources-not-getting-played-on-iOS-device
TD-4997: Video Contents in eLearning resources not getting played on …
2 parents 87e5700 + fa1936f commit c6e1f70

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

LearningHub.Nhs.WebUI/Controllers/LearningSessionsController.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ public async Task<IActionResult> ScormContent(string filePath)
8787

8888
var directory = filePath.Substring(0, filePath.LastIndexOf("/"));
8989
fileName = filePath.Substring(filePath.LastIndexOf("/") + 1, filePath.Length - filePath.LastIndexOf("/") - 1);
90+
string extension = Path.GetExtension(fileName);
9091

9192
var file = await this.fileService.DownloadFileAsync(directory, fileName);
9293

@@ -95,6 +96,11 @@ public async Task<IActionResult> ScormContent(string filePath)
9596
contentType = "application/octet-stream";
9697
}
9798

99+
if (extension == ".mp4")
100+
{
101+
contentType = "application/x-mpegURL";
102+
}
103+
98104
result = this.File(file.Content, contentType);
99105
bytesServed = file.ContentLength;
100106
}

LearningHub.Nhs.WebUI/Scripts/vuesrc/resource/ResourceContent.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,6 @@
362362
// ]
363363
// }
364364
//};
365-
366365
this.player.load(sourceConfig)
367366
.then(() => {
368367
console.log("Source loaded successfully!");
@@ -723,7 +722,14 @@
723722
async launchScorm() {
724723
var targetWin;
725724
var targetWinName = "lhContent" + this.resourceItem.resourceId;
725+
// Use a placeholder window to avoid popup blockers
726+
targetWin = window.open("about:blank", targetWinName, "location=0,menubar=0,resizable=0,width=" + this.resourceItem.scormDetails.popupWidth + ",height=" + this.resourceItem.scormDetails.popupHeight);
726727
728+
// If the pop-up was blocked
729+
if (!targetWin) {
730+
alert("Please allow pop-ups to view this content.");
731+
return;
732+
}
727733
var activeContent = await userData.getActiveContent();
728734
729735
if (activeContent.filter(ac => ac.resourceId === this.resourceItem.resourceId).length > 0) {

0 commit comments

Comments
 (0)