Answers.Body: <p>I'm sure the documentation could be better, but this has nothing to do with Duct Video, it's simply a user error. Although a common one, when accessing things inside a matrix, assets field, or similar.</p>
  
  <p>When you do:</p>
  
  <pre><code>{% for video in entry.videos %}
  </code></pre>
  
  <p><code>video</code> is a matrix block. Not the field you've created inside that matrix blocktype. When accessing video.videoUrl, you get the an object of type Videos_VideoModel, same as when you add this field directly to an entry type. The correct way to do this (disregarding that videoUrl is a bad name for the video field) would be:</p>
  
  <pre><code>{% for block in entry.videos %}
    {% set video = block.videoUrl %}
    &lt;ul&gt;
      &lt;li&gt;title: {{ video.title }}&lt;/li&gt;
      &lt;li&gt;url: {{ video.url }}&lt;/li&gt;
      &lt;li&gt;embed: {{ video.embed({ width: 300, height: 200 }) }}&lt;/li&gt;
    &lt;/ul&gt;
  {% endfor %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-07-02T11:19:01.537Z
Answers.Text: Thanks for the detailed response. This is how I have it setup now and it works great
Answers.UserDisplayName: Bryan Garrant
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-07-01T14:53:02.927Z
Answers.LastActivityDate: 2015-07-02T10:12:08.980Z
Answers.LastEditDate: 2015-07-02T10:12:08.980Z
Answers.UserDisplayName: André Elvan
Body: <p>I have the plugin Dukt Videos installed to latest version 1.0.31.  I setup a Matrix block field with these settings:</p>
  
  <p>Field handle: videos
  Matrix Block handle: videoBlock
  Matrix Video Field: videoURL</p>
  
  <p>For some reason this will not work:</p>
  
  <pre><code>{% for video in entry.videos %}
      &lt;ul&gt;
          &lt;li&gt;title: {{ video.title }}&lt;/li&gt;
          &lt;li&gt;url: {{ video.url }}&lt;/li&gt;
          &lt;li&gt;embed: {{ video.embed({ width: 300, height: 200 }) }}&lt;/li&gt;
      &lt;/ul&gt;
  {% endfor %}
  </code></pre>
  
  <p>I get this error: Craft\MatrixBlockModel and its behaviors do not have a method or closure named "embed".</p>
  
  <p>When I try this it also does not work:</p>
  
  <pre><code>{% for blockMedia in entry.videos %}
      {{ blockMedia.videoUrl }}
  {% endfor %}
  </code></pre>
  
  <p>I get this error: Internal Server Error. Object of class Craft\Videos_VideoModel could not be converted to string</p>
  
  <p>What am I doing wrong with this Dukt Videos Plugin?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-07-01T14:36:35.613Z
Comments.Text: There is an example in the files that shows how to do this. Please update the online docs as this is an important part in the usage. Thanks.
Comments.UserDisplayName: Bryan Garrant
Tags: <plugin-duktvideos><plugin-duktoauth>
Title: I can't get Dukt Videos working in a Matrix field?
ThreadText: # I can't get Dukt Videos working in a Matrix field?
  
  (Asked by: username_0 on 2015-07-01)
  
  I have the plugin Dukt Videos installed to latest version 1.0.31. I setup a Matrix block field with these settings:
  
  Field handle: videos
  Matrix Block handle: videoBlock
  Matrix Video Field: videoURL
  
  For some reason this will not work:
  
  ```
  {% for video in entry.videos %}
      <ul>
          <li>title: {{ video.title }}</li>
          <li>url: {{ video.url }}</li>
          <li>embed: {{ video.embed({ width: 300, height: 200 }) }}</li>
      </ul>
  {% endfor %}
  
  ```
  
  I get this error: Craft\MatrixBlockModel and its behaviors do not have a method or closure named "embed".
  
  When I try this it also does not work:
  
  ```
  {% for blockMedia in entry.videos %}
      {{ blockMedia.videoUrl }}
  {% endfor %}
  
  ```
  
  I get this error: Internal Server Error. Object of class Craft\Videos\_VideoModel could not be converted to string
  
  What am I doing wrong with this Dukt Videos Plugin?
  
  **Tags:** plugin-duktvideos, plugin-duktoauth
  
  > **Comments:**
  > **username_0**: There is an example in the files that shows how to do this. Please update the online docs as this is an important part in the usage. Thanks.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-07-01. Score: 3
  
  I'm sure the documentation could be better, but this has nothing to do with Duct Video, it's simply a user error. Although a common one, when accessing things inside a matrix, assets field, or similar.
  
  When you do:
  
  ```
  {% for video in entry.videos %}
  
  ```
  
  `video` is a matrix block. Not the field you've created inside that matrix blocktype. When accessing video.videoUrl, you get the an object of type Videos\_VideoModel, same as when you add this field directly to an entry type. The correct way to do this (disregarding that videoUrl is a bad name for the video field) would be:
  
  ```
  {% for block in entry.videos %}
    {% set video = block.videoUrl %}
    <ul>
      <li>title: {{ video.title }}</li>
      <li>url: {{ video.url }}</li>
      <li>embed: {{ video.embed({ width: 300, height: 200 }) }}</li>
    </ul>
  {% endfor %}
  
  ```
  
  > **Comments:**
  > **username_0**: Thanks for the detailed response. This is how I have it setup now and it works great  
  
  ---
  
  