title: Magento 2 Add custom video "on the fly" to fotorama when selecting options and make the video auto-plays
body: <p>I'm trying to add a custom video to the Fotorama slider on the product page when selecting an option.
  the code below works but does not play the video when clicking the thumbnail.</p>
  <pre><code>galleryData.push({
     img: '&lt;img_url&gt;',
     thumb: 'thumb_url',
     video : '&lt;youtube_video_url&gt;',
     type:  'video',
     caption: 'Video caption'
   });
  
  $('div.product.media').html(&quot;&quot;);
            $('div.product.media').each(function (index, element) {
              gallery({
                  options: {
                      &quot;nav&quot;: &quot;thumbs&quot;,
                      &quot;thumbwidth&quot;: 88,
                      &quot;thumbheight&quot;: 110,
                      &quot;loop&quot;: 1,
                      &quot;arrows&quot;: 1,
                      &quot;navarrows&quot;: 1,
                      &quot;allowfullscreen&quot;: 1,
                      &quot;navtype&quot;: &quot;slides&quot;,
                      &quot;navdir&quot;: &quot;vertical&quot;,
                      &quot;width&quot;: 700,
                      &quot;height&quot;: 560,
                      &quot;transitionduration&quot;: 500
                  },
                  data:  galleryData,
                  fullscreen: {
                      &quot;nav&quot;: &quot;thumbs&quot;,
                      &quot;navdir&quot;: &quot;vertical&quot;,
                      &quot;navtype&quot;: &quot;slides&quot;,
                      &quot;arrows&quot;: 1,
                      &quot;loop&quot;: 1,
                      &quot;transition&quot;: &quot;slide&quot;,
                      &quot;transitionduration&quot;: 500,
                  },
                  &quot;breakpoints&quot;: {
                      &quot;Lesro&quot;: {
                          &quot;conditions&quot;: {
                              &quot;max-width&quot;: &quot;767px&quot;
                          },
                          &quot;options&quot;: {}
                      }
                  }
              }, element);
          });
  
  </code></pre>
  <p>Thanks a lot!</p>