title: How to get audio/video source WP REST API Fields?
body: <p>I'm using WP REST API V2 in my project. After sending Get request to get posts, I don't see fields with the source of my audio/video wordpress posts (youtube or soundcloud sources). </p>
  
  <p>I would like to know how to include source field of (audio and video posts) into my request results. If my post is an audio or video post:</p>
  
  <p><a href="https://i.stack.imgur.com/qJ54j.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qJ54j.png" alt="enter image description here"></a></p>
  
  <p>These posts have source field that can be set to soundcloud or youtube track url:</p>
  
  <p><a href="https://i.stack.imgur.com/OLOGo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OLOGo.png" alt="enter image description here"></a>
  <a href="https://i.stack.imgur.com/5bDJ3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5bDJ3.png" alt="enter image description here"></a></p>
  
  <p>I need to get these sources in the results of my get request. I have an idea that it should look similar to getting thumbnail url setting up a function to get a field in functions.php file , but I don't know how to set it and what function with which fields should it be to get source urls of audio and video posts. </p>
  
  <p>P.S. Example of getting thumbnail url function in functions.php file:</p>
  
  <pre><code>add_action( 'rest_api_init', 'ccw_insert_thumbnail_url' );
                  function ccw_insert_thumbnail_url() {
                      register_rest_field( 'post',
                          'ccw_thumbnail',
                          array(
                              'get_callback'    =&gt; 'ccw_get_thumbnail_url',
                              'update_callback' =&gt; null,
                              'schema'          =&gt; null,
                          )
                      );
                  }
  
              function ccw_get_thumbnail_url($post){
                  if(has_post_thumbnail($post['id'])){
                      $imgArray = wp_get_attachment_image_src( get_post_thumbnail_id( $post['id'] ), 'thumbnail' );
                      $imgURL = $imgArray[0];
                      return $imgURL;
                  }else{
                      return false;   
                  }
              }
  </code></pre>