function wait_for_video(id, callback) {
  setTimeout(function() {
    request(heroku + "/alexa/v3/cache/" + id, function(err, res, body) {
      if (!err) {
        var body_json = JSON.parse(body);
        if (body_json.downloaded) {
          callback();
        }
        else {
          wait_for_video(id, callback);
        }
      }
    });
  }, 2000);
}
/**
 * Blocks until the audio has been loaded on the server.
 *
 * @param  {String}   id       The ID of the video
 * @param  {Function} callback The function to execute about load completion
 */
Blocks until the audio has been loaded on the server.
@param  {String}   id       The ID of the video
@param  {Function} callback The function to execute about load completion
Blocks until the audio has been loaded on the server . @param { String } id The ID of the video @param { Function } callback The function to execute about load completion
function wait_for_video(id, callback) {
  setTimeout(function() {
    request(heroku + "/alexa/v3/cache/" + id, function(err, res, body) {
      if (!err) {
        var body_json = JSON.parse(body);
        if (body_json.downloaded) {
          callback();
        }
        else {
          wait_for_video(id, callback);
        }
      }
    });
  }, 2000);
}
function wait_for_video ( id , callback ) { setTimeout ( function ( ) { request ( heroku + "/alexa/v3/cache/" + id , function ( err , res , body ) { if ( ! err ) { var body_json = JSON . parse ( body ) ; if ( body_json . downloaded ) { callback ( ) ; } else { wait_for_video ( id , callback ) ; } } } ) ; } , 2000 ) ; }
Blocks until the audio has been loaded on the server.
Blocks until the audio has been loaded on the server .