//================================================================================================================================== // 플레이 진행바 //================================================================================================================================== //================================================================================================================================== // 플레이어 슬라이드바 클릭 드레그 조절 스크립트 //================================================================================================================================== var moveWidth = 108; // slidebar 처리를 위한 변수(volume, progress bar) var wmpSlideStat = false; // POSITION 처리를 위한 변수 var volSlideStat = false; function PlaySlide_Jump_Click(){ //if(MediaPlayer.PlayState != 2) return; var iDuration, iMove; iMove = event.clientX - 108; //gapPosition; 이벤트 클릭시 이동 위치 if (iMove<=0) iMove=0; if (iMove>moveWidth-1) iMove = moveWidth - 1; iDuration = MediaPlayer.Duration ; MediaPlayer.currentPosition = Math.floor(Math.round(iMove * iDuration / moveWidth)); PlaySlide_show(); } function PlaySlide_show() { var iPosition,iDuration, iMove; if( wmpSlideStat== true ) return; try { iPosition = Math.round(MediaPlayer.currentPosition *10)/10; iDuration = Math.round(MediaPlayer.Duration * 10) / 10 iMove = Math.round(iPosition * moveWidth / iDuration * 10)/10; if(iMove > moveWidth) return; if(iMove <= 1) iMove = 0; PlaySlide_Bar.style.pixelLeft = iMove + 0 ; PlaySlide_Go.style.width = iMove; } catch (e) { return; } } function PlaySlide_Bar_DragIng() { if (wmpSlideStat==true) { var iMove ; var iMoveWidth ; iMove = event.clientX - 108 ; iMoveWidth = iMove; if (iMove <= 0 ) iMove=1; if (iMoveWidth <= 0 ) iMoveWidth = 1; if( iMove> moveWidth-1) iMoveWidth = moveWidth - 1; PlaySlide_Go.style.width = iMoveWidth ; MediaPlayer.currentPosition = iMove * MediaPlayer.Duration / moveWidth ; return false; } } function PlaySlide_Bar_DragEnd() // PlaySlide의 DRAG를 종료 한다. { if( wmpSlideStat == true ) { var iMove = event.clientX - 108 ; // 4 : 마우스위치와 이미지위치 보정 평균값 var iMoveWidth = iMove ; if (iMove <=0 ) iMove=0; if( iMove> moveWidth-1) iMoveWidth = moveWidth - 1 ; MediaPlayer.currentPosition = (iMoveWidth) * MediaPlayer.Duration / moveWidth ; MediaPlayer.play(); wmpSlideStat = false; PlaySlide_show(); } } function PlaySlide_Bar_DragBegin() // Drag Start(mouse click) { wmpSlideStat = true; MediaPlayer.pause(); document.onmouseup = PlaySlide_Bar_DragEnd; document.onmousemove = PlaySlide_Bar_DragIng; } //================================================================================================================================== // 볼륨 슬라이드바 클릭 드레그 조절 스크립트 //================================================================================================================================== function mpMute() { if(MediaPlayer.mute == true) { document.MuteImage.src = "/Web-home/admin_content/images/detailplayer/volum_on.gif"; MediaPlayer.mute = false; } else { document.MuteImage.src = "/Web-home/admin_content/images/detailplayer/volum_off.gif"; MediaPlayer.mute = true; } } function VolumeSlide_Jump_Click() { //alert(event.clientX); if(MediaPlayer.mute == true) return; var pos = event.clientX; var iMove = pos - 250; if(iMove <=0) iMove = 0; if(iMove >47) iMove=47; MediaPlayer.volume = (iMove)* 2000/140-1700; VolumeSlide_Go.style.width = iMove; } function Volume_Move(vol) { if(MediaPlayer.mute == true) return; var iMove = parseInt((MediaPlayer.volume+1700)*140/2000);//+vol; var iMove = 47; if(iMove <=0) iMove = 0; if(iMove >47) iMove=47; MediaPlayer.volume = (iMove)* 2000/140-1700; VolumeSlide_Go.style.width = iMove; } function VolumeSlide_Bar_DragIng() { if (volSlideStat==true) { //기존 값 주석 //iMove= event.clientX - 360 ; // 4 : 마우스위치와 이미지위치 보정 평균값 iMove= event.clientX - 250 ; // 4 : 마우스위치와 이미지위치 보정 평균값 if(iMove<=0 ) iMove = 0; if(iMove >47) iMove = 47; VolumeSlide_Go.style.width = iMove; //alert(VolumeSlide_Go.style.width); MediaPlayer.volume = (iMove)* 2000/140-1700; return false; } } function VolumeSlide_Bar_DragEnd() // PlaySlide의 DRAG를 종료 한다. { if( volSlideStat == true ) { var iMove = event.clientX - 250 ; // 4 : 마우스위치와 이미지위치 보정 평균값 if(iMove<=0 ) iMove = 0; if(iMove >47) iMove = 47; MediaPlayer.volume = (iMove)* 2000/140-1700; volSlideStat = false; } } function VolumeSlide_Bar_DragBegin() // Drag Start(mouse click) { volSlideStat = true; document.onmouseup = VolumeSlide_Bar_DragEnd; document.onmousemove = VolumeSlide_Bar_DragIng; } //================================================================================================================================== // 플레이어 사이즈 조절 스크립트 //================================================================================================================================== isMaxed = false; function MediaPlayer_max(){ if(isMaxed==0) { //window.resizeTo( window.screen.availWidth, window.screen.availHeight); //window.moveTo(0,0); MediaPlayer.width = "380"; MediaPlayer.height = "260"; document.images['maxbutton'].src = "http://image.ebs.co.kr/portal/detailplayer/sample/btn_100.gif"; } else { MediaPlayer.width = "480"; MediaPlayer.height = "360"; document.images['maxbutton'].src = "http://image.ebs.co.kr/portal/detailplayer/sample/btn_200.gif"; } isMaxed = isMaxed?0:1 ; } function MediaPlayer_full() { /* if(MediaPlayer.PlayState == 0) { alert("stop 상태에서는 동작하지 않습니다."); return; } MediaPlayer.ShowControls = true; isFulled = true; MediaPlayer.DisplaySize = 3; */ } //================================================================================================================================== // 플레이어 재생/종료 스크립트 //================================================================================================================================== var isPaused = false; var isClosed = false; var isStop = false; //플레이/일시정지 function PlayPause() { if (isPaused) { document.images['playBut'].src='/Web-home/admin_content/images/detailplayer/btn_pause_off.gif'; MediaPlayer.Play(); } else { // document.images['playBut'].src='img/b_pause.gif'; MediaPlayer.Pause(); document.images['playBut'].src='/Web-home/admin_content/images/detailplayer/btn_play_off.gif'; } isPaused=!isPaused; isStop = false; } //플레이 stop function PlayStop(){ MediaPlayer.Stop(); document.images['stopBut'].src='/Web-home/admin_content/images/detailplayer/btn_stop_off.gif'; document.images['playBut'].src='/Web-home/admin_content/images/detailplayer/btn_play_off.gif'; isPaused = true; isStop = true; } //현재 플레이 위치 이동(30초/15초) function QuickMove(x){ MediaPlayer.currentposition = MediaPlayer.currentposition +x; } //================================================================================================================================== // 플레이 진행 시간 및 현 상태 관련 함수 //================================================================================================================================== var today = new Date(); var date = today.getDate(); var hours = today.getHours(); var minutes = today.getMinutes(); var seconds = today.getSeconds(); var serom =0; var plus_time = 0; function StateNotice(){ if(document.getElementById('MediaPlayer') == null) return; if(document.getElementById('MEDIAENDPOSITION') == null) return; if(document.getElementById('MEDIAPOSITION') == null) return; var sMediaState=""; var sDuration = time_display(parseInt(MediaPlayer.Duration)); //총플레이 시간 var iPosition = time_display(GetCurrentPos()); //미디어플레이어 현재 진행위치 시간 가져오기 switch(MediaPlayer.PlayState) { case 0 : sMediaState = "stop"; break; case 1 : sMediaState = "pause"; break; case 2 : sMediaState = "play"; plus_time = plus_time + 1; if(serom ==0) { diff = new Date(); seconds_diff = diff.getSeconds(); diff = seconds_diff-seconds; if(diff <0) diff +=60; if(diff <0) diff +=60; serom++ } break; case 3 : sMediaState = "buffering"; break; case 4 : sMediaState = "scan forward"; break; case 5 : sMediaState = "scan reverse"; break; case 6 : sMediaState = "waiting"; break; case 7 : sMediaState = "ended"; break; case 8 : sMediaState = "ready"; break; default : sMediaState = "close"; break; } MEDIASTATUS.innerHTML = sMediaState; // document.all.PlayerMessage.value = sMediaState; MEDIAPOSITION.innerHTML = iPosition; MEDIAENDPOSITION.innerHTML = sDuration; //0 mpStopped Playback is stopped. //1 mpPaused Playback is paused. //2 mpPlaying Stream is playing. //3 mpWaiting Waiting for stream to begin. //4 mpScanForward Stream is scanning forward. //5 mpScanReverse Stream is scanning in reverse. //6 mpSkipForward Skipping to next. //7 mpSkipReverse Skipping to previous. //8 mpClosed } //================================================================================================================================== // 시간 display 함수 //================================================================================================================================== function time_display(time) { var hh, mm, ss; ss = time%60; mm = ((time - ss)/60)%60; hh = parseInt(time/3600); if(hh < 10) { hh = "0" + hh; } if(mm < 10) { mm = "0" + mm; } if(ss < 10) { ss = "0" + ss; } return hh+":"+ mm+":" + ss; } //================================================================================================================================== // 미디어플레이어 현재 위치값 //================================================================================================================================== function GetCurrentPos(){ return parseInt(MediaPlayer.currentposition); } function SetCurrentPos(CurrTime) { MediaPlayer.currentposition = CurrTime; } //================================================================================================================================== // // 플레이어 이미지 RollOver // //================================================================================================================================== //================================================================================================================================== // 속도조절 관련 //================================================================================================================================== function OutDivSpeeder(){ var MRate = MagicSpeeder.GetRate(); for (i=1;i<9;i++){ document.images['sp_0'+i].src = "common/img/sp_no0"+i+"_none.gif" } switch(MRate){ case 0.5 : document.images['sp_01'].src = "common/img/sp_no01_press.gif"; break; case 0.9 : document.images['sp_02'].src = "common/img/sp_no02_press.gif"; break; case 1.0 : document.images['sp_03'].src = "common/img/sp_no03_press.gif"; break; case 1.2 : document.images['sp_04'].src = "common/img/sp_no04_press.gif"; break; case 1.4 : document.images['sp_05'].src = "common/img/sp_no05_press.gif"; break; case 1.6 : document.images['sp_06'].src = "common/img/sp_no06_press.gif"; break; case 1.8 : document.images['sp_07'].src = "common/img/sp_no07_press.gif"; break; case 2.0 : document.images['sp_08'].src = "common/img/sp_no08_press.gif"; break; default : document.images["sp_03"].src = "common/img/sp_no03_press.gif" ; } } //================================================================================================================================== // 항상위 //================================================================================================================================== function OutDivSetTop(){ if(isTop){ document.images['always'].src = "common/img/always_press.gif"; } } //================================================================================================================================== // 플레이 버튼 //================================================================================================================================== function OutDivPlay(){ if(isPaused){ document.images['btn_02'].src = "common/img/btn_03_press.gif"; } } function OutDivStop(){ if(isStop){ document.images['btn_04'].src = "common/img/btn_04_press.gif"; } }