<?php

function YMVI_insert_video( $content ){

    global $post;

    $post_source        = get_post_meta( $post->ID, 'partner', true );
    $current_theme      = wp_get_theme();
    $player_in_content  = xbox_get_field_value( 'ymvi-options', 'import-duration' );

    if( is_single() && $current_theme->get( 'Author' ) != 'WP-Script' && $post_source == 'youtube' && $player_in_content == 'on'){

        $embed = get_post_meta( $post->ID, 'embed', true );

        $player_position = xbox_get_field_value( 'ymvi-options', 'player-position' );
        
        if( $player_position == 'before' ){
            $content = $embed . $content;
        }else{
            $content = $content . $embed;
            
        }

    }

    return $content;
}

add_filter( 'the_content', 'YMVI_insert_video' );