| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Theme: Live Stream. |
| 5 |
* |
| 6 |
* @link https://plugins360.com |
| 7 |
* @since 1.6.4 |
| 8 |
* |
| 9 |
* @package Automatic_YouTube_Gallery |
| 10 |
*/ |
| 11 |
|
| 12 |
$player_width = ! empty( $attributes['player_width'] ) ? (int) $attributes['player_width'] . 'px' : '100%'; |
| 13 |
$player_ratio = ! empty( $attributes['player_ratio'] ) ? (float) $attributes['player_ratio'] : 56.25; |
| 14 |
|
| 15 |
$featured = $videos[0]; // Featured Video |
| 16 |
?> |
| 17 |
<div id="ayg-<?php echo esc_attr( $attributes['uid'] ); ?>" class="ayg ayg-theme ayg-theme-livestream"> |
| 18 |
<div class="ayg-player"> |
| 19 |
<div class="ayg-player-container" style="max-width: <?php echo $player_width; ?>;"> |
| 20 |
<?php |
| 21 |
$attributes['poster'] = sprintf( 'https://i.ytimg.com/vi/%s/0.jpg', esc_attr( $featured->id ) ); |
| 22 |
|
| 23 |
if ( isset( $featured->thumbnails->default ) ) { |
| 24 |
$attributes['poster'] = $featured->thumbnails->default->url; |
| 25 |
} |
| 26 |
|
| 27 |
if ( $player_ratio >= 170 ) { // Shorts / Vertical |
| 28 |
if ( isset( $featured->thumbnails->maxres ) ) { |
| 29 |
$attributes['poster'] = $featured->thumbnails->maxres->url; |
| 30 |
} elseif ( isset( $featured->thumbnails->medium ) ) { |
| 31 |
$attributes['poster'] = $featured->thumbnails->medium->url; |
| 32 |
} elseif ( isset( $featured->thumbnails->high ) ) { |
| 33 |
$attributes['poster'] = $featured->thumbnails->high->url; |
| 34 |
} |
| 35 |
} elseif ( $player_ratio >= 70 ) { // Classic 4:3 |
| 36 |
if ( isset( $featured->thumbnails->standard ) ) { |
| 37 |
$attributes['poster'] = $featured->thumbnails->standard->url; |
| 38 |
} elseif ( isset( $featured->thumbnails->high ) ) { |
| 39 |
$attributes['poster'] = $featured->thumbnails->high->url; |
| 40 |
} |
| 41 |
} else { // Standard 16:9 |
| 42 |
if ( isset( $featured->thumbnails->maxres ) ) { |
| 43 |
$attributes['poster'] = $featured->thumbnails->maxres->url; |
| 44 |
} elseif ( isset( $featured->thumbnails->medium ) ) { |
| 45 |
$attributes['poster'] = $featured->thumbnails->medium->url; |
| 46 |
} |
| 47 |
} |
| 48 |
|
| 49 |
the_ayg_player( $featured, $attributes ); |
| 50 |
?> |
| 51 |
</div> |
| 52 |
</div> |
| 53 |
</div> |
| 54 |
|