Advertisement
Guest User

Untitled

a guest
Mar 6th, 2015
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. var t;
  2. var duration;
  3.  
  4.  
  5. socketio.listen(server).on('connection', function (socket) {
  6.  
  7.  
  8. function doit() {
  9.  
  10. getvideo(function(vid, callback) {
  11.  
  12. if(vid.stopwatch) { duration = vid.stopwatch * 1000 + 1000; } else { duration = defdur; }
  13.  
  14. console.log('le broadcast')
  15. socket.broadcast.to('player').emit('changevid', vid);
  16.  
  17. t=setTimeout(function() {
  18.  
  19. //do it again
  20. callback(function() {
  21. doit();
  22. });
  23.  
  24. }, duration);
  25.  
  26. });
  27.  
  28. }
  29.  
  30.  
  31.  
  32. });
  33.  
  34. function getvideo(callback) {
  35. //do stuff
  36. callback(vid);
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement