var VodPlayList = {}; //동영상 플레이어 테그 삽입 function fnVodPlay(vod_id, options) { if (vod_id) { //뉴스용 플레이어입니다. Jucode의 앞 두자리로 비교해서 분기문 처리 해서 방송, 제보쪽 작업 진행하셔야 할듯... // GetVod는 news도메인에 있는 뉴스DB를 조회하게 되니 이쪽으로 id넘겨봐야 데이타 없어요. if (vod_id.substring(0, 2) == "NV") { fnVodPlayNews(vod_id, options); } // WIZARD에서 동영상 보기 if (vod_id.substring(0, 2) == "VO") { fnVodPlayWizard(vod_id, options); } } } function fnVodPlayNews(vod_id, options) { // 기본 옵션 var default_options = { width: 480, height: 299, image: "", userid: "", ad_presn: "", ad_postsn: "", ad_vt: "N" }; // param으로 들어온 옵션을 기본 옵션과 병합 var opts = jQuery.extend({}, default_options, options); var device_info = "W" if (typeof (mobile_device_detect) == "function") { device_info = mobile_device_detect(); } $.getJSON("http://article.joinsmsn.com/news/jtbc/get_vod_jsondata.asp?callback=?&vodid=" + vod_id +"&m="+ device_info, function (data) { if (data != null && data != {}) { var params = {}; params.width = opts.width; params.height = opts.height; params.flashplayer = "http://fs.jtbc.co.kr/common/ctl/player/player.swf"; params.skin = "http://fs.jtbc.co.kr/common/ctl/player/glow.zip"; /* option으로 이미지정보가 들어오는 경우 동영상 썸네일 이미지를 그것으로 대체, 기본은 동영상에 연결된 섬네일로 보임 */ if (opts.image != "") { params.image = opts.image; } else { params.image = data.img_url; } if (!data.file_url) { return; /* 동영상 파일정보 없음 */ } if (typeof(data.file_url) != "undefined" && data.file_url.indexOf("rtmp://") > -1) { arr_file_url = data.file_url.split("mp4:"); var file = arr_file_url[arr_file_url.length - 1]; params.provider = "rtmp"; params.streamer = arr_file_url[0]; params.file = escape("mp4:" + file); } else { params.file = data.file_url; params.provider = data.file_url.substring(0, 4); } if ($("#div_" + vod_id).length > 0) { if (device_info == "W") { var so = new SWFObject(params.flashplayer, 'player_' + vod_id, params.width, params.height, '9', '#000000'); so.addParam('allowfullscreen', 'true'); so.addParam('allowscriptaccess', 'always'); so.addParam('wmode', 'opaque'); so.addVariable('stretching', 'fill'); // so.addVariable('icons','false'); so.addVariable('provider', params.provider); // Protocol(고정) so.addVariable('streamer', params.streamer); // VOD URL Path so.addVariable('file', params.file); // VOD URL 중 파일명 so.addVariable('image', params.image); // Thumbnail Image URL - VOD에 따라 변경 so.addVariable('skin', params.skin); if (opts.ad_presn != "" || opts.ad_postsn != "") { // 광고 연결 var ad_url = 'http://dgate.jtbc.co.kr/xc.aspx?presn=' + opts.ad_presn + '&postsn=' + opts.ad_postsn + '&vt=' + opts.ad_vt; so.addVariable('plugins', 'adtvideo'); // AD Plugin(고정) so.addVariable('adtvideo.config', ad_url); // AD 정보 XML 파일 URL if (typeof (console) == "object") { console.log("load ad : " + ad_url); } } so.addVariable('controlbar', 'bottom'); so.write("div_" + vod_id); if ($("#player_" + vod_id).length > 0) { VodPlayList[vod_id] = "false"; // Play Log if (jwplayer && jwplayer('player_' + vod_id)) { jwplayer('player_' + vod_id).onPlay(function () { if (VodPlayList[vod_id] == "false") { VodPlayList[vod_id] = "true"; // 최초 1회만 로그카운트 기록 수행 if (typeof (fnLogCounter) == "function") { fnLogCounter(vod_id, data.vod_section, opts.userid); } } }); } } } // end of Web else if (device_info == "M" || device_info == "P") { $("#div_" + vod_id).html(""); // Video Tag용 Play Log VodPlayList[vod_id] = "false"; $("#player_" + vod_id).bind("play", function () { if (VodPlayList[vod_id] == "false") { VodPlayList[vod_id] = "true"; if (typeof (fnLogCounter) == "function") { fnLogCounter(vod_id, data.vod_section, opts.userid); } } }); } } // end of check "div_"+ vod_id area } }); // end of getJson } function fnVodPlayWizard(vod_id, options) { // 기본 옵션 var default_options = { width: 480, height: 299, adsn: "14" }; // param으로 들어온 옵션을 기본 옵션과 병합 var opts = jQuery.extend({}, default_options, options); var device_info = "W" if (typeof (mobile_device_detect) == "function") { device_info = mobile_device_detect(); } $.getJSON("http://article.joinsmsn.com/news/jtbc/get_vod_jsondata.asp?callback=?&vodid=" + vod_id +"&m="+ device_info, function (data) { if (data != null && data != {}) { var params = {}; params.width = opts.width; params.height = opts.height; params.image = data.img_url; if (typeof(data.file_url) != "undefined" && data.file_url.indexOf("rtmp://") > -1) { arr_file_url = data.file_url.split("mp4:"); var file = arr_file_url[arr_file_url.length - 1]; params.provider = "rtmp"; params.streamer = arr_file_url[0]; params.file = escape("mp4:" + file); } else { params.file = data.file_url; params.provider = "http" } if ($("#mediaspace").length > 0) { if (device_info == "W") { if (params.file == "") { $('#mediaspace').html(""); } else { params.flashplayer = "http://fs.jtbc.co.kr/common/ctl/player/player.swf"; params.skin = "http://fs.jtbc.co.kr/common/ctl/player/glow.zip"; var so = new SWFObject(params.flashplayer, 'ply', params.width, params.height, '9', '#000000'); so.addParam('allowfullscreen', 'true'); so.addParam('allowscriptaccess', 'always'); so.addParam('wmode', 'opaque'); so.addVariable('stretching', 'fill'); // so.addVariable('icons','false'); so.addVariable('provider', params.provider); // Protocol(고정) so.addVariable('streamer', params.streamer); // VOD URL Path so.addVariable('file', params.file); // VOD URL 중 파일명 so.addVariable('image', params.image); // Thumbnail Image URL - VOD에 따라 변경 so.addVariable('skin', params.skin); if (opts.adsn != "") { // 스킨 파일 URL so.addVariable('plugins', 'adtvideo'); // AD Plugin(고정) so.addVariable('adtvideo.config', 'http://dgate.jtbc.co.kr/xc.aspx?presn=' + opts.adsn + '&postsn=&vt=N'); // AD 정보 XML 파일 URL } // AD 정보 XML 파일 URL - 광고 없으면 삭제 so.addVariable('controlbar', 'bottom'); so.write("mediaspace"); if (jwplayer('ply') != null) { jwplayer('ply').onPlay(function () { if (typeof (jwplayer_onPlay) != 'undefined') jwplayer_onPlay(); }); jwplayer('ply').onComplete(function () { if (typeof (jwplayer_onComplete) != 'undefined') jwplayer_onComplete(); }); } } } // end of web player else if (device_info == "M" || device_info == "P") { // Molbile Player 처리 if (data.mobile_file_url == "") { $('#mediaspace').html(""); } else { $("#mediaspace").html(""); // Video Tag용 Play Log VodPlayList[vod_id] = "false"; $("#ply").bind("play", function () { if (VodPlayList[vod_id] == "false") { if (typeof (jwplayer_onPlay) == "function") { jwplayer_onPlay(); VodPlayList[vod_id] = "true"; } } }); } } } } }); // end of getJson }