/**
  * Retrieve the collection items from duplicable slides.
  *
  * @return void
  */
 protected function retrieveSlides()
 {
     if ($this->_id == 0) {
         return;
     }
     global $_wp_additional_image_sizes;
     $items = thb_duplicable_get($this->_key, $this->_id);
     foreach ($items as $item) {
         $type = isset($item['meta']['subtemplate']) && $item['meta']['subtemplate'] == 'add_image' ? 'image' : 'video';
         $id = isset($item['value']['id']) ? $item['value']['id'] : 0;
         $url = isset($item['value']['url']) ? $item['value']['url'] : '';
         $caption = isset($item['value']['caption']) ? $item['value']['caption'] : '';
         if ($type == 'video' && thb_video_is_selfhosted($url)) {
             $type = 'video-selfhosted';
         }
         $autoplay = isset($item['value']['autoplay']) ? $item['value']['autoplay'] : '0';
         $loop = isset($item['value']['loop']) ? $item['value']['loop'] : '0';
         $poster = '';
         $orginal_poster_img = false;
         if ($type == 'image') {
             $thumb = thb_image_get_size($id, $this->_thumbSize);
         } else {
             $poster_width = $_wp_additional_image_sizes[$this->_thumbSize]['width'];
             $poster_height = $_wp_additional_image_sizes[$this->_thumbSize]['height'];
             $thumb = '';
             $poster = $item['value']['poster'];
             if (!empty($poster)) {
                 $orginal_poster_img = true;
                 $thumb = thb_custom_resource('frontend/resizeImage');
                 $thumb .= '&id=' . $poster;
                 $thumb .= '&w=' . $poster_width;
                 $thumb .= '&h=' . $poster_height;
             } else {
                 $thumb = thb_get_video_thumbnail($url, $this->_posterSize);
                 $poster = $thumb;
                 if (empty($thumb)) {
                     $thumb = THB_ADMIN_CSS_URL . '/i/video.png';
                 }
             }
         }
         $this->_slides[] = array('post_id' => $this->_id, 'id' => $id, 'url' => $type == 'image' ? thb_image_get_size($id, $this->_size) : $url, 'full' => $type == 'image' ? thb_image_get_size($id, 'full') : $url, 'thumb' => $thumb, 'poster' => $poster, 'poster_custom' => $orginal_poster_img, 'caption' => $caption, 'type' => $type, 'autoplay' => $autoplay, 'loop' => $loop, 'link' => thb_image_get_size($id, 'full'));
     }
 }
<?php

$preview = '';
if (!empty($field_value_url)) {
    $preview = thb_get_video_thumbnail($field_value_url, 'thumbnail_small');
    $previewClass = '';
}
if ($preview == '') {
    $preview = THB_ADMIN_CSS_URL . '/i/video.png';
    $previewClass = 'video';
}
?>

<img src="<?php 
echo $preview;
?>
" class="thb-preview <?php 
echo $previewClass;
?>
" alt="video preview">

<div class="thb-field-row">
	<span class="thb-additional-label"><?php 
_e('Video URL', 'thb_text_domain');
?>
</span><input type="text" name="<?php 
echo $field_name_url;
?>
" value="<?php 
echo $field_value_url;
?>