0 ) { $post_meta = get_post_meta( $post_id ); } // Controls $controls = array(); $features = array( 'playpause', 'current', 'progress', 'duration', 'tracks', 'volume', 'fullscreen' ); foreach ( $features as $feature ) { if ( isset( $_GET[ $feature ] ) ) { if ( 1 == (int) $_GET[ $feature ] ) { $controls[] = $feature; } } else { if ( isset( $player_settings['controls'][ $feature ] ) ) { $controls[] = $feature; } } } $controls = apply_filters( 'aiovg_video_controls', $controls ); // Attributes $attributes = array(); if ( isset( $_GET['poster'] ) ) { $attributes['poster'] = $_GET['poster']; } elseif ( ! empty( $post_meta ) ) { $attributes['poster'] = aiovg_get_image_url( $post_meta['image_id'][0], 'large', $post_meta['image'][0], 'player' ); } if( ! empty( $attributes['poster'] ) ) { $attributes['poster'] = esc_url( $attributes['poster'] ); if ( false !== strpos( $attributes['poster'], 'youtube' ) ) { $attributes['poster'] = str_replace( array( 'https:', 'http:' ), '', $attributes['poster'] ); } } $autoplay = isset( $_GET['autoplay'] ) ? (int) $_GET['autoplay'] : $player_settings['autoplay']; if ( ! empty( $autoplay ) ) { $attributes['autoplay'] = true; } $loop = isset( $_GET['loop'] ) ? (int) $_GET['loop'] : $player_settings['loop']; if ( ! empty( $loop ) ) { $attributes['loop'] = true; } $attributes['preload'] = esc_attr( $player_settings['preload'] ); $attributes = apply_filters( 'aiovg_video_attributes', $attributes ); // Sources $types = array( 'all' => array( 'mp4', 'webm', 'ogv', 'youtube', 'vimeo', 'dailymotion', 'facebook' ), 'default' => array( 'mp4', 'webm', 'ogv' ), 'youtube' => array( 'youtube' ), 'vimeo' => array( 'vimeo' ), 'dailymotion' => array( 'dailymotion' ), 'facebook' => array( 'facebook' ) ); if ( ! empty( $post_meta ) ) { $types = array_key_exists( $post_meta['type'][0], $types ) ? $types[ $post_meta['type'][0] ] : array(); } else { $types = $types['all']; } $sources = array(); $formats = array(); foreach ( $types as $type ) { if ( ! empty( $post_meta ) ) { $src = ! empty( $post_meta[ $type ][0] ) ? $post_meta[ $type ][0] : ''; } else { $src = isset( $_GET[ $type ] ) ? sanitize_text_field( $_GET[ $type ] ) : ''; } if ( ! empty( $src ) ) { $mime = "video/{$type}"; $sources[] = array( 'type' => $mime, 'src' => $src ); $formats[] = $type; } } $sources = apply_filters( 'aiovg_video_sources', $sources ); // Tracks $tracks = array(); if ( in_array( 'tracks', $controls ) && ! empty( $post_meta['track'] ) ) { foreach ( $post_meta['track'] as $track ) { $tracks[] = unserialize( $track ); } } $tracks = apply_filters( 'aiovg_video_tracks', $tracks ); // Mobile $is_mobile = false; $use_native_controls = 0; if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/iPhone|iPod|iPad|BlackBerry|Android/', $_SERVER['HTTP_USER_AGENT'] ) ) { $is_mobile = true; } if ( $is_mobile ) { $attributes['autoplay'] = false; if ( in_array( 'youtube', $formats ) || in_array( 'vimeo', $formats ) || in_array( 'dailymotion', $formats ) || in_array( 'facebook', $formats ) ) { $attributes['poster'] = ''; $use_native_controls = 1; } } ?>