29 protected static $nr = 1;
37 public function __construct($a_id =
"", $a_event_callback_url =
"")
41 $this->tpl = $DIC[
"tpl"];
42 $this->lng = $DIC->language();
44 $this->event_callback_url = $a_event_callback_url;
45 $this->current_nr = self::$nr;
56 $this->file = $a_file;
76 $this->alt_video_file = $a_val;
86 return $this->alt_video_file;
96 $this->alt_video_mime = $a_val;
106 return $this->alt_video_mime;
116 $this->displayHeight = $dHeight;
136 $this->displayWidth = $a_val;
151 $this->mimeType = $value;
161 $this->video_preview_pic = $a_val;
162 $this->video_preview_pic_alt = $a_alt;
172 return $this->video_preview_pic;
182 $this->title = $a_val;
202 $this->description = $a_val;
222 $this->force_audio_preview = $a_val;
232 return $this->force_audio_preview;
242 $this->download_link = $a_val;
265 if ($a_tpl == null) {
269 include_once(
"./Services/YUI/classes/class.ilYuiUtil.php");
272 $a_tpl->addJavascript(
"./Services/MediaObjects/js/MediaObjects.js?1");
274 include_once(
"./Services/MediaObjects/classes/class.ilPlayerUtil.php");
287 self::initJavascript(
$tpl);
289 if (!self::$lightbox_initialized && $a_preview) {
290 include_once(
"./Services/UIComponent/Lightbox/classes/class.ilLightboxGUI.php");
292 $lb->setWidth(
"660px");
294 self::$lightbox_initialized =
true;
297 require_once
'Services/MediaObjects/classes/class.ilObjMediaObject.php';
298 include_once(
"./Services/MediaObjects/classes/class.ilExternalMediaAnalyzer.php");
312 $mp_tpl =
new ilTemplate(
"tpl.flv_player.html",
true,
true,
"Services/MediaObjects");
315 $mp_tpl->setCurrentBlock(
"ytdownload");
316 $mp_tpl->setVariable(
"TXT_DOWNLOAD",
$lng->txt(
"download"));
318 $mp_tpl->parseCurrentBlock();
321 $mp_tpl->setCurrentBlock(
"ytpreview");
329 $mp_tpl->setVariable(
"DISPLAY_HEIGHT", $height);
330 $mp_tpl->setVariable(
"DISPLAY_WIDTH", $width);
331 $mp_tpl->setVariable(
"IMG_ALT", $this->video_preview_pic_alt);
332 $mp_tpl->setVariable(
"PTITLE", $this->
getTitle());
333 $mp_tpl->parseCurrentBlock();
335 $mp_tpl->setCurrentBlock(
"youtube");
337 $mp_tpl->setVariable(
"CLASS",
"ilNoDisplay");
339 $mp_tpl->setVariable(
"PV", $p[
"v"]);
340 $mp_tpl->setVariable(
"PLAYER_NR", $this->
id .
"_" . $this->current_nr);
341 $mp_tpl->setVariable(
"TXT_PLAY",
$lng->txt(
"mob_play"));
342 $mp_tpl->setVariable(
"TITLE", $this->
getTitle());
344 include_once(
"./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php");
348 $mp_tpl->parseCurrentBlock();
349 return $mp_tpl->get();
355 $html =
'<iframe src="//player.vimeo.com/video/' . $p[
"id"] .
'" width="320" height="240" ' .
356 'frameborder="0"></iframe>';
362 include_once(
"./Services/MediaObjects/classes/class.ilPlayerUtil.php");
365 if (in_array(
$mimeType, array(
"video/mp4",
"video/m4v",
"video/rtmp",
366 "video/x-flv",
"video/webm",
"video/youtube",
"video/vimeo",
"video/ogg"))) {
371 $mp_tpl =
new ilTemplate(
"tpl.flv_player.html",
true,
true,
"Services/MediaObjects");
376 $mp_tpl->setCurrentBlock(
"download");
377 $mp_tpl->setVariable(
"TXT_DOWNLOAD",
$lng->txt(
"download"));
379 $mp_tpl->parseCurrentBlock();
382 $mp_tpl->setCurrentBlock(
"preview");
388 $mp_tpl->setVariable(
"IMG_ALT", $this->video_preview_pic_alt);
389 $mp_tpl->setVariable(
"PTITLE", $this->
getTitle());
390 $mp_tpl->parseCurrentBlock();
394 $mp_tpl->setCurrentBlock(
"source");
395 $mp_tpl->setVariable(
"FILE", $this->
getFile());
397 $mp_tpl->parseCurrentBlock();
400 $mp_tpl->setCurrentBlock(
"source");
403 $mp_tpl->parseCurrentBlock();
406 $mp_tpl->setCurrentBlock(
"mejs_video");
409 $mp_tpl->setVariable(
"WRAP_CLASS",
"ilNoDisplay");
410 $mp_tpl->setVariable(
"CLASS",
"mejs__player ilNoDisplay");
415 $mp_tpl->setVariable(
"PLAYER_NR", $this->
id .
"_" . $this->current_nr);
416 $mp_tpl->setVariable(
"TXT_PLAY",
$lng->txt(
"mob_play"));
417 $mp_tpl->setVariable(
"EVENT_URL", $this->event_callback_url);
420 if (is_int(strpos(
$mimeType,
"audio/mpeg"))) {
425 $style =
"height: ".$height.
"; ";
428 $style.=
"width: ".$width.
"; ";
431 $mp_tpl->setVariable(
"STYLE",
"style='$style'");
437 $mp_tpl->setVariable(
"FFILE", $this->
getFile());
438 $mp_tpl->setVariable(
"TITLE", $this->
getTitle());
440 include_once(
"./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php");
444 $mp_tpl->parseCurrentBlock();
448 $tpl->addOnLoadCode(
"new MediaElementPlayer('player_" . $this->
id .
"_" . $this->current_nr .
"');");
456 if (is_int(strpos(
$mimeType,
"audio/mpeg")) ||
457 in_array(
$mimeType, array(
"application/ogg",
"audio/ogg"))) {
459 $mp_tpl =
new ilTemplate(
"tpl.flv_player.html",
true,
true,
"Services/MediaObjects");
460 $preview_output =
false;
463 $mp_tpl->setCurrentBlock(
"adownload");
464 $mp_tpl->setVariable(
"TXT_DOWNLOAD",
$lng->txt(
"download"));
466 $mp_tpl->parseCurrentBlock();
469 $mp_tpl->setCurrentBlock(
"apreview");
475 $mp_tpl->setVariable(
"PTITLE", $this->
getTitle());
476 $mp_tpl->parseCurrentBlock();
477 $preview_output =
true;
479 $mp_tpl->setCurrentBlock(
"audio");
480 if ($preview_output) {
481 $mp_tpl->setVariable(
"ASTYLE",
"margin-top:-40px");
483 $mp_tpl->setVariable(
"AFILE", $this->
getFile());
484 $mp_tpl->setVariable(
"APLAYER_NR", $this->
id .
"_" . $this->current_nr);
485 $mp_tpl->setVariable(
"AEVENT_URL", $this->event_callback_url);
486 $mp_tpl->setVariable(
"AHEIGHT",
"40");
487 $mp_tpl->setVariable(
"AWIDTH",
"320");
488 $mp_tpl->parseCurrentBlock();
489 return $mp_tpl->get();
493 if (is_int(strpos(
$mimeType,
"image/"))) {
494 $mp_tpl =
new ilTemplate(
"tpl.flv_player.html",
true,
true,
"Services/MediaObjects");
497 $mp_tpl->setCurrentBlock(
"idownload");
498 $mp_tpl->setVariable(
"TXT_DOWNLOAD",
$lng->txt(
"download"));
500 $mp_tpl->parseCurrentBlock();
503 $mp_tpl->setCurrentBlock(
"ipreview");
507 $mp_tpl->setVariable(
"IMG_SRC", $this->
getFile());
509 $mp_tpl->setVariable(
"PTITLE", $this->
getTitle());
510 $mp_tpl->parseCurrentBlock();
512 $mp_tpl->setCurrentBlock(
"image");
513 $mp_tpl->setVariable(
"IFILE", $this->
getFile());
514 $mp_tpl->setVariable(
"IPLAYER_NR", $this->
id .
"_" . $this->current_nr);
515 $mp_tpl->setVariable(
"ITITLE", $this->
getTitle());
517 include_once(
"./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php");
520 if ($this->event_callback_url) {
521 $mp_tpl->setVariable(
"IMG_CALLBACK_URL", $this->event_callback_url);
522 $mp_tpl->setVariable(
"IMG_CALLBACK_PLAYER_NR", $this->
id .
"_" . $this->current_nr);
527 $mp_tpl->parseCurrentBlock();
529 return $mp_tpl->get();
535 && strpos(
$mimeType,
"audio/mpeg") ===
false 536 && strpos(
$mimeType,
"image/png") ===
false 537 && strpos(
$mimeType,
"image/gif") ===
false) {
538 $html =
'<embed src="' . $this->
getFile() .
'" ' .
540 'ShowControls="1" ' .
541 'autoplay="false" autostart="false" ' .
542 'width="320" height="240" scale="aspect" ></embed>';
static getFlashVideoPlayerFilename($a_fullpath=false)
Get flash video player file name.
static get($a_glyph, $a_text="")
Get glyph html.
static initConnection(ilGlobalTemplateInterface $a_main_tpl=null)
Init YUI Connection module.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static initMediaElementJs($a_tpl=null)
Init mediaelement.js scripts.