ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilMediaPlayerGUI.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
33 {
34  var $file;
36  var $mimeType;
37  static $nr = 1;
38 
39  function __construct()
40  {
41  }
42 
48  function setFile($a_file)
49  {
50  $this->file = $a_file;
51  }
52 
58  function getFile()
59  {
60  return $this->file;
61  }
62 
68  function setDisplayHeight ($dHeight) {
69  $this->displayHeight = $dHeight;
70  }
71 
77  function getDisplayHeight () {
78  return $this->displayHeight;
79  }
80 
81 
82  function setMimeType ($value) {
83  $this->mimeType = $value;
84  }
85 
89  function getMp3PlayerHtml()
90  {
91  global $tpl;
92  require_once 'Services/MediaObjects/classes/class.ilObjMediaObject.php';
93  $mimeType = $this->mimeType == "" ? ilObjMediaObject::getMimeType(basename($this->getFile())) : $this->mimeType;
94  if (strpos($mimeType,"flv") === false
95  && strpos($mimeType,"audio/mpeg") === false
96  && strpos($mimeType,"image/png") === false
97  && strpos($mimeType,"image/gif") === false)
98  {
99  $html = '<embed src="'.$this->getFile().'" '.
100  'type="'.$mimeType.'" '.
101  'autoplay="false" autostart="false" '.
102  'width="320" height="240" scale="aspect" ></embed>';
103  return $html;
104  }
105 
106  $tpl->addJavaScript("./Services/MediaObjects/flash_flv_player/swfobject.js");
107  $mp_tpl = new ilTemplate("tpl.flv_player.html", true, true, "Services/MediaObjects");
108  $mp_tpl->setVariable("FILE", urlencode($this->getFile()));
109  $mp_tpl->setVariable("PLAYER_NR", self::$nr);
110  $mp_tpl->setVariable("DISPLAY_HEIGHT", strpos($mimeType,"audio/mpeg") === false ? "240" : "20");
111  $mp_tpl->setVariable("DISPLAY_WIDTH", "320");
112  self::$nr++;
113 
114  return $mp_tpl->get();
115  }
116 }
117 ?>