Index: video.module
===================================================================
RCS file: /cvs/drupal/contributions/modules/video/video.module,v
retrieving revision 1.47
diff -u -r1.47 video.module
--- video.module	16 Jul 2006 09:26:00 -0000	1.47
+++ video.module	3 Aug 2006 20:26:25 -0000
@@ -611,11 +611,18 @@
  *   Nothing, modifies $node which is passed by reference.
  */
 function video_view(&$node, $teaser = FALSE, $page = FALSE) {
+
+  // prepare the body and teaser
   $node = node_prepare($node, $teaser); //Run the body through the standard filters.
 
   // include the video css file
   theme_add_style(drupal_get_path('module', 'video').'/video.css');
 
+  // if we are viewing the page, run the body through the theme
+  if($page){
+    $node->body = theme('video_view', $node, $teaser, $page);
+  }
+  
 }
 
 /********************************************************************
@@ -768,40 +775,12 @@
  */
 function video_play() {
   if ($node = node_load(arg(1))) {
-    // include video.js file for Internet Explorer fixes
-    theme('video_get_script');
     drupal_set_title(t('Playing') . ' ' . theme('placeholder', $node->title));
-    if (variable_get('video_playcounter', 1)) {
-      db_query("UPDATE {video} SET play_counter = play_counter + 1 where vid = %d", $node->vid); //Increment play counter.
-    }
-    switch (_video_get_filetype($node->vidfile)) {
-      case 'mov':
-      case 'mp4':
-      case '3gp':
-      case '3g2':
-        return theme('video_play_quicktime', $node);
-      case 'rm':
-        return theme('video_play_realmedia', $node);
-      case 'flv':
-        return theme('video_play_flash', $node);
-      case 'swf':
-        return theme('video_play_swf', $node);
-      case 'dir':
-      case 'dcr':
-        return theme('video_play_dcr', $node);
-      case 'wmv':
-        return theme('video_play_windowsmedia', $node);
-      case 'ogg':
-        return theme('video_play_ogg_theora', $node);
-      case 'youtube':
-        return theme('video_play_youtube', $node);
-      case 'googlevideo':
-        return theme('video_play_googlevideo', $node);
-      default:
-        drupal_set_message('Video type not supported', 'error');
-        drupal_goto("node/$node->nid");
-        break;
+    $output = theme('video_player', $node);
+    if($output == ''){
+      drupal_goto("node/$node->nid");
     }
+    return $output;
   }
   else {
     drupal_not_found();
@@ -813,6 +792,72 @@
  *********************************************************************/
 
 /**
+ * theme the view of the page to include the video
+ * assumes that body was put through prepare in hook_view
+ * 
+ * @param $node
+ *   The node to be displayed.
+ * @param $teaser 
+ *   Whether we are to generate a "teaser" or summary of the node, rather than display the whole thing.
+ * @param $page 
+ *   Whether the node is being displayed as a standalone page. If this is TRUE, the node title should not be displayed, as it will be printed automatically by the theme system. Also, the module may choose to alter the default breadcrumb trail in this case.
+ * 
+ * @return
+ *   html
+ */
+function theme_video_view($node, $teaser = FALSE, $page = FALSE){
+  $output = '';
+  $output = theme('video_player', $node);
+  $output .= '<div id="video_body">'. $node->body .'</div>';
+  return $output; 
+}
+
+/**
+ * theme function to control which player is presented
+ * 
+ * @param $node
+ *   node object
+ * 
+ * @return
+ *   html
+ */
+function theme_video_player($node){
+  // include video.js file for Internet Explorer fixes
+  theme('video_get_script');
+  if (variable_get('video_playcounter', 1)) {
+    db_query("UPDATE {video} SET play_counter = play_counter + 1 where vid = %d", $node->vid); //Increment play counter.
+  }
+  switch (_video_get_filetype($node->vidfile)) {
+    case 'mov':
+    case 'mp4':
+    case '3gp':
+    case '3g2':
+      return theme('video_play_quicktime', $node);
+    case 'rm':
+      return theme('video_play_realmedia', $node);
+    case 'flv':
+      return theme('video_play_flash', $node);
+    case 'swf':
+      return theme('video_play_swf', $node);
+    case 'dir':
+    case 'dcr':
+      return theme('video_play_dcr', $node);
+    case 'wmv':
+      return theme('video_play_windowsmedia', $node);
+    case 'ogg':
+      return theme('video_play_ogg_theora', $node);
+    case 'youtube':
+      return theme('video_play_youtube', $node);
+    case 'googlevideo':
+      return theme('video_play_googlevideo', $node);
+    default:
+      drupal_set_message('Video type not supported', 'error');
+	  return '';
+  }
+}
+
+
+/**
  * Play videos from in FLV Flash video format
  *
  * @param $node
