var CoviEmbedHtml = '' +
'
' +
'
' +
'
' +
'
' +
'
' +
'
' +
'
' +
'
' +
'
' +
// '
' +
'
' +
'' +
'더 알아보기 >
';
var CoviNativeItemsMapping = {
"title": "covi_title"
// "body_copy": "covi_bodycopy",
// "+ad_identity": {
// "native-element": "covi_adidentity",
// "value": "SPONSORED"
// }
};
var CoviNativeElements = {
"covi_player": {
"className": "covi_player"
},
"covi_playback": {
"className": "covi_playback"
},
"covi_playback-bg": {
"className": "covi_playback-bg"
},
"covi_playback_muteunmute": {
"className": "covi_playback_muteunmute",
"eventFunc": "onMuteUnmute"
},
"covi_playback_mute-img": {
"className": "covi_playback_mute-img",
"src": "mute_30x29.png"
},
"covi_playback_unmute-img": {
"className": "covi_playback_unmute-img",
"src": "unmute_28x28.png"
},
"covi_playback_seek": {
"className": "covi_playback_seek",
"eventFunc": "onSeek"
},
"covi_playback_currenttime": {
"className": "covi_playback_currenttime"
},
"covi_playback_durationtime": {
"className": "covi_playback_durationtime"
},
"covi_playback_playpause": {
"className": "covi_playback_playpause",
"eventFunc": "onPlayPause"
},
"covi_playback_play-img": {
"className": "covi_playback_play-img",
"src": "play_46x46.png"
},
"covi_playback_pause-img": {
"className": "covi_playback_pause-img",
"src": "pause_46x46.png"
},
"covi_title": {
"type": "p",
"className": "covi_title"
}
// "covi_bodycopy": {
// "type": "p",
// "className": "kt2"
// },
// "covi_adidentity-container": {
// "className": "covi_adidentity-container"
// },
// "covi_adidentity": {
// "type": "p",
// "className": "covi_adidentity"
// }
};
var CoviIndex = 0;
var Coviplayers = new Array();
function createCovi(no) {
if (typeof no === 'undefined') {
var urlObj = new URL(location.href);
var urlQuery = CoviUtil.parseQuery(urlObj.search.substr(1));
if (urlQuery) {
var no = urlQuery.no;
}
}
var newsViewElem = document.getElementsByClassName('news_view')[0];
var topElem = newsViewElem.getElementsByClassName('top')[CoviIndex];
var elem = topElem.querySelector('.wrap .center');
var coviElem = document.createElement('div');
coviElem.className = 'covi';
coviElem.setAttribute('covi-index', CoviIndex);
elem.appendChild(coviElem);
var coviOpts = {
'containerClassName': 'covi,'+CoviIndex,
'style': 'motortrendkorea_style',
'type': 'prod',
'pcode': 'motortrend',
'category': 'vehicle_motortrend',
'videoPlayType': 'autoplay',
'gender': '',
'age': '',
'idx': CoviIndex,
'rootElem': coviElem
};
// 이벤트 핸들러 설정
var coviEventHandler = function(event) {
switch (event) {
// 비디오 재생이 시작될 때 호출됩니다.
case 'PLAYER_VIDEO_PLAY':
break;
// 비디오 재생이 일시중지되었을 때 호출됩니다.
case 'PLAYER_VIDEO_PAUSE':
break;
// 비디오 재생이 완료되었을 때 호출됩니다.
case 'PLAYER_VIDEO_ENDED':
break;
}
};
// SDK 실행
var coviplayer = new CoviPlayer(coviOpts, coviEventHandler);
coviplayer.run();
Coviplayers[CoviIndex] = coviplayer;
++CoviIndex;
}
window.addEventListener('DOMContentLoaded', function() {
createCovi();
});
function coviClickLandingButton(coviIndex) {
var coviplayer = Coviplayers[coviIndex];
if (coviplayer) {
var landingUrl;
coviplayer.onClickLandingButton(function(url) {
landingUrl = url;
}, true);
var timer = window.setInterval(function() {
if (landingUrl !== 'undefined') {
window.clearInterval(timer);
var coviPopup = window.open(landingUrl, '_blank');
}
}, 200);
}
}