<?php
wp_enqueue_script('videojs',get_template_directory_uri().'/static/js/video.js');

$my_post_video_options=get_post_meta(get_the_ID(),'my_post_video_options',1);
$post_has_video = ! empty($my_post_video_options['video_url']) ? true : false;
?>
<div class="card-item b-r-4 ceo-background-default ceo-overflow-hidden ceo-vip-icons">
    <?php if(_ceo('ceo_cat_viptb') == true ): ?>
        <?php if(get_post_meta(get_the_ID(),'member_down',1)!=1){?>
        <span class="meta-vip-tag"></span>
        <?php }?>
    <?php endif; ?>

    <?php
        $img_w=_ceo('thumbnail-px')['width'];
        $img_h=_ceo('thumbnail-px')['height'];
        $style_w_h='';
    if(!empty($category = get_queried_object())){
        $category_id=$category->term_id;
        $thumbnail_custom = get_term_meta($category_id, 'thumbnail_px_custom', 'true');
        if(!empty($thumbnail_custom) && !empty($thumbnail_custom['height'])){
            $img_w = ! empty($thumbnail_custom['width']) ? $thumbnail_custom['width'] : '';
            $img_h = ! empty($thumbnail_custom['height']) ? $thumbnail_custom['height'] : '';
            $style_w_h = 'height:'.$img_h.'px';
        }
    }
    ?>
    <div class="ceo_app_img">
    	<a href="<?php the_permalink(); ?>" <?php echo _target_blank();?> class="ceo-cardvideo-loop post-video ceo-display-block ceo-overflow-hidden <?php if($post_has_video)echo 'post-has-video ' ?>">
            <?php
                if(!empty($my_post_video_options['video_url'])){
                    echo '<span class="play-icon"></span>';
                    echo '<video autoplay="autoplay" loop="loop" data-src="'.$my_post_video_options['video_url'].'" src="" style="display: none;"></video>';
                }
            ?>
    	    <img src="<?php echo post_thumbnail_src($img_w,$img_h); ?>" alt="<?php the_title(); ?>" class="ceo-width-1-1@s show-image" >
    	</a>
	</div>
    <?php

    ?>
    <div class="ceo-padding-remove">
        <?php if(_ceo('ceo_cat_title') == true ): ?>
        <div class="ceo-music-cat-title card-title-desc">
            <a href="<?php the_permalink(); ?>" <?php echo _target_blank();?> class="title ceo-display-block" title="<?php the_title(); ?>">
                <?php if (is_sticky()): ?><i class="ceo-tops iconfont icon-brand-fill"></i><?php endif; ?><?php the_title(); ?>
            </a>
        </div>
        <?php endif; ?>
    </div>
</div>
