|
function setUrl(url)
{
if(url == ''){return '';}
//온에어 주소도 온다, 고로 mms://, rtsp://까지만 체크하자
if(/^mms:\/\//.test(url) || /^rtsp:\/\//.test(url)){
return 'http://news.kbs.co.kr/asx/vod.php?url='+url+'&kind=news';
//라디오 경로이다, http://asx.kbs.co.kr/어쩌구로 나가네..
}else if(/^http:\/\/asx\.kbs\.co\.kr\//.test(url)){
return 'http://news.kbs.co.kr/asx/vod.php?url='+url+'&kind=news';
//전체동영상 경로다, http://
}else if(/^http:\/\//.test(url)){
return url;
// more 경로이다, asx파일
}else if(/^\/asx\/data\/\S*\.asx$/.test(url)){
return url;
//스포츠
}else if(/^\/new_sports\//.test(url)){
return 'http://news.kbs.co.kr/asx/vod.php?url='+'rtsp://newsvod.kbs.co.kr/sportsvod' + url+'&kind=news';
//그외
}else{
return 'http://news.kbs.co.kr/asx/vod.php?url='+'rtsp://newsvod.kbs.co.kr/news' + url+'&kind=news';
}
}
// 유효한 classid 찾기 - ff에서 size 조절 가능 판단 위해
function getAvailableClsid()
{
return ('clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95'); //6.4
}
var myClsId = getAvailableClsid();
//alert('myClsId='+myClsId);
// player layer의 parent 객체 align 조정
var org_parentAlign = '';
function adjustPlayerParent(objPlayer, objAlign) {
if(!objPlayer){return;}
var objChild, objParent;
objChild = objPlayer;
while(1){
objParent = objChild.parentNode;
if(!objParent){break;}
//alert(objParent.nodeName);
if(objParent.nodeName.toLowerCase() == 'table'){break;}
objChild = objParent;
}
if(!objParent){return;}
if(org_parentAlign == ''){org_parentAlign = objParent.align;}
objParent.removeAttribute('style');
objParent.style.marginBottom = '5px';
if(objAlign == 'left'){
if(org_parentAlign == 'left'){
objParent.style.marginRight = '20px';
objParent.align = objAlign;
}else if(org_parentAlign == 'center'){
objParent.align = 'center';
}
}else{
objParent.align = objAlign;
}
//alert(objParent.nodeName+', parent align='+objParent.align+', margin='+objParent.style.margin);
}
//컨트롤 상태에 따라 layer 변경
function showPlayer(playerWidth, playerHeight, playerAlign) {
var objImage, objPlayer;
objImage = document.getElementById('divImage');
objPlayer = document.getElementById('divPlayer');
if(objImage){objImage.style.display = 'none';}
if(objPlayer){
if(playerHeight){objPlayer.height = playerHeight + (1*2) + (isIE?7:0);}
if(playerWidth){objPlayer.width = playerWidth + (1*2);}
if(playerAlign){
adjustPlayerParent(objPlayer, playerAlign);
}
objPlayer.style.display = 'block';
//alert('objPlayer='+objPlayer.width+'x'+objPlayer.height);
}
}
function hiddenPlayer() {
var objImage, objPlayer;
objImage = document.getElementById('divImage');
objPlayer = document.getElementById('divPlayer');
if(objPlayer){objPlayer.style.display = 'none';}
if(objImage){
adjustPlayerParent(objImage, 'left');
objImage.style.display = 'block';
}
// oldQuality
if(typeof oldQuality != 'undefined' && oldQuality != ''){
var obj = document.getElementById(oldQuality+'button');
if(obj){
obj.innerHTML = "" + getQualityName(oldQuality) +"";
}
oldQuality = '';
}
}
function deployVodArea()
{
var obj = document.getElementById('divMenu');
if(obj){
var menu_src = "";
if(typeof myClsId != 'boolean'){
menu_src = menu_src.concat("" + getQualityName('700k') + " ");
}
if(menu_src!=""){menu_src = menu_src.concat("");}
menu_src = menu_src.concat("" + getQualityName('300k') + " ");
if(menu_src!=""){menu_src = menu_src.concat("");}
menu_src = menu_src.concat("" + getQualityName('56k') + " ");
menu_src = ("").concat(menu_src);
obj.innerHTML = obj.innerHTML + menu_src;
}
}
//컨트롤 호출
var oldQuality; //700k, 300k, 56k 전환용
function displayVodPlayer(url, objWidth, objHeight, objAlign)
{
var objPlayerBox = document.getElementById('playerbox');
if(!objPlayerBox){return;}
showPlayer(objWidth, objHeight, objAlign);
var src = "");
objPlayerBox.innerHTML = src;
//alert(objPlayerBox.innerHTML);
}
function PlayVod(quality)
{
var vodWidth, vodHeight, vodAlign;
switch(quality){
case '56k': vodWidth = 320; vodHeight = 240; vodAlign = 'left'; break;
case '300k': vodWidth = 320; vodHeight = 240; vodAlign = 'left'; break;
case '700k': vodWidth = 480; vodHeight = 360; vodAlign = 'center'; break;
}
//alert(isIE+' ' + oldQuality+'->'+quality);
if(quality != oldQuality){
vodHeight += 45 + 24;
displayVodPlayer(setUrl(eval('fVOD'+quality)), vodWidth, vodHeight, vodAlign);
// oldQuality
var obj = document.getElementById(oldQuality+'button');
if(obj){
obj.innerHTML = "" + getQualityName(oldQuality) +"";
}
// quality
obj = document.getElementById(quality+'button');
if(obj){
obj.innerHTML = "" + getQualityName(quality) +"";
}
oldQuality = quality;
}
}
var fVOD56k = "L25ld3NwbGF6YV9wMS8yMDA5LzA1LzExLzE2MC5hc2Y=";
var fVOD300k = "L25ld3NwbGF6YV9wMS8yMDA5LzA1LzExLzMwMGsvMTYwLmFzZg==";
var fVOD700k = "L25ld3NwbGF6YV9wMS8yMDA5LzA1LzExLzcwMGsvMTYwLmFzZg==";
function resetUrl(url1, url2, url3)
{
fVOD56k = url1;
fVOD300k = url2;
fVOD700k = url3;
var obj;
if(fVOD700k){
obj = document.getElementById('700kbutton');
if(obj){
obj.innerHTML = "" + getQualityName('700k') + "";
}
}
if(fVOD300k){
obj = document.getElementById('300kbutton');
if(obj){
obj.innerHTML = "" + getQualityName('300k') + "";
}
}
if(fVOD56k){
obj = document.getElementById('56kbutton');
if(obj){
obj.innerHTML = "" + getQualityName('56k') + "";
}
}
}
var decode = new xhUrlDecode();
decode.doGet(fVOD56k, fVOD300k, fVOD700k, true);
// 기사면 UI 변경을 위한 추가 자바 함수 - 화질별 보여질 text 구하기
function getQualityName(str) {
var ret_str = "";
switch(str) {
case "700k" :
ret_str = "고화질"; break;
case "300k" :
ret_str = "표준화질"; break;
case "56k" :
ret_str = "저화질"; break;
}
return ret_str;
}
//플레이어 영역 배치 및 노출
deployVodArea();
|