Index: video_upload.install
===================================================================
--- video_upload.install	(revision 367)
+++ video_upload.install	(working copy)
@@ -18,6 +18,8 @@
   drupal_load('module', 'content');
   content_notify('install', 'video_upload');
   drupal_set_message(t('Video Upload successfully installed, and can be configured <a href="!url">here</a>.', array('!url' => url('admin/settings/video-upload'))));
+  
+  drupal_install_schema('video_upload');
 }
 
 /**
@@ -49,6 +51,8 @@
   variable_del('video_upload_youtube_developer_key');
   variable_del('video_upload_youtube_username');
   variable_del('video_upload_youtube_password');
+  
+  drupal_uninstall_schema('video_upload');
 }
 
 /**
@@ -202,3 +206,32 @@
     3 => VIDEO_UPLOAD_STATUS_UPLOAD_PENDING,
   );
 }
+
+/**
+ * Implementation of hook_schema().
+ */
+function video_upload_schema() {
+  $schema['video_upload_delete'] = array(
+    'description' => 'A table for storing ids of videos that need to be externally deleted.',
+    'fields' => array(
+      'vudid' => array(
+        'type' => 'serial',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+      ),
+      'video_id' => array(
+        'type' => 'varchar',
+        'length' => 128,
+        'not null' => TRUE,
+        'default' => '',
+      ),
+    ),
+    'unique keys' => array(
+      'vudid' => array('vudid')
+    ),
+    'primary key' => array('vudid'),
+  );
+  
+  return $schema;
+}
+
Index: video_upload.module
===================================================================
--- video_upload.module	(revision 367)
+++ video_upload.module	(working copy)
@@ -450,6 +450,17 @@
     }
   }
   else {
+    if ($op == 'delete') {
+      // Add video to video_upload_delete table so that we know it needs to be externally deleted on cron.
+      if ($field['widget']['remove_deleted_videos']) {
+        foreach ($items as $item) {
+          $row = array(
+            'video_id' => $item['video_id'],
+          );
+          drupal_write_record('video_upload_delete', $row);
+        }
+      }
+    }
     return filefield_field($op, $node, $field, $items, $teaser, $page);
   }
 }
Index: video_upload.admin.inc
===================================================================
--- video_upload.admin.inc	(revision 367)
+++ video_upload.admin.inc	(working copy)
@@ -442,6 +442,13 @@
       $videos[$video->video_id] = $video;
     }
   }
+  
+  // Add videos from deleted nodes. Limit to 10 per cron job.
+  $result = db_query("SELECT video_id FROM {video_upload_delete} LIMIT 10");
+  while ($video = db_fetch_object($result)) {
+    $video_ids[] = $video->video_id;
+    db_query("DELETE FROM {video_upload_delete} WHERE video_id = '%s'", $video->video_id);
+  }
 
   // Establish provider connection.
   $connection = video_upload_connect(TRUE);
