$(function () {
var createvideoboxandplay = function(videohtml) {
$("body").append("
" + videohtml + "
");
let video = $("body").children(".videobox").find('.video')[0];
$(video).attr('playsinline','true');
$(video).attr('webkit-playsinline','true');
const player = new plyr(video);
if(video.paused == true){
video.play();
}else{
video.pause();
}
$("body > .videobox > .closevideo").click(function () {
$(this).parent().remove();
});
};
$(document).on('click', '.p_video .cover', function () {
var isnamevideo = $(".isname").prev().find(".s_list").children().children();
var isnameboxa = $(isnamevideo).is(".p_list");
if (isnameboxa) {
let videobox = $(this).next().html();
createvideoboxandplay(videobox);
}
});
$(document).on('click', ".p_rollslide", function () {
let videobox = $(this).find(".videobox").html();
createvideoboxandplay(videobox);
});
$('.videoibox').each(function(){
let videoimghref = $(this).find('.videoimg img').attr('src');
$(this).find('.coverimage img').attr('src',videoimghref);
});
});