' + text + '
' +'
收起



直播倒计时
0 天 0 时 0 分 0 秒

收起
直播倒计时
0 天 0 时 0 分 0 秒
$('#videoCon').addClass("dplayer-hide-controller"); }, 3000); } }, 2500); var isMobile = !!navigator.userAgent.match(/AppleWebKit.*Mobile.*/); if (isMobile) { //全屏事件 dp.on('fullscreen', function () { screen.orientation.lock("landscape"); }); //退出全屏事件 dp.on('fullscreen_cancel', function () { screen.orientation.unlock(); }); } } } } share_summary = res.data.intro; if (share_summary && share_summary.indexOf('\n') != -1) { let html = '' let cnt = '' let arr = share_summary.split('\n') for (var i = 0; i < arr.length; i++) { let item = arr[i]; cnt += '
' + item + '
' } html = '
' $('.mainCon .articleCon').html(data.textIntro) } templateSDK.wx_share({ share_title: share_title, share_logo: share_logo, share_summary: share_summary }); // 微直播直播间装修 let styles=JSON.parse(res.data.appCustomParams).liveHouse.liveTheme; let stylebg1="https://pic.cmc.hebtv.com/0/0d91d6cfb98f5b206ac1e752757fc5a9/2024/11/13/03f61de0a17011ef85beca2361d0b397.png" let stylebg2="https://pic.cmc.hebtv.com/0/0d91d6cfb98f5b206ac1e752757fc5a9/2024/11/13/03f65ce2a17011ef85beca2361d0b397.png" let stylebg3="https://pic.cmc.hebtv.com/0/0d91d6cfb98f5b206ac1e752757fc5a9/2024/11/13/03fa83a8a17011ef85beca2361d0b397.png" let stylebg4="https://pic.cmc.hebtv.com/0/0d91d6cfb98f5b206ac1e752757fc5a9/2024/11/13/7fe37e7aa19811ef85beca2361d0b397.png" let backgroundImage = ''; if(styles){ if(styles === 'style0'){ }else{ if (styles === 'style1') { backgroundImage = stylebg1; } else if (styles === 'style2') { backgroundImage = stylebg2; } else if (styles === 'style3') { backgroundImage = stylebg3; }else{ backgroundImage = stylebg4; } if (backgroundImage) { $('body').css({ 'margin': '0', 'height': '100vh', 'background': 'url(' + backgroundImage + ') no-repeat center center fixed', 'background-size': 'cover', }); } $('*').css('color', 'white'); $('.navCon').css('background', 'none'); $('.comment').css('background', 'none'); $('#editWrap').css('color', 'white !important'); } } } } }) } // 加载图文直播 var livePage = 1, firstLive = true; $(function () { droploader = $('.mainCon').dropload({ scrollArea: window, domDown: { domNoData: '
', },
loadUpFn: function (me) {
if (navIndex == 1) {
livePage = 1;
getLiveFn(me)
} else if (navIndex == 2) {
commentPage = 1;
getCommentFn(droploader);
}
},
loadDownFn: function (me) {
// getLiveFn(me)
if (navIndex == 0) {
$('.mainCon .dropload-down, .mainCon .dropload-up').hide();
}
if (navIndex == 1) {
getLiveFn(me)
} else if (navIndex == 2) {
getCommentFn(me);
};
},
threshold: 70
})
})
var itemidx = -1
function getLiveFn(me) {
templateSDK.getLiveDetail({ articleId: articleId, pageNum: livePage, pageSize: 3 }, function (res) {
if (res.status = 200) {
const data = res.data;
let wwidth = window.innerWidth > 500 ? 500 : window.innerWidth
if (livePage === 1 && firstLive) {
firstLive = false;
}
if (data.total) {
var html = '';
for (var jj = 0; jj < data.lives.length; jj++) {
let item = data.lives[jj];
var text = '', imgs = '', videos = '';
if (item.type == 1 && item.imagepath) {
var imgArr = item.imagepath.split(',');
if (imgArr.length > 1) {
if (imgArr.length == 4 || imgArr.length == 2) {
for (var i = 0; i < imgArr.length; i++) {
let item = imgArr[i];
imgs += ''
}
} else {
for (var i = 0; i < imgArr.length; i++) {
let item = imgArr[i];
imgs += '
'
}
}
} else {
for (var i = 0; i < imgArr.length; i++) {
let item = imgArr[i];
imgs += '
'
}
}
}
if (item.type == 2) {
videos += '';
}
if (item.type == 5) {
text =`
${item.content.replace(/\n/g,"
")}
`;
} else {
text = item.content.replace(/\n/g,"
");
}
itemidx+=1
var mma = itemidx
let avatar = item.avatar || '';
html += ('
' + text + '
' +'' ); }; if (livePage === 1) { $('.liveConDom').html(html); conceal() } else { $('.liveConDom').append(html); conceal() } $('.liveConDom video').attr({ "x5-video-player-type": "h5", "x5-video-player-fullscreen": "true", "x5-video-orientation": "portrait" }) $('.liveConDom a').removeAttr('href'); // 是否还有更多 if (livePage > data.pageSum) { me.noData(); } } if (data.lives.length) { livePage++; me.resetload(); } else { me.resetload(); me.noData(); me.lock('down') } } else { me.noData() }; if (isWX()) { imginfo(); } }); } //修改选中的机位 function changeSeat(num) { clearInterval(timer) nowTimeNew = new Date(getLocalTime()).getTime(); let wwidth = window.innerWidth > 500 ? 500 : window.innerWidth liveNum = parseInt(num); $(".liveIcon").attr('src', 'https://web.cmc.hebtv.com/cms/rmt0336/share/dplayer/play.png'); $("#liveNum" + num + ' .liveIcon').attr('src', 'https://web.cmc.hebtv.com/cms/rmt0336/share/dplayer/playing.png'); $('.liveP').each((i, item) => { $(item).html($(item).text()); }) if($("#liveWord"+num).text().length>7){ $("#liveWord"+num).html('') } let data = liveMore[num]; console.log(data.status,'状态') if(liveMore[0].audioUrl){ $("#audio").get(0).play(); } if (data.status == "0" || data.status == "2") { setTime = new Date(data.liveSeatStartTime.replace(/\-/g, '/')).getTime(); endTime = new Date(data.liveSeatEndTime.replace(/\-/g, '/')).getTime(); let liveimgIcon =data.imagepath || "https://www.hebtv.com/public/img/noImg.jpg" if (setTime > nowTimeNew) { $(".time").show(); dp && dp.destroy() countDown(); timer=setInterval(countDown, 1000); let timeHtml='
直播倒计时
0天0时0分0秒
';
$('#videoCon').html(timeHtml).prepend('');
}
if (nowTimeNew >= endTime) {
dp && dp.destroy()
let timeHtml='
直播已结束
'+data.liveSeatEndTime+'
';
$('#videoCon').html(timeHtml).prepend('');
}
} else if (data.status == "3") {
document.addEventListener('fullscreenchange', function () {
updateWatermarkPosition(); // 更新水印位置
});
//Firefox
document.addEventListener('mozfullscreenchange', function () {
updateWatermarkPosition(); // 更新水印位置
});
//如Chrome和Safari
document.addEventListener('webkitfullscreenchange', function () {
updateWatermarkPosition(); // 更新水印位置
});
dp && dp.destroy()
if (!data.livePath && !data.playbackUrl) {
$('#videoCon').prepend('
');
} else {
$('#videoCon').css('height', wwidth / 16 * 9);
data.livePath = data.playbackUrl;
let playUrl=data.livePath;
if(data.livePath.indexOf('https://tv.pull.hebtv.com/')!=-1){
playUrl=linkToMd5(data);
}
dp = new DPlayer({
container: document.getElementById('videoCon'),
autoplay: false,
video: {
url: playUrl,
pic: data.imagepath,
}
});
dp.play();
dp.on('canplay', function () {
$('.dplayer-video').attr({ "x5-video-player-type": "h5", "x5-video-player-fullscreen": "true", "x5-video-orientation": "portrait"
});
});
dp.on('pause', function () {
console.log("多机位直播回看暂停上报",data)
let currentTime = dp.video.currentTime;
beaconPlay.onDirectUserAction('pause_play_video', {
content_type:"live_record",//视频所属内容的类型
content_id:data.articleId,//稿件id
content_title:data.title,//稿件标题
played_time:currentTime.toFixed(2),//播放的起始位置,默认为0
content_author_id:data.addUser,//内容的作者
current_page_title:data.title,//当前页名称
current_page_id:data.articleId,//当前页id
video_id:'',
segment_id:"",
segment_title:"",
segment_type:"",
block_position:"",
content_author_name:"",
});
//$(".liveIcon").attr('src', 'https://web.cmc.hebtv.com/cms/rmt0336/share/dplayer/play.png');
});
dp.on('error', function () {
// $("#liveNum" + liveNum + ' .liveIcon').attr('src', 'https://web.cmc.hebtv.com/cms/rmt0336/publicV2/imgs/huan.png');
});
var changeIsImage = false;
dp.on('play', function () {
$(".dplayer-notice").css("opacity", '0');
console.log("多机位回看播放上报")
//直播播放埋点
let currentTime = dp.video.currentTime;
beaconPlay.onDirectUserAction('play_video', {
content_type:"live_record",//视频所属内容的类型
content_id:data.articleId,//稿件id
content_title:data.title,//稿件标题
start_position:currentTime.toFixed(2),//播放的起始位置,默认为0
content_author_id:data.addUser,//内容的作者
current_page_title:data.title,//当前页名称
current_page_id:data.articleId,//当前页id
video_id:'',
segment_id:"",
segment_title:"",
segment_type:"",
block_position:"",
content_author_name:"",
});
//直播回看添加水印
if (!isImageAdded && data.watermarkImage) {
var positionStyles = {
'1': { top: '8%', left: '5%' },
'2': { top: '8%', right: '5%' },
'3': { bottom: '13%', left: '5%' },
'4': { bottom: '13%', right: '5%' }
};
var position = data.watermarkImagePosition || '1';
var styles = positionStyles[position];
if (styles) {
var newDiv = $('
');
newDiv.prepend('');
newDiv.css(styles);
$('.videoCon').append(newDiv);
isImageAdded = true;
}
}
if (liveNum) {
$(".liveIcon").attr('src', 'https://web.cmc.hebtv.com/cms/rmt0336/share/dplayer/play.png');
$("#liveNum" + liveNum + " .liveIcon").attr('src', 'https://web.cmc.hebtv.com/cms/rmt0336/share/dplayer/playing.png');
} else {
$(".liveIcon").attr('src', 'https://web.cmc.hebtv.com/cms/rmt0336/share/dplayer/play.png');
$('#liveNum0 .liveIcon').attr('src', 'https://web.cmc.hebtv.com/cms/rmt0336/share/dplayer/playing.png');
}
setTimeout(function () {
$('#videoCon').addClass("dplayer-hide-controller");
}, 3000);
});
setInterval(function () {
if ($("#videoCon").attr('class').indexOf('dplayer-playing') > 0 && $("#videoCon").attr('class').indexOf('dplayer-hide-controller') < 0) {
setTimeout(function () {
$('#videoCon').addClass("dplayer-hide-controller");
}, 3000);
}
}, 2500);
}
} else {
endTime = new Date(data.liveSeatEndTime.replace(/\-/g, '/')).getTime();
countDown();
timer=setInterval(countDown, 1000);
if (!data.livePath && !data.pclivePath) {
dp&&dp.destroy()
$('#videoCon').prepend('
');
} else {
if (offvr == 1) {
$('#videovr').html(`
直播倒计时
0 天 0 时 0 分 0 秒
`) $('#videovr').css('height', wwidth / 16 * 9); let playUrl=data.livePath; if(data.livePath.indexOf('https://tv.pull.hebtv.com/')!=-1){ playUrl=linkToMd5(data); } vrPlayer && vrPlayer.destroyPlayer(['videoCon']) vrPlayer = new CmnVRPlayer('videoCon', { autoplay: true, // 是否自动播放 选填 默认false muted: true, // 是否静音 选填 默认false poster: data.imagepath, // 封面图 选填 url: playUrl, // 视频/直播地址 必填 initVoice: 0, // 初始音量 选填 默认0.3 取值范围0-1 isOpenReturn: false, // 是否开启回正 选填 默认false isOpenGyro: false, // 是否开启陀螺仪 选填 默认true isOpenVRmode: false //为true的话 播放器右下角会出现VR分屏的按钮 }) }else{ document.addEventListener('fullscreenchange', function () { updateWatermarkPosition(); // 更新水印位置 }); //Firefox document.addEventListener('mozfullscreenchange', function () { updateWatermarkPosition(); // 更新水印位置 }); //如Chrome和Safari document.addEventListener('webkitfullscreenchange', function () { updateWatermarkPosition(); // 更新水印位置 }); dp&&dp.destroy() data.livePath = data.livePath ? data.livePath : data.pclivePath; //data.livePath=data.livePath?data.livePath:data.playbackUrl; $('#videoCon').css('height', wwidth / 16 * 9); let playUrl=data.livePath; if(data.livePath.indexOf('https://tv.pull.hebtv.com/')!=-1){ playUrl=linkToMd5(data); } dp = new DPlayer({ container: document.getElementById('videoCon'), autoplay: false, video: { url: playUrl, pic: data.imagepath, } }); dp.play(); dp.on('pause', function () { console.log("多机位直播暂停上报",data) let currentTime = dp.video.currentTime; beaconPlay.onDirectUserAction('pause_play_video', { content_type:"live_record",//视频所属内容的类型 content_id:data.articleId,//稿件id content_title:data.title,//稿件标题 played_time:currentTime.toFixed(2),//播放的起始位置,默认为0 content_author_id:data.addUser,//内容的作者 current_page_title:data.title,//当前页名称 current_page_id:data.articleId,//当前页id video_id:'', segment_id:"", segment_title:"", segment_type:"", block_position:"", content_author_name:"", //$(".liveIcon").attr('src', 'https://web.cmc.hebtv.com/cms/rmt0336/share/dplayer/play.png'); }); //$(".liveIcon").attr('src', 'https://web.cmc.hebtv.com/cms/rmt0336/share/dplayer/play.png'); }); dp.on('canplay', function () { if(liveMore[0].audioUrl){ $("#audio").get(0).play(); } $('.dplayer-video').attr({ "x5-video-player-type": "h5", "x5-video-player-fullscreen": "true", "x5-video-orientation": "portrait" }); }); $(".dplayer-bar-wrap").hide(); $(".dplayer-time").hide(); if(liveMore[0].audioUrl){ $("#audio").get(0).play(); } var changeIsImageTwo = false; dp.on('play', function () { console.log("多机位直播播放上报") //直播播放埋点 let currentTime = dp.video.currentTime; beaconPlay.onDirectUserAction('play_video', { content_type:"live_record",//视频所属内容的类型 content_id:data.articleId,//稿件id content_title:data.title,//稿件标题 start_position:currentTime.toFixed(2),//播放的起始位置,默认为0 content_author_id:data.addUser,//内容的作者 current_page_title:data.title,//当前页名称 current_page_id:data.articleId,//当前页id video_id:'', segment_id:"", segment_title:"", segment_type:"", block_position:"", content_author_name:"", }); //直播回看添加水印 if (!isImageAddedTwo && data.watermarkImage) { var positionStyles = { '1': { top: '8%', left: '5%' }, '2': { top: '8%', right: '5%' }, '3': { bottom: '13%', left: '5%' }, '4': { bottom: '13%', right: '5%' } }; var position = data.watermarkImagePosition || '1'; var styles = positionStyles[position]; if (styles) { var newDiv = $('
');
newDiv.prepend('');
newDiv.css(styles);
$('.videoCon').append(newDiv);
isImageAddedTwo = true;
}
}
if(liveMore[0].audioUrl){
$("#audio").get(0).play();
}
$(".dplayer-notice").css("opacity", '0');
if (liveNum) {
$(".liveIcon").attr('src', 'https://web.cmc.hebtv.com/cms/rmt0336/share/dplayer/play.png');
$("#liveNum" + liveNum + ' .liveIcon').attr('src', 'https://web.cmc.hebtv.com/cms/rmt0336/share/dplayer/playing.png');
} else {
$(".liveIcon").attr('src', 'https://web.cmc.hebtv.com/cms/rmt0336/share/dplayer/play.png');
$('#liveNum0 .liveIcon').attr('src', 'https://web.cmc.hebtv.com/cms/rmt0336/share/dplayer/playing.png');
}
setTimeout(function () {
$('#videoCon').addClass("dplayer-hide-controller");
}, 3000);
});
dp.on('error', function () {
console.log(liveNum);
// $("#liveNum" + liveNum + ' .liveIcon').attr('src', 'https://web.cmc.hebtv.com/cms/rmt0336/publicV2/imgs/huan.png');
});
setInterval(function () {
if ($("#videoCon").attr('class').indexOf('dplayer-playing') > 0 && $("#videoCon").attr('class').indexOf('dplayer-hide-controller') < 0) {
setTimeout(function () {
$('#videoCon').addClass("dplayer-hide-controller");
}, 3000);
}
}, 2500);
var isMobile = !!navigator.userAgent.match(/AppleWebKit.*Mobile.*/);
if (isMobile) {
//全屏事件
dp.on('fullscreen', function () {
screen.orientation.lock("landscape");
});
//退出全屏事件
dp.on('fullscreen_cancel', function () {
screen.orientation.unlock();
});
}
}
}
}
}
function conceal(){
var content = document.getElementsByClassName('webkit3')
for (var en = 0; en < content.length; en++) {
let dom = content[en]
let enn =en
if (dom.clientHeight < dom.scrollHeight ) {
$('.morebox').eq(enn).css("display", "block")
$('.morebox').eq(enn).attr('steta',"true")
}else{
$('.morebox').eq(enn).css("display", "none")
//$('.morebox').eq(enn).attr('steta',"flase")
}
if($('.morebox').eq(enn).attr('steta') == "true"){
$('.morebox').eq(enn).css("display", "block")
}
}
}
function showUp(idx) {
if ($(".fold").eq(idx).text() == "展开") {
$('.morebox').eq(idx).removeClass('more')
$('.webkit3').eq(idx).addClass('all_text')
$(".ellipsis").eq(idx).css("display", "none")
$(".fold").eq(idx).text("收起")
} else {
$('.morebox').eq(idx).addClass('more')
$('.webkit3').eq(idx).removeClass('all_text')
$(".ellipsis").eq(idx).css("display", "block")
$(".fold").eq(idx).text("展开")
}
}
let commentPage = 1;
function getCommentFn(me) {
templateSDK.getCommentList({ relaId: articleId, pageSize: 5, page: commentPage }, function (res) {
if (res && res.returnCode == '0000') {
var data = res.returnData, commentArr = data.commentList, html = '';
$('.liveComment .commentCount span').text(data.totalRecords);
var articleTitleColor = $('.articleTitle').css('color');
for (var i = 0; i < commentArr.length; i++) {
let item = commentArr[i];
var contentStyle = '';
if (articleTitleColor === 'rgb(255, 255, 255)') {
contentStyle = 'color: white;';
}
html += ('
' ); }; commentPage == 1 ? $('.comment').html(html) : $('.comment').append(html); if (commentPage >= data.pageCount) { me.noData(); } } commentArr.length && commentPage++; me.resetload(); }) } // 打开app $('body').on('click', '.launch', function () { templateSDK.openApp(); }) // 微信分享