videoamp-htmlamp-story

Can I use amp-video-container with amp-video in amp-story even if I am not using amp-carousel? What does amp-video-container do?


Is there detailed documentation on amp-video-container? I am trying to understand how I can use amp-video-container in amp-story to ensure my video is not cut off and viewable in full.

https://ampbyexample.com/advanced/video_carousels_with_amp-carousel/

  <div>
    <div class="amp-video-container">
      <amp-reach-player class="amp-video"
        data-embed-id="default"
        layout="responsive"
        width="560"
        height="315">
      </amp-reach-player>
    </div>
  </div>

Also, do I need to include this script tag when using amp-video-container?

<script async custom-element="amp-carousel" src="https://cdn.ampproject.org/v0/amp-carousel-0.1.js"></script>

Solution

  • If you want the full video to be shown, you can use CSS:

    amp-video video {
      object-fit: contain;
    }
    

    In the code snippet you've provided, there is nothing special about amp-video-container; it is simply a CSS class name. You do not need any additional scripts to use this CSS, and this is unrelated to amp-carousel.