问题
I am trying to play some SCORM course using SAP Authoring Tool. When I try to play a course none of audio elements are played.
I have checked chrome console and there is 404 error for those mp3 files. They exists but player can not find them.
I have try to play mp3 files directly opening some of the url directly in the browser and download dialog appears. Seems that server which is used for SAP content player does not support mp3? This is example of mp3 url:
http://127.0.0.1:59128/lms/media/(1.XXX.0.12373953.)/my_test_course/statoil_sap_test_-2624/runtime_media/sound/kalimba.mp3
Is there a way to configure SAP cpontent player to allow mp3 playing?
When I try to open URL
http://127.0.0.1:49910/lms/media/(1.XXX.0.5732618.)/my_course/my_course/runtime_media/sound/eng/count_1.mp3
directly I receive 404 error.
The same error occured when trying to load mp3 audio. This is a code(in a short) which loads audio: when I run this code I get 404 error:
$("#mySound").attr('src', getAudioElementPath());
var sound = $("#mySound")[0];
sound.play();
And here is a full request and reasponse info from chrome network console:
Remote Address:127.0.0.1:49910
Request URL:http://127.0.0.1:49910/lms/media/(1.XXX.0.5732618.)/my_course/my_course/runtime_media/sound/eng/count_1.mp3
Request Method:GET
Status Code:404 404 (NOT FOUND): /lms/media/(1.XXX.0.5732618.)/my_course/my_course/runtime_media/sound/eng/count_1.mp3
-----------------
Request Header
-----------------
GET /lms/media/(1.XXX.0.5732618.)/my_course/my_course/runtime_media/sound/eng/count_1.mp3 HTTP/1.1
Host: 127.0.0.1:49910
Connection: keep-alive
Accept-Encoding: identity;q=1, *;q=0
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.122 Safari/537.36
Accept: */*
Referer: http://127.0.0.1:49910/lms/media/(1.XXX.0.5732618.)/my_course/my_course/start_page.html
Accept-Language: en-US,en;q=0.8,sr;q=0.6,es-419;q=0.4,es;q=0.2
Cookie: JSESSIONID=62F306F8F6BFBDBCD91AE22D2BA44F01
Range: bytes=0-
-----------------
Response Headers
-----------------
HTTP/1.1 404 404 (NOT FOUND): /lms/media/(1.XXX.0.5732618.)/my_course/my_course/runtime_media/sound/eng/count_1.mp3
Server: Apache-Coyote/1.1
Cache-Control: no-cache
Content-Type: text/html;charset=utf-8
Content-Length: 1331
Date: Wed, 10 Dec 2014 15:21:11 GMT
Anyway, this code returns status 200(OK):
$http.get(getAudioElementPath()).
success(function(data, status, headers, config) {
handleSuccessPath();
}).
error(function(data, status, headers, config) {
handleErrorPath();
});
Any idea how to play mp3 file in a SAP Authoring Tool?
This is a example course with problem on SAP Content Player: https://www.dropbox.com/s/mkx2g4eiz7xng6t/sap_test.zip?dl=0
This course works fine on SCORM CLOUD but SAP Content Player has a problem.
I have also posted question on SAP portal ... wating for solution: http://scn.sap.com/message/15611144#15611144
回答1:
I think I have found why mp3 is nor played in SAP contewnt player. The problem is in com.sap.hcm.ls.lms.servlets.control.MediaHandler class
SAP is trying to server mp3 file via MediaHandler but there is a bug. This is a problematic code:
String range = request.getHeader("Range");
MediaLoader.ByteRange rangeSpec = null;
if ((range != null) && (range.startsWith("bytes=")))
{
range = range.substring(6);
int inx = range.indexOf("-");
if (inx > 0)
{
int start = Integer.parseInt(range.substring(0, inx).trim());
int end = Integer.parseInt(range.substring(inx + 1).trim());
rangeSpec = new MediaLoader.ByteRange(start, end);
}
}
First it extracts "Range" from header and expect to be in format "bytes=-" So valid value could be "bytes=0-100" or bytes=0-200 for example But in our case "Range" has value "bytes=0-" so it fails on parsing on:
int end = Integer.parseInt(range.substring(inx + 1).trim());
Inside catch section during error handling at the end it returns 404:
response.sendError(404, "404 (NOT FOUND): " + path);
which is false information.
SAP is handling error on header attribute parsing in a very problematic way - it says that such resource not exists!
This is very bad. It would be nice to give some feedback to allow users to get info why mp3 is not playing.
So definitelly this is SAP content player BUG.
来源:https://stackoverflow.com/questions/27362690/how-to-enable-mp3-content-type-in-sap-authoring-tool