0 ) { $post_type = get_post_type( $post_id ); if ( 'aiovg_videos' == $post_type ) { $post_meta = get_post_meta( $post_id ); } } // Video 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(); $thirdparty_providers = 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 ); if ( 'youtube' === $type || 'vimeo' === $type || 'dailymotion' === $type || 'facebook' === $type ) { $thirdparty_providers[] = $type; } } } $sources = apply_filters( 'aiovg_video_sources', $sources ); // Video Attributes $attributes = array( 'id' => 'player', 'playsinline' => '' ); if ( ! wp_is_mobile() ) { $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'] ); 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'] ); } } $use_native_controls = 0; $show_privacy_consent = 0; if ( count( $thirdparty_providers ) > 0 ) { if ( wp_is_mobile() ) { $use_native_controls = 1; } if ( ! ( isset( $_COOKIE['aiovg_gdpr_consent'] ) || empty( $privacy_settings['show_consent'] ) || empty( $privacy_settings['consent_message'] ) || empty( $privacy_settings['consent_button_label'] ) ) ) { $use_native_controls = 0; $show_privacy_consent = 1; } } if ( 1 == $use_native_controls ) { $attributes['poster'] = ''; $attributes['controls'] = ''; } $attributes = apply_filters( 'aiovg_video_attributes', $attributes ); // Player Settings $features = array( 'playpause', 'current', 'progress', 'duration', 'tracks', 'volume', 'fullscreen' ); $controls = array( 'aiovg' ); foreach ( $features as $feature ) { if ( isset( $_GET[ $feature ] ) ) { if ( 1 == (int) $_GET[ $feature ] ) { $controls[] = $feature; } } else { if ( isset( $player_settings['controls'][ $feature ] ) ) { $controls[] = $feature; } } } $settings = array( 'pluginPath' => AIOVG_PLUGIN_URL . 'public/assets/mediaelement/', 'features' => $controls, 'iPadUseNativeControls' => $use_native_controls, 'iPhoneUseNativeControls' => $use_native_controls, 'AndroidUseNativeControls' => $use_native_controls, 'youtube' => array( 'showinfo' => 0, 'rel' => 0, 'iv_load_policy' => 3 ) ); $settings = apply_filters( 'aiovg_player_settings', $settings ); // Video Tracks $tracks = array(); if ( in_array( 'tracks', $settings['features'] ) && ! empty( $post_meta['track'] ) ) { foreach ( $post_meta['track'] as $track ) { $tracks[] = unserialize( $track ); } } $tracks = apply_filters( 'aiovg_video_tracks', $tracks ); ?>
0 ) : ?>