-
window media 제어 스크립트Web Program/Other 2008. 5. 20. 09:41
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>미디어플레이어 테스트</title>
</head>
<body>
<table>
<tr height="500">
<td width="700">
<OBJECT ID="Player" CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" width="325" height="315">
<PARAM name="URL" value="mms://mmc.daumcast.net/mmc/1/500/0902600000101h.wmv">
</object>
<!--
<object id="Player" classid="CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95" width="100%" height="100%" align="center">
<param name="Filename" value="mms://navernews.hvod.nefficient.co.kr/navernews/0001/2005/1113/00098638.wmv">
</object>
-->
</td>
</tr>
</table><input type="button" value="1번" onclick="javascript:setURL(1)">
<input type="button" value="2번" onclick="javascript:setURL(2)">
<input type="button" value="3번" onclick="javascript:setURL(3)">
<br/>볼륨 :
<input type="button" value="volume +10" onclick="setVol('+')">
<input type="button" value="volume -10" onclick="setVol('-')">
<input type="button" value="최소" onclick="setVol(0)">
<input type="button" value="최대" onclick="setVol(100)">
mute <input type="checkbox" onclick="mute(this.checked)">
<br><input type="button" value="처음" onclick="setPos(0)">
<input type="button" value="마지막" onclick="setPos(-1)">
<input type="button" value="10초 전" onclick="addPos(-10)">
<input type="button" value="10초 뒤" onclick="addPos(10)">
<input type="button" value="100 프레임 전" onclick="addPosFrame(-100)">
<input type="button" value="100 프레임 뒤" onclick="addPosFrame(100)">
<br><input type="button" value="재생" onclick="Player.controls.play();">
<input type="button" value="정지" onclick="Player.controls.stop();">
<input type="button" value="일시정지" onclick="Player.controls.pause();">
<input type="button" value="빨리감기" onclick="Player.controls.fastForward()">
<input type="button" value="되감기" onclick="Player.controls.fastReverse()">
<br/><input type="button" value="정상" onclick="resize(0)">
<input type="button" value="절반" onclick="resize(1)">
<input type="button" value="두배" onclick="resize(2)">
<input type="button" value="전체화면" onclick="resize(3)">
<br/><select onchange="setUI(this.options[this.selectedIndex].value)">
<option value="invisible">invisible</option>
<option value="none">none</option>
<option value="mini">mini</option>
<option value="full">full</option>
</select>
<br>
</body>
</html><SCRIPT LANGUAGE="JavaScript">
<!--
function setUI(str)
{
Player.uiMode = str;
}
function setPos(v)
{
if (v < 0) {
Player.controls.currentPosition = 0;
} else if (v > Player.currentMedia.duration) {
Player.controls.currentPosition = Player.currentMedia.duration;
} else {
Player.controls.currentPosition = v;
}
}
function setPosFrame(v)
{
var fps = Player.network.encodedFrameRate;
if (v < 0) {
Player.controls.currentPosition = 0;
} else if (v < 0) {
Player.controls.currentPosition = Player.currentMedia.duration;
} else {
Player.controls.currentPosition = v / fps;
}
}
function addPosFrame(v)
{
var fps = Player.network.encodedFrameRate;
Player.controls.currentPosition += v / fps;
}
function addPos(v)
{
Player.controls.currentPosition += v;
}
function setVol(flag)
{
/* flag : 0 ~ 100 */
if(flag == '+')
Player.settings.volume += 10;
else if(flag == '-')
Player.settings.volume -= 10;
else
Player.settings.volume = flag;
}function mute(stat)
{
if(stat)
Player.settings.mute = true;
else
Player.settings.mute = false;
}
function resize(no)
{
var width = Player.currentMedia.imageSourceWidth;
var height = Player.currentMedia.imageSourceHeight;
var width_ctrl = 5;
var height_ctrl = 75;
Player.stretchToFit = 'true';
if (no == 0) {
Player.width = width + width_ctrl;
Player.height = height + height_ctrl;
} else if (no == 1) {
Player.width = 0.5 * width + width_ctrl;
Player.height = 0.5 * height + height_ctrl;
} else if (no == 2) {
Player.width = 2 * width + width_ctrl;
Player.height = 2 * height + height_ctrl;
} else if (no == 3) {
Player.fullScreen = 'true';
}
}
function setURL(no) {
if (no == 1) {
Player.URL = "mms://mmc.daumcast.net/mmc/1/500/0902600000101h.wmv";
} else if (no == 2) {
Player.URL = "mms://navernews.hvod.nefficient.co.kr/navernews/0001/2005/1113/00098638.wmv";
} else {
Player.URL = "http://asx.kbs.co.kr/kbspod_sat.php?url=sat$legend$030506.asf&title=애니멘터리한국설화&starttime=&endtime=";
}
}
//-->
</SCRIPT>
<SCRIPT FOR="Player" EVENT="buffering(Start)">
var idTimer;
if(Start == true)
{
idTimer = setInterval("setStatus()", 1000);
}
else
{
clearInterval(idTimer);
}
</SCRIPT>
<SCRIPT FOR="Player" EVENT="StatusChange()">
window.status = Player.status;</SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
<!--
function setStatus()
{
var bf = parseInt(Player.network.bufferingProgress);
if(bf < 100)
{
window.status = "버퍼링 중 : " + bf + " %";
}
else
{
window.status = "버퍼링 완료";
}
}//-->
</SCRIPT>
참고 :
<속성값 변경>
document.getElementById("플레이어ID").setAttribute("속성Name", "값");
추가사항:
<script type="text/javascript" src="/js/prototype.js"></script>
<object classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" id="Player" width="300" height="45">
<PARAM name="FileName" value="/data/music/04 Back For Good .mp3">
</object>
<script type="text/javascript">
function stop(){
$("Player").stop();
}function play(){
$("Player").play();
}function pause(){
$("Player").pause();
}function CurrentPosition(){
alert($("CurrentPosition").CurrentPosition());
}function Duration(){
$("Player").Duration();
}
</script>
<input type="button" onClick="stop();" value="stop">
<input type="button" onClick="play();" value="play">
<input type="button" onClick="pause();" value="pause">
<input type="button" onClick="CurrentPosition();" value="CurrentPosition">'Web Program > Other' 카테고리의 다른 글
IIS6 HTTP Compression (0) 2010.07.21 High Performance Web Site 규칙 (0) 2010.04.15 Ajax[fckeditor 사용시..] (0) 2008.12.31 유용한 사이트 모음 (0) 2007.10.13 fckeditor사용법[ASP] (0) 2007.10.13