diff --git a/phpviddler.php b/phpviddler.php
index 36b2a7f..81a4d30 100755
--- a/phpviddler.php
+++ b/phpviddler.php
@@ -6,10 +6,10 @@
   #
   #  Docs: http://developers.viddler.com/documentation/api-v2/
   #
-  #  License(s): Dual licensed under: 
+  #  License(s): Dual licensed under:
   #  MIT (MIT-LICENSE.txt)
   #  GPL (GPL-LICENSE.txt)
-  # 
+  #
   #  Third-party code:
   #  XML Library by Keith Devens
   #  xmlparser.php
@@ -33,11 +33,11 @@ include_once('xmlparser.php');
 class Phpviddler {
 
   var $apiKey;
-  
+
   // API End-Point Version 2.0
   var $viddlerREST = 'http://api.viddler.com/api/v2/';
   var $viddlerRESTSSL = 'https://api.viddler.com/api/v2/';
-  
+
   var $parser = true; // Use the included XML parser? Default: true.
   var $debug = false; // Switch for debug mode
   var $format = 'xml'; // Response format: XML (default), JSON, PHP
@@ -48,70 +48,70 @@ class Phpviddler {
       $this->apiKey = $apiKey;
     }
   }
-  
+
 /*##########  User functions ########### */
-  
+
   /* viddler.users.register
   / accepts: $userInfo(array)
   / returns: array or xml
   */
   function user_register($userInfo=null) {
-    
+
     $username = $this->sendRequest('viddler.users.register',$userInfo,'post');
-    
+
     return $username;
   }
-  
-  
+
+
   /* viddler.users.auth
   / accepts: $user(string),$pass(string),$getToken(1/optional)
   / returns: array or xml
   */
   function user_authenticate($user=null,$pass=null,$getToken=null) {
-     
+
     $requestString = 'user='.$user.'&password='.$pass;
      if ($getToken != null) $requestString .= '&get_record_token='.$getToken;
-    
+
     $session = $this->sendRequest('viddler.users.auth',$requestString);
-    
+
     return $session;
   }
-  
+
   /* viddler.users.getProfile
   / accepts: $user(string)
   / returns: array or xml
   */
   function user_profile($user=null) {
-    
+
     $profile = $this->sendRequest('viddler.users.getProfile','user='.$user);
-    
+
     return $profile;
   }
-  
+
   /* viddler.users.setProfile
   / requires: POST
   / accepts: $profile(array)
   / returns: array or xml
   */
   function user_setprofile($profile=null) {
-    
+
     $newProfile = $this->sendRequest('viddler.users.setProfile',$profile,'post');
-    
+
     return $newProfile;
   }
-  
+
   /* viddler.users.setOptions
   / requires: POST
   / accepts: $options(array)
   / returns: array or xml
   */
   function user_setoptions($options=null) {
-  
+
     $response = $this->sendRequest('viddler.users.setOptions',$options,'post');
-    
+
     return $response;
   }
