public function OSMPlayer::__construct in MediaFront 7
Same name and namespace in other branches
- 6.2 players/osmplayer/player/OSMPlayer.php \OSMPlayer::__construct()
- 6 players/osmplayer/player/OSMPlayer.php \OSMPlayer::__construct()
Constructor.
Creates a new instance of a media player.
Usage:
$player = new OSMPlayer(array( 'width' => 640, 'height' => 480, 'playlist' => 'http://www.mysite.com/playlist.xml' ));
File
- players/
osmplayer/ player/ OSMPlayer.php, line 74
Class
- OSMPlayer
- PHP wrapper class for the Open Standard Media (OSM) player.
Code
public function __construct($_params = array()) {
// First set the defaults.
$this->playerParams = OSMPlayer::getPlayerParams();
$this->defaults = array_merge($this->playerParams, OSMPlayer::getPlayerSettings());
$this->settings = $this->defaults;
if ($_params) {
// Set the parameters ( which will override the defaults ).
$this->settings = array_merge($this->settings, $_params);
}
// Create our template.
$templateClass = ucfirst($this->settings['template']) . 'Template';
require_once "OSMTemplate.php";
require_once "templates/" . $this->settings['template'] . "/template.php";
$this->template = new $templateClass($this->settings);
// Make sure we set the Prefix.
$this
->setPrefix(isset($_params['prefix']) ? $_params['prefix'] : $this->settings['id'] . '_');
}