ILIAS  Release_3_10_x_branch Revision 61812
 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 
95  if (strpos($mimeType,"flv") === false
96  && strpos($mimeType,"audio/mpeg") === false
97  && strpos($mimeType,"image/png") === false
98  && strpos($mimeType,"image/gif") === false)
99  {
100  $html = '<embed src="'.$this->getFile().'" '.
101  'type="'.$mimeType.'" '.
102  'autoplay="false" autostart="false" '.
103  'width="320" height="240" scale="aspect" ></embed>';
104  return $html;
105  }
106 
107  $tpl->addJavaScript("./Services/MediaObjects/flash_flv_player/swfobject.js");
108  $mp_tpl = new ilTemplate("tpl.flv_player.html", true, true, "Services/MediaObjects");
109  $mp_tpl->setVariable("FILE", $this->getFile());
110  $mp_tpl->setVariable("PLAYER_NR", self::$nr);
111  $mp_tpl->setVariable("DISPLAY_HEIGHT", strpos($mimeType,"audio/mpeg") === false ? "240" : "20");
112  $mp_tpl->setVariable("DISPLAY_WIDTH", "320");
113  self::$nr++;
114 
115  return $mp_tpl->get();
116  }
117 }
118 ?>