Embedding player - Getting lesson results

It is possible to get a lesson score using player API. Here is example code to 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

  1. Check also PlayerService functions. Especially section with score functions.