<?php
include_once "../../mainfile.php";

class JwPlayer{
	var $image;
	var $file;
	var $skin;
	var $width;
	var $height;

	//建構函數
	function JwPlayer($file="",$image="",$width="",$height="",$skin=""){
		$this->width=(empty($width))?480:$width;
		$this->height=(empty($height))?360:$height;
		$this->file=$file;
		$this->image=$image;
		$this->skin=(empty($skin))?XOOPS_URL."/Frameworks/tadtools/mediaplayer/skin/beelden.zip":$skin;
	}

	//設定自定義設寬度
	function setWidth($width=""){
		$this->width=$width;
	}

	//設定自定義設高度
	function setHeight($height=""){
		$this->height=$height;
	}
	
	//設定自定義影片檔
	function setFile($file=""){
		$this->file=$file;
	}
	
	//設定自定義縮圖
	function setImage($image=""){
		$this->image=$image;
	}

	//設定自定佈景
	function setSkin($skin=""){
		$this->skin=$skin;
	}

	
	//產生播放器
	function render(){
    $player="
    <script type='text/javascript' src='".XOOPS_URL."/Frameworks/tadtools/mediaplayer/jwplayer.js'></script>
    <div id='container'>Loading the player ...</div>
    <script type='text/javascript'>
    jwplayer('container').setup({
    autostart: false,
    file: '{$this->file}',
    image: '{$this->image}',
    flashplayer: '".XOOPS_URL."/Frameworks/tadtools/mediaplayer/player.swf',
    volume: 80,
    width: {$this->width},
    height: {$this->height},
    skin: '{$this->skin}'
    });
    </script>";
    
    return $player;
  }

}
?>
