Skip to content
Browse files

changed location of Stalker Code from streams dir to app-showcase dir.

  • Loading branch information...
1 parent 0ec411e commit 98e855991776b3452414840c416c67fdb8c1d7ad @stephenlb stephenlb committed Oct 18, 2011
View
18 app-showcase/audio-rotate/audio-rotate.html
@@ -117,6 +117,8 @@
, timer = p.$('timer')
, userlist = p.$('userlist')
, master = 'pubnub-audio-rotater'
+ , rotate_rate = 2000
+ , last_rotate = now()
, userid = ''+Math.floor(Math.random()*999999999)
, users = []
, body = p.search('body')[0]
@@ -198,14 +200,22 @@
body.stop_interval && body.stop_interval();
}, 300 ); }
- if (user !== userid) return;
+ if (user !== userid) return (last_rotate = now());
// TODO -> auto-adjust latency
// TODO -> auto-adjust latency
// TODO -> auto-adjust latency
// TODO -> auto-adjust latency
- audio.currentTime = data.time || Math.random()*100;
+ var diff = last_rotate - now() + rotate_rate
+ , time = (data.time && (data.time) || 0) / 1000;
+
+ console.log(diff, '<---- DIFF');
+
+ audio.currentTime = time || Math.random()*100;
+
start_timer = data.clock;
+ last_rotate = now();
+
audio.play();
body.stop_interval = function() {
@@ -258,10 +268,10 @@
function rotateit() {
p.attr( target, 'userid', get_random_user() );
- start_music( target, (now() - start + latency) / 1000, 1 );
+ start_music( target, (now() - start + latency), 1 );
}
- rotateival = setInterval( rotateit, 2000 );
+ rotateival = setInterval( rotateit, rotate_rate );
rotateit();
} );
View
0 streams/stalker.htm → app-showcase/stalker/stalker.htm
File renamed without changes.
View
0 streams/stalker.js → app-showcase/stalker/stalker.js
File renamed without changes.

0 comments on commit 98e8559

Please sign in to comment.
Something went wrong with that request. Please try again.