Skip to content

Instantly share code, notes, and snippets.

@we4tech
Created May 2, 2012 08:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save we4tech/2575202 to your computer and use it in GitHub Desktop.
Save we4tech/2575202 to your computer and use it in GitHub Desktop.
Spring Score Integration
var SpringAnalyticsJS = {
sensors: new SpringStreams("dbstream")
, screenX: 0
, screenY: 0
, duration: 0
, position: 0
, streamName: null
, uid: "test" + (new Date().getTime() * 10000 * Math.random())
, set: function(key, value) {
SpringAnalyticsJS[key] = value;
}
, videoAdapter: {
"getMeta": function(id) {
return {
"pl" :"Multi Stream Player"
, "plv" :"0.6"
, "sx" : SpringAnalyticsJS.screenX
, "sy" : SpringAnalyticsJS.screenY
}
}
, "getDuration": function(id) { return SpringAnalyticsJS.duration; }
, "getPosition": function(id) { return SpringAnalyticsJS.position; }
},
track: function() {
SpringAnalyticsJS.sensors.debug('Tracking - ' + SpringAnalyticsJS.streamName);
if (SpringAnalyticsJS.streamName != null) {
SpringAnalyticsJS.sensors.track(
SpringAnalyticsJS.uid, {
"stream": SpringAnalyticsJS.streamName
}, SpringAnalyticsJS.videoAdapter);
}
}
};
SpringAnalyticsJS.sensors.debug = function(v) {
if ('undefined' != typeof(console))
console.log(v);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment