31 protected string $id =
"";
38 protected static int $nr = 1;
48 string $a_event_callback_url =
"" 52 $this->tpl = $DIC->ui()->mainTemplate();
53 $this->
lng = $DIC->language();
55 $this->event_callback_url = $a_event_callback_url;
56 $this->current_nr = self::$nr;
63 $this->file = $a_file;
74 $this->alt_video_file = $a_val;
89 $this->alt_video_mime = $a_val;
99 $this->displayHeight = $dHeight;
109 $this->displayWidth = $a_val;
119 $this->mimeType = $value;
129 $this->video_preview_pic = $a_val;
130 $this->video_preview_pic_alt = $a_alt;
140 $this->title = $a_val;
150 $this->description = $a_val;
163 $this->force_audio_preview = $a_val;
173 $this->download_link = $a_val;
188 if ($a_tpl == null) {
194 $a_tpl->addJavascript(
"./Services/MediaObjects/js/MediaObjects.js?1");
203 bool $a_preview =
false 208 self::initJavascript($tpl);
210 if (!self::$lightbox_initialized && $a_preview) {
212 $lb->setWidth(
"660px");
214 self::$lightbox_initialized =
true;
220 $mp_tpl =
new ilTemplate(
"tpl.flv_player.html",
true,
true,
"Services/MediaObjects");
223 $mp_tpl->setCurrentBlock(
"ytdownload");
224 $mp_tpl->setVariable(
"TXT_DOWNLOAD", $lng->
txt(
"download"));
226 $mp_tpl->parseCurrentBlock();
229 $mp_tpl->setCurrentBlock(
"ytpreview");
237 $mp_tpl->setVariable(
"DISPLAY_HEIGHT", $height);
238 $mp_tpl->setVariable(
"DISPLAY_WIDTH", $width);
239 $mp_tpl->setVariable(
"IMG_ALT", $this->video_preview_pic_alt);
240 $mp_tpl->setVariable(
"PTITLE", $this->
getTitle());
241 $mp_tpl->parseCurrentBlock();
243 $mp_tpl->setCurrentBlock(
"youtube");
245 $mp_tpl->setVariable(
"CLASS",
"ilNoDisplay");
247 $mp_tpl->setVariable(
"SRC",
"https://www.youtube.com/embed/" . $p[
"v"]);
248 $mp_tpl->setVariable(
"PLAYER_NR", $this->
id .
"_" . $this->current_nr);
249 $mp_tpl->setVariable(
"TXT_PLAY", $lng->
txt(
"mob_play"));
250 $mp_tpl->setVariable(
"TITLE", $this->
getTitle());
255 $mp_tpl->parseCurrentBlock();
256 return $mp_tpl->get();
261 $mp_tpl =
new ilTemplate(
"tpl.flv_player.html",
true,
true,
"Services/MediaObjects");
264 $mp_tpl->setCurrentBlock(
"ytdownload");
265 $mp_tpl->setVariable(
"TXT_DOWNLOAD", $lng->
txt(
"download"));
267 $mp_tpl->parseCurrentBlock();
270 $mp_tpl->setCurrentBlock(
"ytpreview");
278 $mp_tpl->setVariable(
"DISPLAY_HEIGHT", $height);
279 $mp_tpl->setVariable(
"DISPLAY_WIDTH", $width);
280 $mp_tpl->setVariable(
"IMG_ALT", $this->video_preview_pic_alt);
281 $mp_tpl->setVariable(
"PTITLE", $this->
getTitle());
282 $mp_tpl->parseCurrentBlock();
284 $mp_tpl->setCurrentBlock(
"youtube");
286 $mp_tpl->setVariable(
"CLASS",
"ilNoDisplay");
288 $mp_tpl->setVariable(
"SRC", $this->
getFile() .
"?controls=0");
289 $mp_tpl->setVariable(
"PLAYER_NR", $this->
id .
"_" . $this->current_nr);
290 $mp_tpl->setVariable(
"TITLE", $this->
getTitle());
292 include_once(
"./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php");
296 $mp_tpl->parseCurrentBlock();
297 return $mp_tpl->get();
303 if (in_array($mimeType, array(
"video/mp4",
313 if ($mimeType ==
"video/quicktime") {
314 $mimeType =
"video/mov";
317 $mp_tpl =
new ilTemplate(
"tpl.flv_player.html",
true,
true,
"Services/MediaObjects");
322 $mp_tpl->setCurrentBlock(
"download");
323 $mp_tpl->setVariable(
"TXT_DOWNLOAD", $lng->
txt(
"download"));
325 $mp_tpl->parseCurrentBlock();
328 $mp_tpl->setCurrentBlock(
"preview");
334 $mp_tpl->setVariable(
"IMG_ALT", $this->video_preview_pic_alt);
335 $mp_tpl->setVariable(
"PTITLE", $this->
getTitle());
336 $mp_tpl->parseCurrentBlock();
338 $mp_tpl->setCurrentBlock(
"mejs_video");
341 $mp_tpl->setVariable(
"WRAP_CLASS",
"ilNoDisplay");
342 $mp_tpl->setVariable(
"CLASS",
"mejs__player ilNoDisplay");
346 $mp_tpl->setVariable(
"FILE", $this->
getFile());
348 $mp_tpl->setVariable(
"PLAYER_NR", $player_nr);
349 $mp_tpl->setVariable(
"TXT_PLAY", $lng->
txt(
"mob_play"));
351 $onload_code =
"il.MediaObjects.setPlayerConfig('player_" . $player_nr .
352 "', {event_url: '" . $this->event_callback_url .
"'});";
354 $this->tpl->addOnLoadCode(
360 if (is_int(strpos($mimeType,
"audio/mpeg"))) {
365 $style =
"height: " . $height .
"; ";
368 $style .=
"width: " . $width .
"; ";
371 $mp_tpl->setVariable(
"STYLE",
"style='$style'");
373 $mp_tpl->setVariable(
"FILE", $this->
getFile());
375 $mp_tpl->setVariable(
"TITLE", $this->
getTitle());
380 $mp_tpl->parseCurrentBlock();
384 $tpl->
addOnLoadCode(
"new MediaElementPlayer('player_" . $this->
id .
"_" . $this->current_nr .
"');");
392 if (is_int(strpos($mimeType,
"audio/mpeg")) ||
393 in_array($mimeType, array(
"application/ogg",
"audio/ogg"))) {
395 $mp_tpl =
new ilTemplate(
"tpl.flv_player.html",
true,
true,
"Services/MediaObjects");
396 $preview_output =
false;
399 $mp_tpl->setCurrentBlock(
"adownload");
400 $mp_tpl->setVariable(
"TXT_DOWNLOAD", $lng->
txt(
"download"));
402 $mp_tpl->parseCurrentBlock();
405 $mp_tpl->setCurrentBlock(
"apreview");
411 $mp_tpl->setVariable(
"PTITLE", $this->
getTitle());
412 $mp_tpl->parseCurrentBlock();
413 $preview_output =
true;
415 $mp_tpl->setCurrentBlock(
"audio");
416 if ($preview_output) {
417 $mp_tpl->setVariable(
"ASTYLE",
"margin-top:-40px");
419 $mp_tpl->setVariable(
"AFILE", $this->
getFile());
420 $mp_tpl->setVariable(
"APLAYER_NR", $this->
id .
"_" . $this->current_nr);
421 $mp_tpl->setVariable(
"AEVENT_URL", $this->event_callback_url);
422 $mp_tpl->setVariable(
"AHEIGHT",
"40");
423 $mp_tpl->setVariable(
"AWIDTH",
"320");
424 $mp_tpl->parseCurrentBlock();
425 return $mp_tpl->get();
429 if (is_int(strpos($mimeType,
"image/"))) {
430 $mp_tpl =
new ilTemplate(
"tpl.flv_player.html",
true,
true,
"Services/MediaObjects");
433 $mp_tpl->setCurrentBlock(
"idownload");
434 $mp_tpl->setVariable(
"TXT_DOWNLOAD", $lng->
txt(
"download"));
436 $mp_tpl->parseCurrentBlock();
439 $mp_tpl->setCurrentBlock(
"ipreview");
443 $mp_tpl->setVariable(
"IMG_SRC", $this->
getFile());
445 $mp_tpl->setVariable(
"PTITLE", $this->
getTitle());
446 $mp_tpl->parseCurrentBlock();
448 $mp_tpl->setCurrentBlock(
"image");
449 $mp_tpl->setVariable(
"IFILE", $this->
getFile());
450 $mp_tpl->setVariable(
"IPLAYER_NR", $this->
id .
"_" . $this->current_nr);
451 $mp_tpl->setVariable(
"ITITLE", $this->
getTitle());
455 if ($this->event_callback_url) {
456 $mp_tpl->setVariable(
"IMG_CALLBACK_URL", $this->event_callback_url);
457 $mp_tpl->setVariable(
"IMG_CALLBACK_PLAYER_NR", $this->
id .
"_" . $this->current_nr);
462 $mp_tpl->parseCurrentBlock();
464 return $mp_tpl->get();
469 if (strpos($mimeType,
"flv") ===
false 470 && strpos($mimeType,
"audio/mpeg") ===
false 471 && strpos($mimeType,
"image/png") ===
false 472 && strpos($mimeType,
"image/gif") ===
false) {
473 $html =
'<embed src="' . $this->
getFile() .
'" ' .
474 'type="' . $mimeType .
'" ' .
475 'ShowControls="1" ' .
476 'autoplay="false" autostart="false" ' .
477 'width="320" height="240" scale="aspect" ></embed>';
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static get(string $a_glyph, string $a_text="")
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addOnLoadCode(string $a_code, int $a_batch=2)
Add on load code.
static initConnection(?ilGlobalTemplateInterface $a_main_tpl=null)
Init YUI Connection module.
static initMediaElementJs(ilGlobalTemplateInterface $a_tpl=null)
Init mediaelement.js scripts.