<p>Worked it out - just needed to use the right syntax, for example:</p>

<pre><code>{% set embed = craft.videoEmbedder.getEmbedUrl(entry.videoEmbed) %}

{% if embed | length %}
&lt;div class="embed-responsive embed-responsive--mb-l embed-responsive-16by9"&gt;&lt;iframe src="{{ embed }}" width="100%" height="600" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen&gt;&lt;/iframe&gt;&lt;/div&gt;
{% endif %}
</code></pre>

CC BY-SA 4.0
2018-07-05T13:49:01.930Z
2018-07-05T13:49:01.930Z
MGX
<p>Unfortunately, it has causes a big PHP error if 'empty'...If you don’t have any content (i.e. it’s an optional field for someone to add a video embed to the page and the user chooses not to embed a video) it triggers a big PHP error:</p>

<pre><code>Embed\Exceptions\InvalidUrlException

&lt;url&gt; malformed
</code></pre>

CC BY-SA 4.0
2018-07-11T15:37:49.610Z
2018-07-11T15:37:49.610Z
MGX
<p>In the example from the documentation on Craft 3 '<strong>Video Embedder</strong>' plugin:</p>

<pre><code>{% set embed = craft.videoEmbedder.getEmbedUrl('https://www.youtube.com/watch?v=6xWpo5Dn254') %}

{% if embed | length %}
    &lt;iframe src="{{ embed }}"&gt;&lt;/iframe&gt;
{% endif %}
</code></pre>

<p>Can someone please give me full (i.e. total beginner!) instructions on how to get the URL to load. </p>

<plugins><embed>
Embedding video using Craft 3 'Video Embedder' plugin
# Embedding video using Craft 3 'Video Embedder' plugin

(Asked by: username_0 on 2018-07-05)

In the example from the documentation on Craft 3 'Video Embedder' plugin:
{% set embed = craft.videoEmbedder.getEmbedUrl('https://www.youtube.com/watch?v=6xWpo5Dn254') %}

{% if embed | length %}
    
{% endif %}

Can someone please give me full (i.e. total beginner!) instructions on how to get the URL to load.

**Tags:** plugins, embed


---

## 2 answers

### Answer by username_0 on 2018-07-05. Score: 1

Worked it out - just needed to use the right syntax, for example:
{% set embed = craft.videoEmbedder.getEmbedUrl(entry.videoEmbed) %}

{% if embed | length %}

{% endif %}


---

### Answer by username_0 on 2018-07-11. Score: 1

Unfortunately, it has causes a big PHP error if 'empty'...If you don’t have any content (i.e. it’s an optional field for someone to add a video embed to the page and the user chooses not to embed a video) it triggers a big PHP error:
Embed\Exceptions\InvalidUrlException

 malformed


---

