Forum Discussion
Storyline Suspend Data Compression
Hi David,
first of all: A big thank you for your idea and sharing it with us.
My company is using the LMS "LSO" from SAP.
I ran into an error when using your code. I have included pako V. 2.0.4. Maybe there is a bug in that package.
Second there is a problem with your base64 encoded data. Your program code does not compress "binary data" (the zipped data from pako) but a textstring. So the result isn'nt really "compressed".
This is my solution based on your idea: (follow the unstructions on page 1 of this conversation)
function getDataChunk() {
.....
try {var strDataC=objLMS.GetDataChunk();WriteToDebug("GetDataChunk strDataCompressed="+strDataC);
var blob=atob(strDataC);var decarray=[];Object.values(blob).forEach( function (item) { decarray.push(item.charCodeAt(0)); });var strData=window.pako.inflate(decarray, {to: 'string'});WriteToDebug("GetDataChunk strData="+strData);return strData;} catch (err) {SetErrorInfo(ERROR_INVALID_RESPONSE, "DataChunk Inflate error: "+err);return "";}
}
function setDataChunk() {
...
try {var strDataC="";var compressed=window.pako.deflate(strData);var blob="";Object.values(compressed).forEach( function (item) { blob+=String.fromCharCode(item); });strDataC=btoa(blob);WriteToDebug("SetDataChunk strDataCompressed="+strDataC);return objLMS.SetDataChunk(strDataC);} catch (err) {SetErrorInfo(ERROR_INVALID_RESPONSE, "DataChunk Deflate error^: "+err);return "";}
}
The result works fine with Articulate Storyline 3 Version 3.15 and should work with Articulate Storyline 360 as well.
I tested with a training which creates about 7.300 bytes of suspendData.
The compressed data is only about 1.500 bytes.
The compression is great. The result is only 20% of the uncompressed data.
Some additional notes to the instructions of page 1:
<script src="lms/API.js" charset="utf-8"></script>
is now
<script src="lms/scormdriver.js" charset="utf-8"></script>
The name of the file ist now index_lms.html (not index_lms_html5.html).
Thanks again, David, for coming up with that idea.
Best wishes,
Jan
Related Content
- 9 months ago
- 10 months ago
- 11 months ago
- 10 months ago