-  
+
 /*##########  Video functions ########### */
 
   /* viddler.videos.delete
@@ -119,14 +119,14 @@ class Phpviddler {
   / returns: array or xml
   */
   function video_delete($sessionid=null, $video_id=null) {
-    $result = $this->sendRequest('viddler.videos.delete', array('sessionid'=>$sessionid, 'video_id'=>$video_id), 'post');    
+    $result = $this->sendRequest('viddler.videos.delete', array('sessionid'=>$sessionid, 'video_id'=>$video_id), 'post');
     return $result;
   }
 
   /* viddler.videos.prepareUpload
   / accepts: $sessionid
   / returns: array or xml
-  */    
+  */
   function video_prepareupload($sessionid=null) {
     $temprest = $this->sendRequest('viddler.videos.prepareUpload',array('sessionid'=>$sessionid));
     return $temprest;
@@ -136,7 +136,7 @@ class Phpviddler {
   / requires: POST
   / accepts: $videoInfo(array)
   / returns: array or xml
-  */    
+  */
   function video_upload($videoInfo=null) {
     // tom@punkave.com: this didn't work as-is because curl doesn't know
     // the 'file' field is the path of a file to be uploaded unless
@@ -145,7 +145,7 @@ class Phpviddler {
     $rest = $this->viddlerREST;
     $temprest = $this->video_prepareupload($videoInfo['sessionid']);
     $this->viddlerREST = $temprest['upload']['endpoint'];
-    
+
     if (isset($videoInfo['file']) && substr($videoInfo['file'],0,1) != '@') {
       $videoInfo['file'] = '@' . $videoInfo['file'];
     }
@@ -155,15 +155,15 @@ class Phpviddler {
     return $videoDetails;
   }
 
-  
+
   /* viddler.videos.getRecordToken
   / accepts: $sessionid(number)
   / returns: number | string if error
   */
   function video_getrecordtoken($sessionid=null) {
-    
+
     $token = $this->sendRequest('viddler.videos.getRecordToken','sessionid='.$sessionid);
-    
+
     if (isset($token['error'])) {
       return $token['error']['description'];
     } else {
@@ -184,53 +184,53 @@ class Phpviddler {
   }
   */
   function video_status($videoid=null,$sessionid=null) {
-    
+
     $videoStatus = $this->sendRequest('viddler.videos.getStatus','video_id='.$videoid.'&sessionid='.$sessionid);
-    
+
     return $videoStatus;
   }
-  
+
   /* viddler.videos.getDetails
   / accepts: $sessionid(number/optional) and $videoid(number)
   / returns: array or xml
   */
   function video_details($videoid=null,$sessionid=null) {
-    
+
     $videoDetails = $this->sendRequest('viddler.videos.getDetails','sessionid='.$sessionid.'&video_id='.$videoid);
-    
+
     return $videoDetails;
   }
-  
+
   /* viddler.videos.getDetailsByUrl
   / accepts $sessionid(number/optional) and $videourl(string)
   / returns: array or xml
   */
   function video_detailsbyurl($videourl=null,$sessionid=null) {
     if($videourl && !strpos($videourl, 'explore')) $videourl = str_replace('viddler.com/', 'viddler.com/explore/', $url);
-    
+
     $videoDetails = $this->sendRequest('viddler.videos.getDetails','sessionid='.$sessionid.'&url='.$videourl);
-    
+
     return $videoDetails;
   }
-  
+
   /* viddler.videos.setDetails
   / accepts: array
   / returns: array or xml
   */
   function video_setdetails($videoDetails=null) {
-  
+
     $newVideoDetails = $this->sendRequest('viddler.videos.setDetails',$videoDetails,'post');
-    
+
     return $newVideoDetails;
   }
-  
+
   /* viddler.videos.setPermalink
   / accepts: $sessionid(number),url(url),videoid(string)
   / returns: string | string if error
-  */    
+  */
   function video_setpermalink($sessionid=null,$videoid=null,$url=null) {
     $permalink = $this->sendRequest('viddler.videos.setPermalink',array('sessionid'=>$sessionid,'video_id'=>$videoid,'permalink'=>$url),'post');
-      
+
     if ($permalink['error']) {
       return $permalink['error']['description'];
     } else {
@@ -238,19 +238,19 @@ class Phpviddler {
     }
 
   }
-  
+
   /* viddler.videos.setThumbnail
   / accepts: $sessionid(number),url(url),videoid(string)
   / returns: array or xml | string if error
-  */    
+  */
   function video_setthumbnail($sessionid=null,$videoid=null,$timepoint=null,$file=null) {
-    
+
     if (isset($file) && substr($file,0,1) != '@') {
       $file = '@' . $file;
     }
-    
+
     $thumbnail = $this->sendRequest('viddler.videos.setThumbnail',array('sessionid'=>$sessionid,'video_id'=>$videoid,'timepoint'=>1,'file'=>$file,),'post');
-      
+
     if ($thumbnail['error']) {
       return $thumbnail['error']['description'];
     } else {
@@ -258,24 +258,24 @@ class Phpviddler {
     }
 
   }
-  
+
   /* viddler.videos.comments.add
   / accepts $video_id(string), $text(string), $sessionid
   */
   function video_addcomment($video_id=null, $text=null, $sessionid=null) {
     $array = array('video_id' => $video_id, 'text' => $text, 'sessionid' => $sessionid);
     $comment = $this->sendRequest('viddler.videos.comments.add',$array,'post');
-    
+
     return $comment;
   }
-  
+
   /* viddler.videos.comments.remove
   / accepts $video_id(string), $text(string), $sessionid
-  */    
+  */
   function video_removecomment($video_id=null, $commentid=null, $sessionid=null) {
     $array = array('video_id' => $video_id, 'comment_id' => $commentid, 'sessionid' => $sessionid);
     $remove = $this->sendRequest('viddler.videos.comments.remove',$array,'post');
-    
+
     return $remove;
   }
 
@@ -286,41 +286,41 @@ class Phpviddler {
   / returns: array or xml
   */
   function videos_listbyuser($user=null,$page=null,$per_page=null,$sessionid=null,$tags=null,$sort=null) {
-    
+
     // Build request string
     $requestString = 'user='.$user;
       if ($sessionid != null) { $requestString .= '&sessionid='.$sessionid; }
     $requestString .= '&page='.$page.'&per_page='.$per_page.'&tags='.$tags.'&sort='.$sort;
-    
+
     $videoList = $this->sendRequest('viddler.videos.getByUser',$requestString);
-    
+
     return $videoList;
   }
-  
-  
+
+
   /* viddler.videos.getByTag
   / accepts: $tag = string, $page = number, $per_page = number
   / $sort(uploaded-asc, uploaded-desc (default), views-asc, views-desc)
   / returns: array or xml
   */
   function videos_listbytag($tag=null,$page=null,$per_page=null,$sort=null) {
-    
+
     $videoList = $this->sendRequest('viddler.videos.getByTag','tag='.$tag.'&page='.$page.'&per_page='.$per_page.'&sort='.$sort);
-    
+
     return $videoList;
   }
-  
+
   /* viddler.videos.getFeatured
   / accepts: none
   / returns: array or xml
   */
   function videos_listfeatured() {
-    
+
     $featuredVideos = $this->sendRequest('viddler.videos.getFeatured');
-    
+
     return $featuredVideos;
   } // end videos_listfeatured()
-  
+
   /* viddler.videos.search
   accepts: array(
     type("myvideos","friendsvideos","allvideos","relevant","recent","popular","timedtags","globaltags")
@@ -334,20 +334,20 @@ class Phpviddler {
   function video_search($details) {
     return $this->sendRequest('viddler.videos.search', $details);
   }
-  
+
 /*########## Extended Functions ###########
   Although not available via the API itself yet,
   these functions can be used to do common
   tasks. */
-  
+
   /* video_addTag()
   / accepts: $videoid(number), $sessionid(number), $newtag(string)
   / returns: same as video_getdetails();
   */
   function video_addTag($videoid=null,$sessionid=null,$newtag=null) {
-    
+
     $videodetails = $this->video_details($videoid,$sessionid);
-    
+
     if (is_array($videodetails['video']['tags']['global']) && count($videodetails['video']['tags']['global']) > 1) {
       for ($i=0;$i<count($videodetails['video']['tags']['global']);$i++) {
         $videodetails['video']['tags']['global'][$i] = '"'.$videodetails['video']['tags']['global'][$i].'"';
@@ -356,31 +356,31 @@ class Phpviddler {
     } else {
       $tags = $videodetails['video']['tags']['global'];
     }
-    
+
     if ($tags == '') {
       $tags = $newtag;
     } else {
       $tags .= ','.$newtag;
     }
-        
+
     $newvideodetails = $this->video_setdetails(array('video_id'=>$videoid,'sessionid'=>$sessionid,'tags'=>$tags));
-    
+
     return $newvideodetails;
-  
+
   }
-  
+
   /* video_removeTag()
   / accepts: $videoid(number), $sessionid(number), $oldtag(string)
   / returns: same as video_getdetails();
   */
   function video_removeTag($videoid=null,$sessionid=null,$oldtag=null) {
-    
+
     $videodetails = $this->video_details($videoid,$sessionid);
-    
+
     if (is_array($videodetails['video']['tags']['global']) && count($videodetails['video']['tags']['global']) > 1) {
-      
+
       if (in_array($oldtag,$videodetails['video']['tags']['global'])) {
-        
+
         for ($i=0;$i<count($videodetails['video']['tags']['global']);$i++) {
             if ($videodetails['video']['tags']['global'][$i] == $oldtag) {
               unset($videodetails['video']['tags']['global'][$i]);
@@ -388,23 +388,23 @@ class Phpviddler {
               $videodetails['video']['tags']['global'][$i] = '"'.$videodetails['video']['tags']['global'][$i].'"';
             }
         }
-      
+
       } else {
         return false;
       }
-      
+
       $tags = implode(",",$videodetails['video']['tags']['global']);
-    
+
     } elseif ($oldtag == $videodetails['video']['tags']['global']) {
       $tags = '';
     } else {
       return false;
     }
-        
+
     $newvideodetails = $this->video_setdetails(array('video_id'=>$videoid,'sessionid'=>$sessionid,'tags'=>$tags));
-    
+
     return $newvideodetails;
-  
+
   }
 
 
@@ -417,7 +417,7 @@ class Phpviddler {
   */
   function video_getRecordEmbed($token=null,$width=449,$height=400) {
     if (!$token) return false;
-    
+
     $html = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'.$width.'" height="'.$height.'" id="viddler_recorder" align="middle">
       <param name="allowScriptAccess" value="always" />
       <param name="allowNetworking" value="all" />
@@ -428,10 +428,10 @@ class Phpviddler {
       <param name="flashvars" value="fake=1&amp;recordToken='.$token.'" />
       <embed src="http://www.viddler.com/flash/recorder.swf" quality="high" scale="noScale" bgcolor="#000000" allowScriptAccess="always" allowNetworking="all" width="'.$width.'" height="'.$height.'" name="viddler_recorder" flashvars="fake=1&amp;recordToken='.$token.'" align="middle" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
     </object>';
-    
+
     return $html;
   }
-  
+
   /* video_getEmbed()
   / accepts: $videoid(string),$type(string,(player or simple),default=player),$options
   / $width(number),$height(number),$autoplay(boolean),$options(array or false)
@@ -440,9 +440,9 @@ class Phpviddler {
   */
   function video_getEmbed($videoid=null,$type='player',$width=437,$height=370, $autoplay = false, $options = false) {
    if (!$options) {
-      $options = array();    
+      $options = array();
    }
-    
+
     if (!$videoid) return false;
 
     $html = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'.$width.'" height="'.$height.'" id="viddlerplayer-'.$videoid.'"><param name="movie" value="http://www.viddler.com/'.$type.'/'.$videoid.'/" />';
@@ -461,10 +461,42 @@ class Phpviddler {
     return $html;
   }
 
+  /* video_gethtml5Embed()
+  / accepts: $videoid(string),$type(string,(player or simple),default=player),$options
+  / $width(number),$height(number),$autoplay(boolean),$options(array or false)
+  / returns: HTML
+    / HTML5 Added by mb@ixis.co.uk
+  */
+  function video_gethtml5Embed($videoid=null,$type='player',$width=437,$height=370, $autoplay = false, $options = false) {
+   if (!$options) {
+      $options = array();
+   }
+
+   if (!$videoid) return false;
+
+    $html = '<!--[if IE]><object width="' . $width . '" height="' . $height . '" id="viddlerOuter-' . $videoid . '" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">';
+    $html .= '<param name="movie" value="//www.viddler.com/player/' . $videoid . '/">';
+    foreach ($options as $key => $val) {
+      $html .= '<param name="' . htmlspecialchars($key) . '" value="' . htmlspecialchars($val) . '" />';
+    }
+    $html .= '<object id="viddlerInner-' . $videoid . '">';
+    $html .= '<video id="viddlerVideo-' . $videoid . '" src="//www.viddler.com/file/' . $videoid . '/html5mobile/" type="video/mp4" width="' . $width . '" height="' . $height . '" poster="//www.viddler.com/thumbnail/' . $videoid . '/" controls="controls" x-webkit-airplay="allow"></video>';
+    $html .= '</object></object><![endif]--> <!--[if !IE]> <!--> ';
+    $html .= '<object width="' . $width . '" height="' . $height . '" id="viddlerOuter-' . $videoid . '" type="application/x-shockwave-flash" data="//www.viddler.com/player/' . $videoid . '/"> ';
+    $html .= '<param name="movie" value="//www.viddler.com/player/' . $videoid . '/">';
+    foreach ($options as $key => $val) {
+      $html .= '<param name="' . htmlspecialchars($key) . '" value="' . htmlspecialchars($val) . '" />';
+    }
+    $html .= '<object id="viddlerInner-' . $videoid . '"> ';
+    $html .= '<video id="viddlerVideo-' . $videoid . '" src="//www.viddler.com/file/' . $videoid . '/html5mobile/" type="video/mp4" width="' . $width . '" height="' . $height . '" poster="//www.viddler.com/thumbnail/' . $videoid . '/" controls="controls" x-webkit-airplay="allow"></video> ';
+    $html .= '</object></object> <!--<![endif]-->';
+    return $html;
+  }
+
   function video_getoEmbed($videourl,$maxwidth) {
-    
+
     $reqURL = 'http://labs.viddler.com/services/oembed/?format=html&url='.$videourl.'&maxwidth='.$maxwidth;
-  
+
     $curl_handle = curl_init();
     curl_setopt ($curl_handle, CURLOPT_URL, $reqURL);
     curl_setopt ($curl_handle, CURLOPT_RETURNTRANSFER, 1);
@@ -472,13 +504,13 @@ class Phpviddler {
     curl_setopt ($curl_handle, CURLOPT_HEADER, 0);
     curl_setopt ($curl_handle, CURLOPT_TIMEOUT, 0);
     $embedcode = curl_exec($curl_handle);
-    
+
     if (!$response) $response = curl_error($curl_handle);
     curl_close($curl_handle);
-    
+
     return $embedcode;
   }
-  
+
   /* video_go()
   / description: Creates a Viddler short URL using http://go.viddler.com/
   / accepts: $url(string) - must be full URL e.g. http://www.viddler.com/explore/cdevroe/videos/133/
@@ -488,14 +520,14 @@ class Phpviddler {
   function video_go($url) {
     //! To do: Send URL to Viddler API.
     $response = $this->video_detailsbyurl($url);
-    
+
     if (isset($response['error'])) {
       return false;
     } else {
       return 'http://go.viddler.com/'.$response['video']['id'].'/';
     }
-  } 
-  
+  }
+
   /* buildArguments()
   / accepts: $p(array)
   / returns: string
@@ -504,14 +536,14 @@ class Phpviddler {
     // tom@punkave.com: undefined warning otherwise
     $args = '';
     foreach ($p as $key => $value) {
-      
+
       // Skip these
       if ($key == 'method' || $key == 'submit' || $key == 'MAX_FILE_SIZE') continue;
-      
+
       $args .= $key.'='.urlencode($value).'&';
-      
+
     } // end foreach
-    
+
     // Chop off last ampersand
     return substr($args, 0, -1);
   } // end buildArguments()
@@ -521,20 +553,20 @@ class Phpviddler {
   / returns: array or xml
   */
   function sendRequest($method=null,$args=null,$postmethod='get') {
-  
+
     // Convert array to string
 
     // tom@punkave.com: this used to break file uploads. CURLOPT_POSTFIELDS
     // is only checked for names beginning with @ if it's an array, and
     // that's how PHP's cURL wrapper recognizes file uploads. This in itself
     // is a potential security hole (because PHP programmers have no idea
-    // that an @ prefix will do this if they pass an array), and I've opened 
-    // a PHP bug report on that subject (#46439), but for viddler API 
-    // purposes it's safe because viddler doesn't want or accept file 
+    // that an @ prefix will do this if they pass an array), and I've opened
+    // a PHP bug report on that subject (#46439), but for viddler API
+    // purposes it's safe because viddler doesn't want or accept file
     // uploads for inappropriate fields. Someday PHP's behavior may
     // change to the new API I suggest in that bug report (requiring
     // some changes here). We can hope.
-  
+
   if ($method == 'viddler.users.auth') {
     $reqURL = $this->viddlerRESTSSL.$method.'.'.$this->format.'?api_key='.$this->apiKey;
   } else if ($method == 'viddler.videos.upload') {
@@ -542,20 +574,20 @@ class Phpviddler {
   } else  {
     $reqURL = $this->viddlerREST.$method.'.'.$this->format.'?api_key='.$this->apiKey;
   }
-    
-    
+
+
   if ($postmethod == 'get') {
-      if (is_array($args)) 
+      if (is_array($args))
       {
         $getArgs = $this->buildArguments($args);
-      } 
+      }
       else
       {
         $getArgs = $args;
       }
       $reqURL .= '&'.$getArgs;
     }
-    
+
     $curl_handle = curl_init();
     curl_setopt ($curl_handle, CURLOPT_URL, $reqURL);
     curl_setopt ($curl_handle, CURLOPT_RETURNTRANSFER, 1);
@@ -571,39 +603,39 @@ class Phpviddler {
       }
     }
     $response = curl_exec($curl_handle);
-    
+
     if (!$response) $response = curl_error($curl_handle);
     curl_close($curl_handle);
-    
+
     // Debug?
     if ($this->debug) {
       echo '<pre>';
         print_r($args);
         print_r($response);
-      echo '</pre>';      
-    }    
-    
+      echo '</pre>';
+    }
+
     // Return array or XML
     if ($this->parser) {
       $response = XML_unserialize($response);
       $result = array(); // Fix for transitional release
-        
+
         // All for Transitional release
         if (isset($response['list_result']['page'])) $result['video_list attr']['page'] = $response['list_result']['page'];
         if (isset($response['list_result']['per_page'])) $result['video_list attr']['per_page'] = $response['list_result']['per_page'];
         if (isset($response['list_result']['sort'])) $result['video_list attr']['sort'] = $response['list_result']['sort'];
-        
+
         if (isset($response['list_result']['video_list'])) $result['video_list'] = $response['list_result']['video_list'];
-        
-        
+
+
       if (!$result) { return $response; } else { return $result; }
       // All for Transitional release
-      
+
     } else {
       // If parser is off, just return raw data.
       return $response;
     }
-        
+
   } // End sendRequest();
 
 } // end phpviddler
diff --git a/viddler.module b/viddler.module
index 263a541..f97c8cf 100644
--- a/viddler.module
+++ b/viddler.module
@@ -32,14 +32,14 @@ function viddler_menu() {
     'access arguments' => array('record via webcam'),
     'type'  => MENU_CALLBACK,
   );
-  
+
   $items['viddler/upload_video'] = array(
     'page callback' => 'viddler_upload_js',
     'access arguments' => array('upload video'),
     'page arguments' => array(2,3,4),
     'type' => MENU_CALLBACK,
   );
-  
+
   $items['viddler/progress'] = array(
     'page callback' => 'viddler_progress',
     'access arguments' => array('access content'),
@@ -49,7 +49,7 @@ function viddler_menu() {
   return $items;
 }
 
-/** 
+/**
 * Implementation of hook_perm().
 */
 function viddler_perm() {
@@ -70,25 +70,25 @@ function viddler_record_again_js() {
  */
 function viddler_upload_js($type_name, $field_name, $delta) {
   $field = content_fields($field_name, $type_name);
-  
+
   if (empty($field) || empty($_POST['form_build_id'])) {
     // Invalid request.
     print drupal_to_js(array('data' => ''));
     exit;
   }
-  
+
   // Build the new form.
   $form_state = array('submitted' => FALSE);
   $form_build_id = $_POST['form_build_id'];
   $form = form_get_cache($form_build_id, $form_state);
-  
+
   if (!$form) {
     // Invalid form_build_id.
     drupal_set_message(t('An unrecoverable error occurred. This form was missing from the server cache. Try reloading the page and submitting again.'), 'error');
     print drupal_to_js(array('data' => theme('status_messages')));
     exit;
   }
-    
+
   // Render the form for output.
   $form += array(
     '#post' => $_POST,
@@ -99,16 +99,16 @@ function viddler_upload_js($type_name, $field_name, $delta) {
   drupal_alter('form', $data, 'viddler_upload_js');
   $form = form_builder('viddler_upload_js', $form, $built_form_state);
   $field_form = empty($group_name) ? $form[$field_name] : $form[$group_name][$field_name];
-  
+
   // We add a div around the new content to tell AHAH to let this fade in.
   $field_form[$delta]['#prefix'] = '<div class="ahah-new-content">';
   $field_form[$delta]['#suffix'] = '</div>';
-  
+
   // if progress monitoring was used previously reset it before uploading.
   if(isset($_SESSION['percent_save'])){
     $_SESSION['percent_save'] = -1;
   }
-  
+
   $upload_name = $field_form[$delta]['#field_name'] .'_'. $field_form[$delta]['#delta'];
   if (!empty($_FILES['files']['name'][$upload_name])) {
     $video_id = viddler_api_uploadvideo($_FILES['files']['tmp_name'][$upload_name]);
@@ -117,20 +117,20 @@ function viddler_upload_js($type_name, $field_name, $delta) {
       $field_form[$delta]['upload_video']['#suffix'] = '<div id="'. $field_form[$delta]['#id'] .'-upload_video-ahah-status" class="viddler_upload-ahah-wrapper status">The video has been uploaded successfully and will be saved once you save this form.</div>';
     }
     else{
-      $field_form[$delta]['upload_video']['#suffix'] = '<div id="'. $field_form[$delta]['#id'] .'-upload_video-ahah-status" class="viddler_upload-ahah-wrapper error">The video did not submit!</div>';      
+      $field_form[$delta]['upload_video']['#suffix'] = '<div id="'. $field_form[$delta]['#id'] .'-upload_video-ahah-status" class="viddler_upload-ahah-wrapper error">The video did not submit!</div>';
     }
   }
   else{
-        
+
     $button_prefix = $field_form[$delta]['#field_name'] .'_'. $field_form[$delta]['#delta'];
-    
+
     if ($field_form[$delta]['#post'][$button_prefix . '_viddler_remove']) {
       $field_form[$delta]['video_id']['#value'] = "";
       $field_form[$delta]['upload_video']['#suffix'] = '<div id="'. $field_form[$delta]['#id'] .'-upload_video-ahah-status" class="viddler_upload-ahah-wrapper status">Video removed from this post.</div>';
     }else
     if ($field_form[$delta]['#post'][$button_prefix . '_viddler_delete']) {
       if(variable_get('viddler_delete_allowed', '')  && user_access('delete video') ){
-      
+
         global $user;
         $video_id = $field_form[$delta]['#value']['video_id'];
         $result = viddler_api_deletevideo($video_id);
@@ -153,14 +153,14 @@ function viddler_upload_js($type_name, $field_name, $delta) {
       // remove or delete were not pressed so upload button was pressed with no file
       $field_form[$delta]['upload_video']['#suffix'] = '<div id="'. $field_form[$delta]['#id'] .'-upload_video-ahah-status" class="viddler_upload-ahah-wrapper error">Nothing to upload. Please select a file and then click on Upload.</div>';
   }
-  
+
   $output = theme('status_messages') . drupal_render($field_form[$delta]);
-    
+
   // AHAH is not being nice to us and doesn't know the "other" button (that is,
   // either "Upload" or "Delete") yet. Which in turn causes it not to attach
   // AHAH behaviours after replacing the element. So we need to tell it first.
   $javascript = drupal_add_js(NULL, NULL);
-  
+
   $viddler_ahah_settings = array();
   if (isset($javascript['setting'])) {
     foreach ($javascript['setting'] as $settings) {
@@ -178,7 +178,7 @@ function viddler_upload_js($type_name, $field_name, $delta) {
     // $output .= '<script type="text/javascript">jQuery.extend(Drupal.settings, '. drupal_to_js(call_user_func_array('array_merge_recursive', $viddler_ahah_settings)) .');</script>';
     $output .= '<script type="text/javascript">jQuery.extend(Drupal.settings, '. drupal_to_js($viddler_ahah_settings) .');</script>';
   }
-  
+
   //TODO: Check for if (!empty($_POST['js'])) { and redirect via drupal_goto to appropriate page
 
   // For some reason, file uploads don't like drupal_json() with its manual
@@ -209,6 +209,8 @@ function viddler_theme() {
       'arguments' => array('element' => NULL), ),
     'viddler_video_update_view_detail' => array(
       'arguments' => array('element' => NULL), ),
+    'viddler_video_video_html5' => array(
+      'arguments' => array('element' => NULL), ),
     'viddler_formatter_default' => array(
       'arguments' => array('element' => NULL), 'function' => 'theme_viddler_formatter_default'),
     'viddler_formatter_video_embed' => array(
@@ -221,6 +223,8 @@ function viddler_theme() {
       'arguments' => array('element' => NULL), 'function' => 'theme_viddler_formatter_video_thumbnail'),
     'viddler_formatter_video_update_view_detail' => array(
       'arguments' => array('element' => NULL), 'function' => 'theme_viddler_formatter_video_update_view_detail'),
+    'viddler_formatter_video_video_html5' => array(
+      'arguments' => array('element' => NULL), 'function' => 'theme_viddler_formatter_video_video_html5'),
   );
 }
 
@@ -280,7 +284,7 @@ function viddler_field_settings($op, $field) {
           '#description' => empty($field['allowed_values_php']) ? t("You're not allowed to input PHP code.") : t('This PHP code was set by an administrator and will override the allowed values list above.'),
         );
       }
-      
+
       return $form;
 
     case 'save':
@@ -336,16 +340,16 @@ function viddler_field($op, &$node, $field, &$items, $teaser, $page) {
         }
       }
       break;
-      
+
     case 'delete':
       // Only delete associated viddler video if variable is set on admin/content/viddler page and the user has the ability to remove the video.
       // The video gets removed from the viddler server.
       if(variable_get('viddler_delete_allowed', '')  && user_access('delete video') ){
-        
+
         // Node is being deleted; delete associated video data.
         if (is_array($items)) {
           foreach ($items as $delta => $item) {
-            global $user;        
+            global $user;
             $video_id = $items[$delta]['video_id'];
             $result = viddler_api_deletevideo($video_id);
             if($result){
@@ -375,7 +379,7 @@ function viddler_field($op, &$node, $field, &$items, $teaser, $page) {
       }
     break;
 
-    case 'validate':      
+    case 'validate':
       $allowed_values = content_allowed_values($field);
       if (is_array($items)) {
         foreach ($items as $delta => $item) {
@@ -448,6 +452,10 @@ function viddler_field_formatter_info() {
       'label' => t('Update View Detail'),
       'field types' => $types,
     ),
+    'video_video_html5' => array(
+      'label' => t('Flash with HTML5 fallback'),
+      'field types' => $types,
+    ),
   );
 }
 
@@ -471,9 +479,21 @@ function theme_viddler_formatter_video_video($element) {
 }
 
 /**
+ * Theme function for 'video_video_html5' formatter.
+ */
+function theme_viddler_formatter_video_video_html5($element) {
+  $field = content_fields($element['#field_name'], $element['#type_name']);
+  $width = $width ? $width : ($field['widget']['video_width'] ? $field['widget']['video_width'] : variable_get('viddler_default_video_width', VIDDLER_DEFAULT_VIDEO_WIDTH));
+  $height = $height ? $height : ($field['widget']['video_height'] ? $field['widget']['video_height'] : variable_get('viddler_default_video_height', VIDDLER_DEFAULT_VIDEO_HEIGHT));
+  $autoplay = $autoplay ? $autoplay : $field['widget']['video_autoplay'];
+  $id = $element['#item']['video_id'];
+  return viddler_api_video_gethtml5embed($id,'player',$width,$height,$autoplay,$options = false);
+}
+
+/**
  * Theme function for 'video_preview' formatter.
  */
-function theme_viddler_formatter_video_preview($element) {  
+function theme_viddler_formatter_video_preview($element) {
   $field = content_fields($element['#field_name'], $element['#type_name']);
   $width = $width ? $width : ($field['widget']['preview_width'] ? $field['widget']['preview_width'] : variable_get('viddler_default_preview_width', VIDDLER_DEFAULT_PREVIEW_WIDTH));
   $height = $height ? $height : ($field['widget']['preview_height'] ? $field['widget']['preview_height'] : variable_get('viddler_default_preview_height', VIDDLER_DEFAULT_PREVIEW_HEIGHT));
@@ -491,7 +511,7 @@ function theme_viddler_formatter_video_thumbnail($element) {
   $field = content_fields($element['#field_name'], $element['#type_name']);
   $thumbnail_url = viddler_api_getthumbnail($id);
   $link_title = $details['video']['title'];
-    
+
   if (!$thumbnail_url) {
     $default_thumbnail_url = $field['widget']['thumbnail_default_path'] ? $field['widget']['thumbnail_default_path'] : variable_get('viddler_default_thumbnail_path', NULL);
     if ($default_thumbnail_url) {
@@ -540,7 +560,7 @@ function theme_viddler_formatter_video_update_view_detail($element) {
   $node = $element['#node'];
   $fullnode = node_load($node->nid);
   if(viddler_api_updatedb($fullnode->uid, $node->nid, $id)){
-    $output = t("Video with id @id is updated", array('@id' => $id)); 
+    $output = t("Video with id @id is updated", array('@id' => $id));
   }
   else{
     $output = t("Video was not updated.");
@@ -556,14 +576,14 @@ function theme_viddler_formatter_video_embed($element) {
   $output = drupal_get_form('viddler_embed_form', $element);
   return $output;
 }
-   
+
 function viddler_embed_form($arg, $element) {
   $options = $element['#options'];
   $id = $element['#item']['video_id'];
   $text = viddler_api_video_getembed($id);
   $title = $title ? $title : t('Embed Code');
   $description = $description ? $description : t('To embed this video on your own site, simply copy and paste the html code from this text area.');
-  
+
   $form = array();
   $form['viddler_embed'] = array(
     '#type' => 'textarea',
@@ -628,7 +648,7 @@ function viddler_elements() {
       '#columns' => array('video_id'), '#delta' => 0,
       '#process' => array('viddler_process'),
       '#value_callback' => 'viddler_widget_value',
-    ),    
+    ),
   );
 }
 
@@ -685,17 +705,17 @@ function viddler_widget_settings($op, $widget) {
         '#collapsible' => TRUE,
         '#collapsed' => FALSE,
       );
-      $form['record']['record_webcam'] = array( 
+      $form['record']['record_webcam'] = array(
         '#type' => 'checkbox',
         '#title' => t('Record with Webcam'),
         '#default_value' => empty($widget['record_webcam']) ? variable_get('viddler_record_webcam', FALSE) : $widget['record_webcam'],
       );
-      $form['record']['record_webcam_hidden'] = array( 
+      $form['record']['record_webcam_hidden'] = array(
         '#type' => 'checkbox',
         '#title' => t('Hide Record with Webcam until button click'),
         '#default_value' => empty($widget['record_webcam_hidden']) ? variable_get('viddler_record_webcam_hidden', FALSE) : $widget['record_webcam_hidden'],
       );
-      $form['record']['upload_video'] = array( 
+      $form['record']['upload_video'] = array(
         '#type' => 'checkbox',
         '#title' => t('Upload a video'),
         '#default_value' => empty($widget['upload_video']) ? variable_get('viddler_upload_video', FALSE) : $widget['upload_video'],
@@ -711,28 +731,28 @@ function viddler_widget_settings($op, $widget) {
         '#description' => t('Your server supports upload progress capabilities. The "throbber" display does not indicate progress but takes up less room on the form, you may want to use it if you\'ll only be uploading small files or if experiencing problems with the progress bar.'),
         '#access' => viddler_progress_implementation(),
       );
-      $form['record']['remove_video'] = array( 
+      $form['record']['remove_video'] = array(
         '#type' => 'checkbox',
         '#title' => t('Show remove video button (with proper permissions)'),
         '#default_value' => empty($widget['remove_video']) ? variable_get('viddler_remove_video', FALSE) : $widget['remove_video'],
       );
-      $form['record']['delete_video'] = array( 
+      $form['record']['delete_video'] = array(
         '#type' => 'checkbox',
         '#title' => t('Show delete video button (with proper permissions)'),
         '#default_value' => empty($widget['delete_video']) ? variable_get('viddler_delete_video', FALSE) : $widget['delete_video'],
       );
-      $form['record']['vid_url'] = array( 
+      $form['record']['vid_url'] = array(
         '#type' => 'checkbox',
         '#title' => t('Input url'),
         '#default_value' => empty($widget['vid_url']) ? variable_get('viddler_vid_url', FALSE) : $widget['vid_url'],
       );
-      $form['record']['vid_id'] = array( 
+      $form['record']['vid_id'] = array(
         '#type' => 'checkbox',
         '#title' => t('Input id'),
         '#default_value' => empty($widget['vid_id']) ? variable_get('viddler_vid_id', FALSE) : $widget['vid_id'],
       );
-      
-            
+
+
       $width = variable_get('viddler_default_video_width', VIDDLER_DEFAULT_VIDEO_WIDTH);
       $height = variable_get('viddler_default_video_height', VIDDLER_DEFAULT_VIDEO_HEIGHT);
       $form['video'] = array(
@@ -845,7 +865,7 @@ function viddler_widget_settings($op, $widget) {
         form_set_error('thumbnail_height', t('"Thumbnail height" must be a positive integer.'));
       }
     break;
-    
+
     case 'save':
       $columns = array('record_webcam', 'record_webcam_hidden', 'upload_video', 'remove_video', 'delete_video', 'vid_url', 'vid_id', 'progress_indicator', 'video_width', 'video_height', 'video_autoplay', 'preview_width', 'preview_height', 'preview_autoplay', 'thumbnail_width', 'thumbnail_height', 'thumbnail_default_path', );
       return $columns;
@@ -865,10 +885,10 @@ function viddler_process($element, $edit, $form_state, $form) {
   $field = $form['#field_info'][$field_name];
   $field_key  = $element['#columns'][0];
   $delta = $element['#delta'];
-  
+
   // Show progress bar information
   drupal_add_js(drupal_get_path('module', 'viddler') .'/viddler.js');
-  
+
   // Only show video id text input on "Default value" form under manage fields in the content type area
   if($element['#name'] == "default_value_widget[" . $field_name. "][" . $delta. "]"){
     $element[$field_key] = array(
@@ -889,19 +909,19 @@ function viddler_process($element, $edit, $form_state, $form) {
     );
   }
   else {
-    
+
     $video_id_field_name = $element['#name'] . '[' .  $field_key . ']';
 
     if($field['widget']['record_webcam'] && user_access('record via webcam')){
       // Add viddler callback javascript if we are allowing recording via webcam http://developers.viddler.com/documentation/articles/howto-record/
 
       if($video_id_field_name){
-        drupal_add_js( 
+        drupal_add_js(
         'function recordDone(username,user_video_number,video_id) {
           // handle record data
           $("input[name=\'' . $video_id_field_name . '\']").val(video_id);
-        }', 
-        'inline' 
+        }',
+        'inline'
         );
       }
       if(!$element['#value'][$field_key] && !$field['widget']['record_webcam_hidden']){
@@ -938,7 +958,7 @@ function viddler_process($element, $edit, $form_state, $form) {
     if($field['widget']['upload_video'] && user_access('upload video')){
       if ($progress_indicator != 'throbber' && $implementation = viddler_progress_implementation()) {
         $upload_progress_key = md5(mt_rand());
-        
+
         if ($implementation == 'uploadprogress') {
           $element['UPLOAD_IDENTIFIER'] = array(
             '#type' => 'hidden',
@@ -954,7 +974,7 @@ function viddler_process($element, $edit, $form_state, $form) {
           );
         }
       }
-      
+
       $element['upload_video'] = array(
         '#name' => 'files['. $element['#field_name'] .'_'. $element['#delta'] .']',
         '#type' => 'file',
@@ -966,10 +986,10 @@ function viddler_process($element, $edit, $form_state, $form) {
         ),
         '#suffix' => '<div id="'. $element['#id'] .'-upload_video-ahah-status" class="viddler_upload-ahah-wrapper"></div>',
       );
-      
+
       $element['#prefix'] = '<div id="'. $element['#id'] .'-ahah-wrapper" class="viddler-ahah-wrapper">';
       $element['#suffix'] = '<br style="clear: both; "/></div>';
-      
+
       $element['upload_btn'] = array(
         '#type' => 'submit',
         '#value' => t('Upload Video'),
@@ -988,14 +1008,14 @@ function viddler_process($element, $edit, $form_state, $form) {
         // TODO: add validation for certain types of media to be uploaded
         // '#upload_validators' => $element['#upload_validators'],
       );
-            
+
       if ($progress_indicator != 'throbber' && $implementation = viddler_progress_implementation()) {
         // Add the upload progress callback.
         $element['upload_btn']['#ahah']['progress']['type'] = 'bar';
         $element['upload_btn']['#ahah']['progress']['path'] = 'viddler/progress/' . $upload_progress_key;
       }
     }
-    
+
     if($field['widget']['remove_video'] && user_access('remove video')){
       $element['remove_btn'] = array(
         // With default CCK edit forms, $element['#parents'] is array($element['#field_name'], $element['#delta']).
@@ -1017,7 +1037,7 @@ function viddler_process($element, $edit, $form_state, $form) {
         '#suffix' => '<br style="clear: both; "/>',
       );
     }
-    
+
     if($field['widget']['delete_video'] && user_access('delete video')){
       $element['delete_btn'] = array(
         // With default CCK edit forms, $element['#parents'] is array($element['#field_name'], $element['#delta']).
@@ -1039,7 +1059,7 @@ function viddler_process($element, $edit, $form_state, $form) {
         '#suffix' => '<br style="clear: both; "/>',
       );
     }
-    
+
     // Because the output of this field changes depending on the button clicked,
     // we need to ask FAPI immediately if the remove button was clicked.
     // It's not good that we call this private function, but
@@ -1048,13 +1068,13 @@ function viddler_process($element, $edit, $form_state, $form) {
     $removed = false;
     if (_form_button_was_clicked($element['remove_btn'])) {
       $removed = true;
-    }    
+    }
     $deleted = false;
     if (_form_button_was_clicked($element['delete_btn'])) {
       $deleted = true;
-    }    
-    
-              
+    }
+
+
     if($field['widget']['vid_url']){
         $element['url_id'] = array(
           '#type' => 'textfield',
@@ -1063,7 +1083,7 @@ function viddler_process($element, $edit, $form_state, $form) {
           '#attributes' => array('class' => 'viddler_url'),
           '#title' => 'Enter a url of a Viddler video',
           '#description' => 'Urls should start with http and look like this http://www.viddler.com/explore/username/videos/10/',
-        );   
+        );
       }
 
     // Show text field or hidden field based on widget setting
@@ -1110,7 +1130,7 @@ function viddler_process($element, $edit, $form_state, $form) {
     '#type' => 'value',
     '#value' => implode('][', array_merge($element['#parents'], array($field_key))),
   );
-  
+
   return $element;
 }
 
@@ -1147,11 +1167,11 @@ function theme_viddler($element) {
  * Implementation of hook_cron().
  */
 function viddler_cron(){
-  
+
   // TODO: - only update cron every 5 minutes to cut down on API calls
   //       - allow limit to be changed in settings?
   //       - query by modified time to only update oldest first
-  
+
   // check viddler_cron table and update any videos that need details to be updated.
   //  only grab 15 at a time to limit API calls
   $result = db_query("SELECT video_id, modified FROM {viddler_cron} ORDER BY `modified` ASC LIMIT 15");
@@ -1181,7 +1201,7 @@ function viddler_progress($key) {
       $progress['message'] = t('Uploading... (@current of @total)', array('@current' => format_size($status['bytes_uploaded']), '@total' => format_size($status['bytes_total'])));
       $progress['percentage'] = round(100 * $status['bytes_uploaded'] / $status['bytes_total']);
     }
-    
+
     if ($progress['percentage'] > 0) {
       $_SESSION['percent_save'] = $progress['percentage'];
     }
@@ -1224,7 +1244,7 @@ function viddler_progress_implementation() {
 /**
  * Views 2.x Specific Code
  */
- 
+
  /*
   * Implementation of hook_views_api().
   */
@@ -1362,7 +1382,7 @@ function viddler_progress_implementation() {
      'sort' => array(
       'handler' => 'views_handler_sort',
      ),
-     
+
    ),
    // 'tags' => array(
    //   'title' => t('Viddler Tags (serialized array)'),
@@ -1389,7 +1409,7 @@ function viddler_progress_implementation() {
      'field' => array(
        'handler' => 'views_handler_field',
      ),
-     
+
    ),
    'update_time' => array(
      'title' => t('Update Time'),
@@ -1422,12 +1442,12 @@ function viddler_progress_implementation() {
 //  * files in order to extend some of the classes
 //  *
 //  */
-// require_once(drupal_get_path('module', 'views') .'/includes/base.inc'); 
-// require_once(drupal_get_path('module', 'views') .'/includes/handlers.inc'); 
+// require_once(drupal_get_path('module', 'views') .'/includes/base.inc');
+// require_once(drupal_get_path('module', 'views') .'/includes/handlers.inc');
 // require_once(drupal_get_path('module', 'views') .'/handlers/views_handler_field.inc');
 // require_once(drupal_get_path('module', 'views') .'/handlers/views_handler_filter.inc');
 // require_once(drupal_get_path('module', 'views') .'/handlers/views_handler_filter_in_operator.inc');
-// 
+//
 // /*
 //  * Declaration of new field handler that extends the basic field handler of views module
 //  * We want to theme the thumbnail field ourselvs.
diff --git a/viddler_api.module b/viddler_api.module
index 8bf5631..e345761 100644
--- a/viddler_api.module
+++ b/viddler_api.module
@@ -57,7 +57,19 @@ function viddler_api_authenticate() {
 function viddler_api_video_getembed($id,$type = 'player',$width=437,$height=370,$autoplay = false,$options = false) {
   $phpviddlerclass = PHPVIDDLERCLASS;
   $viddler_connect = new $phpviddlerclass();
-  return $viddler_connect->video_getEmbed($id,'player',$width,$height,$autoplay,$options = false);  
+  return $viddler_connect->video_getEmbed($id,'player',$width,$height,$autoplay,$options = false);
+}
+
+/**
+ * Retrieve embed code for html5 video
+ *
+ * @var $id of video, $type of player, $width of video, $height of video, $autoplay, $options for flash player
+ * @return html of the video's embed code
+ */
+function viddler_api_video_gethtml5embed($id,$type = 'player',$width=437,$height=370,$autoplay = false,$options = false) {
+  $phpviddlerclass = PHPVIDDLERCLASS;
+  $viddler_connect = new $phpviddlerclass();
+  return $viddler_connect->video_gethtml5Embed($id,'player',$width,$height,$autoplay,$options = false);
 }
 
 /**
@@ -100,7 +112,7 @@ function viddler_api_gettoken() {
   $viddler_connect = new $phpviddlerclass();
   $viddler_connect->apiKey = $apikey;
   $viddler_session = viddler_api_authenticate();
-  
+
   if($viddler_session){
     try {
       $viddler_recordtoken = $viddler_connect->video_getrecordtoken($viddler_session);
@@ -127,7 +139,7 @@ function viddler_api_getrecordembed() {
   $apikey = variable_get('viddler_apikey', '');
   $viddler_connect->apiKey = $apikey;
   $viddler_session = viddler_api_authenticate();
-  
+
   if($viddler_session){
     try {
       $viddler_recordtoken = viddler_api_gettoken();
@@ -155,7 +167,7 @@ function viddler_api_deletevideo($id) {
     $result = db_query('DELETE FROM {viddler_videos} WHERE `video_id` = "%s";', $id);
     if($result){
       watchdog('viddler_api','Video was removed from the database with video id of @video_id.',array(
-        '@video_id' => $id));      
+        '@video_id' => $id));
     }
     // get viddler user
     $username = htmlentities(variable_get('viddler_username', ''));
@@ -179,9 +191,9 @@ function viddler_api_deletevideo($id) {
     else{
       watchdog('viddler_api','Video could not be deleted because the viddler_username @vidder_username did not match the videos username with video id of @id.',array(
         '@viddler_username' => $username, '@video_id' => $id));
-      if(variable_get('viddler_show_debug', ''))  
+      if(variable_get('viddler_show_debug', ''))
         drupal_set_message("Viddler API Delete Video Error: " . "Video could not be deleted because the viddler_username " . $username . " did not match the videos username (" . $details['author'] . ") with video id of " . $id, 'error');
-        
+
       return false;
     }
   }
@@ -267,7 +279,7 @@ function viddler_api_getstatus($id) {
 function viddler_api_updatedb($uid, $nid, $id) {
   // do not grab details if we are queued in cron
   if(!viddler_api_checkcron($id)){
-    $details = viddler_api_getdetails($id);    
+    $details = viddler_api_getdetails($id);
     if(isset($details->id)){
       $result = db_query('REPLACE INTO {viddler_videos} (
         `uid`,
@@ -354,10 +366,10 @@ function viddler_api_uploadvideo($filename = array()) {
   $viddler_connect = new $phpviddlerclass();
   $apikey = variable_get('viddler_apikey', '');
   $viddler_connect->apiKey = $apikey;
-  
+
   $viddler_session = viddler_api_authenticate();
   if($viddler_session){
-    
+
     // TODO: Pass title, description, tags, etc from drupal to viddler.
     $filearray = array(
       // "api_key" => $apikey,
@@ -368,7 +380,7 @@ function viddler_api_uploadvideo($filename = array()) {
       "make_public" => "1",
       "file" => $filename,
       );
-      
+
     // ## phpviddler.php now does the rest check in the video_upload function ##
     // Make sure we get best possible upload server
     // $rest = viddler_api_prepareupload();
@@ -409,7 +421,7 @@ function viddler_api_prepareupload(){
   $viddler_connect = new $phpviddlerclass();
   $apikey = variable_get('viddler_apikey', '');
   $viddler_connect->apiKey = $apikey;
-  
+
   $viddler_session = viddler_api_authenticate();
   if($viddler_session){
     $rest = $viddler_connect->video_prepareupload($viddler_session);
@@ -476,7 +488,7 @@ function viddler_api_updatecron($id, $op = 'update') {
         }
         else{
           return false;
-        }      
+        }
         break;
     }
     }
@@ -513,9 +525,9 @@ function viddler_api_setdetails($details = array()) {
   $viddler_connect = new $phpviddlerclass();
   $apikey = variable_get('viddler_apikey', '');
   $viddler_connect->apiKey = $apikey;
-  
+
   $viddler_session = viddler_api_authenticate();
-  if($viddler_session){    
+  if($viddler_session){
     try {
       $detailsarray = $viddler_connect->video_setdetails($details);
       if($detailsarray['video']){
