jkoon
I was able to place the video above the content, but I had to edit one of the plugin files to get it to work, so it’s only a temporary fix until I find a better way.
In the file, fb-instant-articles/class-instant-articles-post.php, I added:
do_action( 'instant_articles_before_article_content', $this );
on line 674, right after
$document = apply_filters( 'instant_articles_parsed_document', $document );
.
Also, you have to specify the width and the height when adding the video, so my full functions.php code to add the video is:
use Facebook\InstantArticles\Elements\SocialEmbed;
function incl_video($ia_post) {
$instant_article = $ia_post->instant_article;
$post_id = $ia_post->get_the_id();
$iframe_string = get_post_meta( $post_id, 'video_embed_code', true );
if($iframe_string){
preg_match('/src="([^"]+)"/', $iframe_string, $match);
$video_url = $match[1];
$instant_article->addChild( SocialEmbed::create()->withSource($video_url)->withWidth(640)->withHeight(390) );
}
}
add_action( 'instant_articles_before_article_content', 'incl_video' );