I want to display the youtube video in card image with no black bars on top and bottom of it. Here is the code that I have for full card:
.media-video-container {
position: relative;
overflow: hidden;
}
.media-video-container img {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
<div class="list p-y">
<div class="item col-xs-12 col-sm-6 col-md-4 col-lg-3 video" *ngFor="let item of media">
<a class="block box card-item b-a media-item text-left" target="blank" href="{{item?.url}}" title="{{item?.name}}">
<span class="block clear img-card b-b b-light text-center media-video-container ">
<img class="h-auto h-full w-full" src="{{getMediaImageUrl(item)}}" alt="{{item?.name}}"/>
</span>
<div class="box-body p-y-sm">
<div class="block clear text-sm">
{{item?.name}}
</div>
</div>
<button *ngIf="item.type == 'video'" class="ytp-button ytp-large-play-button" aria-label="Play">
<svg height="100%" version="1.1" viewBox="0 0 68 48" width="100%">
<path class="ytp-large-play-button-bg" d="..."
fill="#212121" fill-opacity="0.8"></path>
<path d="M 45,24 27,14 27,34" fill="#fff"></path>
</svg>
</button>
</a>
</div>
</div>
I would really appreciate any help :)
NOTE: I have already tried:
Responsive fullscreen youtube video with no black bars?
Responsive video iframes (keeping aspect ratio), with only css?