This is a short example of how to use the heat-map functionality in CommonHIT. Please inspect this document's source code to see how certain functionality is being achieved.
First, include the YouTube player.
Here, we use data-name="lllplayer"
:
How to include a static heat-map:
How to include a live heat-map (mainly for debugging purposes):
How to include a dummy heat-map (for illustrative purposes):
Attributes:
class="lll-heatmap"
llheatmap.js
to insert a heat-map here.data-name
llheatmap.js
will use
to expose the scripting functionality of the heat-map.
data-for
data-name
attribute on the player is required.
data-map
"LIVE"
for a live heat-map
that depicts which parts of the video have been watched.
data-width, data-height
Scripting examples:
heatmap.paintHeatmap([0,0,0.8,0,0,1,0]);
var output = $('#outputExample2'); function handler(t) { var name = $(this.node).data('name'); var t = LLL.HEATMAP.timecodeToHHMMSS(t); output.text(name + ' ' + t + '\n' + output.text()) } var subscription1 = heatmap.addClickListener(handler); var subscription2 = live_heatmap.addClickListener(handler); var subscription3 = dummy_heatmap.addClickListener(handler); output.text('Now click on the heat-map') // removing the listener: <subscription>.dispose();