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 $formats = array( 'all' => array( 'mp4', 'webm', 'ogv', 'youtube', 'vimeo' ), 'default' => array( 'mp4', 'webm', 'ogv' ), 'youtube' => array( 'youtube' ), 'vimeo' => array( 'vimeo' ) ); $sources = array(); if ( ! empty( $post_meta ) ) { $formats = $formats[ $post_meta['type'][0] ]; } else { $formats = $formats['all']; } foreach ( $formats as $format ) { if ( ! empty( $post_meta ) ) { $src = ! empty( $post_meta[ $format ][0] ) ? $post_meta[ $format ][0] : ''; } else { $src = isset( $_GET[ $format ] ) ? sanitize_text_field( $_GET[ $format ] ) : ''; } if ( ! empty( $src ) ) { $mime = "video/{$format}"; $sources[] = array( 'type' => $mime, 'src' => $src ); } } $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 ); ?>