<?php /* Template Name: Homepage */ $popular = cltv_get_popular_channels(62); $video = cltv_format_video_src(of_get_option('front_page_video')); $channels = new WP_Query(array('post_type' => 'channel', 'meta_key' => 'state', 'orderby' => 'meta_value title', 'order' => 'ASC', 'posts_per_page' => -1, 'post__not_in' => array(8832, 19206, 4125, 28427, 28705), 'author__not_in' => array(454))); if (of_get_option('use_wowza_cdn')) { $wowza_base = of_get_option('wowza_cdn'); } else { $wowza_base = of_get_option('wowza_server'); } ?> <?php get_header(); ?> <div id="content" class="clearfix row-fluid"> <div class="span3 hidden-phone"> <div class="tab-content"> <?php //if($popular): ?> <div class="row-fluid tab-pane fade in active" id="popular-content"> <div class="span12"> <h2>Most Viewed (30 Days)</h2> <!--<ul class="media-list">--> <?php
</div><!-- /.container-fluid --> </nav> <div class="container-fluid"> <div class="row-fluid"> <div class="col-md-12"> <div class="page-header"> <h1>My Cameras</h1> </div> </div> </div> <div class="row"> <?php while ($channels->have_posts()) { $channels->the_post(); $src = cltv_format_video_src(get_field('stream_key'), true); ?> <div class="col-md-4"> <div class="panel panel-default"> <div class="panel-heading"><?php the_title(); ?> </div> <div class="panel-body"> <script src="http://jwpsrv.com/library/hskNKAMBEeOg6CIACusDuQ.js"></script> <script> $(document).ready(function(){ var android = /Android/i.test(navigator.userAgent); if(android && navigator.mimeTypes["application/x-shockwave-flash"] == undefined) { //$('#video').html($('#android').html()); } else {
function cltv_channel_video($id) { //default poster is the post's featured image $poster = wp_get_attachment_image_src(get_post_thumbnail_ID($id), 'full'); $poster = $poster[0]; $title = get_the_title($id); $filename = false; $live = false; $attachment_id = false; $youtube_url = false; //if showing a specific archive if (get_post_type($id) == 'archive') { $youtube_url = get_post_meta($id, 'youtube_url', true); if ($youtube_url) { $filename = $youtube_url; } else { $attachment_id = get_post_meta($id, 'video_file', true); $filename = wp_get_attachment_url(get_post_meta($id, 'video_file', true)); } $channel = get_post_meta($id, 'channel', true); } else { $channel = $id; //if showing live player if (get_field('is_live', $id)) { $filename = get_field('stream_key', $id); $live = true; } else { //default archive is set $default_archive = get_post_meta($id, 'default_archive', true); if ($default_archive) { $archive = $default_archive; } else { $archive_q = new WP_Query(array('post_type' => 'archive', 'meta_key' => 'channel', 'meta_value' => $id, 'posts_per_page' => 1)); if ($archive_q->have_posts()) { $archive = $archive_q->posts[0]->ID; } wp_reset_postdata(); } //found an archive if (isset($archive) && $archive) { $poster = wp_get_attachment_image_src(get_post_thumbnail_ID($archive), 'full'); $poster = $poster[0]; //if youtube video url $youtube_url = get_post_meta($archive, 'youtube_url', true); if ($youtube_url) { $filename = $youtube_url; } else { $attachment_id = get_post_meta($archive, 'video_file', true); $filename = basename(get_attached_file(get_post_meta($archive, 'video_file', true))); } $title = get_the_title($archive); } } } if ($filename) { $http = false; if ($youtube_url) { $src = array('html5' => $youtube_url, 'flash' => false); } else { $src = cltv_format_video_src($filename, $live, $http, $attachment_id, $channel); } $commercial_id = get_post_meta($id, 'commercial', true); $commercial = false; if ($commercial_id) { $commercial = get_post($commercial_id); if ($commercial) { $commercial_youtube_url = get_post_meta($commercial_id, 'youtube_url', true); if ($commercial_youtube_url) { $commercial = $commercial_youtube_url; } else { $attachment_id = get_post_meta($commercial->ID, 'commercial_video_file', true); $commercial = basename(get_field('commercial_video_file', $commercial->ID)); $commercial = cltv_format_video_src($commercial, false, $http, $attachment_id, $channel); } } } return array('src' => $src, 'poster' => $poster, 'title' => $title, 'commercial' => $commercial); } else { return false; } }