Skip to content

Commit

Permalink
changed location of Stalker Code from streams dir to app-showcase dir.
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenlb committed Oct 18, 2011
1 parent 0ec411e commit 98e8559
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions app-showcase/audio-rotate/audio-rotate.html
Expand Up @@ -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]
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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();
} );

Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 98e8559

Please sign in to comment.