<div class="rh-video">
<video loop src="https://media.istockphoto.com/videos/in-the-hospital-midwife-gives-newborn-baby-to-a-mother-to-hold-video-id939010064" aria-label='Text som beskriver filmen'>Din webbläsare kan inte visa video</video>
</div>
<div class="{{name}}">
<video loop src="{{link}}" aria-label='Text som beskriver filmen'>Din webbläsare kan inte visa video</video>
</div>
{
"link": "https://media.istockphoto.com/videos/in-the-hospital-midwife-gives-newborn-baby-to-a-mother-to-hold-video-id939010064",
"name": "rh-video"
}
.rh-video {
position: relative;
video{
width: 100%;
}
.video-button {
position: absolute;
/* top: 35% !important;
left: 45% !important; */
top: 35%;
left: 45%;
width: 2.5em; //em(40);
height: 2.5em; //em(40);
box-sizing: border-box;
cursor: pointer;
background: $grey-base;
border-radius: 50%;
@include medium {
width: 5.625em; //em(90);
height: 5.625em; //em(90);
}
.video-button-content {
.feather {
color: $white;
float: left;
line-height: $line-height--small; //1;
margin-top: -0.5em;
padding-top: 50%;
text-align: center;
width: 100%;
//font-family:"feather" !important;
font-family: $icon--font-family;
font-size: $font-size--xl; //em(20);
@include medium { font-size: 3.125em;}
font-style:normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
}
}
.video-button.is-hidden {
display: none;
}
}
{
"name": "regionhalland/video",
"description": "video",
"type": "styleguide-molecule",
"license": "GPL-3.0",
"authors": [
{
"name": "Region Halland",
"email": "webbplatser@regionhalland.se"
}
],
"require": {}
}
var videoPlayButton,
videoWrapper = document.getElementsByClassName('rh-video')[0],
video = document.getElementsByTagName('video')[0],
videoMethods = {
renderVideoPlayButton: function() {
if (videoWrapper !== undefined && videoWrapper.contains(video)) {
this.formatVideoPlayButton();
video.classList.add('has-media-controls-hidden');
videoPlayButton = document.getElementsByClassName('video-button')[0];
videoPlayButton.addEventListener('click', this.hideVideoPlayButton);
}
},
formatVideoPlayButton: function() {
videoWrapper.insertAdjacentHTML('beforeend', '\
<div class="video-button"><div class="video-button-content"> <i class="feather icon-play"></i> </div></div>\
');
},
hideVideoPlayButton: function() {
video.play();
videoPlayButton.classList.add('is-hidden');
video.classList.remove('has-media-controls-hidden');
video.setAttribute('controls', 'controls');
}
};
videoMethods.renderVideoPlayButton();