Documentation

Getting lesson results

It is possible to get a lesson score using player API. Here is an example code showing how to do it.

var player;
function icOnAppLoaded(){
    player = icCreatePlayer('_icplayer');
    player.load('content/default.ic.xml');
}

function getLessonScore(){
    var ps = player.getPlayerServices();
    var model = ps.getPresentation();
    var scoreService = ps.getScore();
    var sumOfScore = 0.0;
    var count = 0;
    for(var i = 0; i < model.getPageCount(); i++){
        var page = model.getPage(i);
        if(page.isReportable()){
            count += 1;
            var score = scoreService.getPageScore(page.getName());
            var percentageScore = (score['score']*100.0)/score['maxScore']
            sumOfScore += percentageScore; 
        }
    }

    var lessonScore = sumOfScore/count;
    return lessonScore;
}

Remarks

  • Check also PlayerService functions. Especially the section with score functions.