I have a variable that stores an array, and in that array there is a YouTube url.
When I var dump
$node->field_video_link
It looks like the following:
array(1) { ["und"]=> array(1) { [0]=> array(5) { ["video_url"]=> string(43) "https://www.youtube.com/watch?v=SC9BgH_L29c" ["thumbnail_path"]=> string(61) "public://video_embed_field_thumbnails/youtube/SC9BgH_L29c.jpg" ["video_data"]=> string(34) "a:1:{s:7:"handler";s:7:"youtube";}" ["embed_code"]=> NULL ["description"]=> NULL } } }
Now, I want to use the video link as an iframe so that users can watch through the site and I did it like the following:
$sample1_video_link = (isset($node->field_video_link['und'])) ? file_create_url($node->field_video_link['und'][0]['video_url']) : '';
<iframe width="420" height="315"
src="<?php print $sample1_video_link; ?>">
</iframe>
When I go view the page, the video thumbnail does not appear, and instead, I see a message that says "www.youtube.com refused to establish connection"
However, if I grab a random URL from youtube, the iframe works.
The error looks like in the below image:
Anything I am possibly doing wrong?
EDITED:
I now use echo instead of print and when I reload the page, still the same error.
<iframe src="<?php echo $sample1_video_link; ?>"></iframe>
When I inspect the page, I see the following:
<iframe src="https://www.youtube.com/watch?v=SC9BgH_L29c"></iframe>
Which is apparently the same value being stored in the array.

file_create_urldo? I'm not familiar with that function