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");
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(
"TITLE", $this->
getTitle());
343 include_once(
"./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php");
347 $mp_tpl->parseCurrentBlock();
348 return $mp_tpl->get();
354 $html =
'<iframe src="//player.vimeo.com/video/' . $p[
"id"] .
'" width="320" height="240" ' .
355 'frameborder="0"></iframe>';
361 include_once(
"./Services/MediaObjects/classes/class.ilPlayerUtil.php");
364 if (in_array(
$mimeType,
array(
"video/mp4",
"video/m4v",
"video/rtmp",
365 "video/x-flv",
"video/webm",
"video/youtube",
"video/vimeo",
"video/ogg"))) {
370 $mp_tpl =
new ilTemplate(
"tpl.flv_player.html",
true,
true,
"Services/MediaObjects");
375 $mp_tpl->setCurrentBlock(
"download");
376 $mp_tpl->setVariable(
"TXT_DOWNLOAD",
$lng->txt(
"download"));
378 $mp_tpl->parseCurrentBlock();
381 $mp_tpl->setCurrentBlock(
"preview");
387 $mp_tpl->setVariable(
"IMG_ALT", $this->video_preview_pic_alt);
388 $mp_tpl->setVariable(
"PTITLE", $this->
getTitle());
389 $mp_tpl->parseCurrentBlock();
393 $mp_tpl->setCurrentBlock(
"source");
394 $mp_tpl->setVariable(
"FILE", $this->
getFile());
396 $mp_tpl->parseCurrentBlock();
399 $mp_tpl->setCurrentBlock(
"source");
402 $mp_tpl->parseCurrentBlock();
405 $mp_tpl->setCurrentBlock(
"mejs_video");
408 $mp_tpl->setVariable(
"CLASS",
"ilNoDisplay");
411 $mp_tpl->setVariable(
"PLAYER_NR", $this->
id .
"_" . $this->current_nr);
412 $mp_tpl->setVariable(
"EVENT_URL", $this->event_callback_url);
415 if (is_int(strpos(
$mimeType,
"audio/mpeg"))) {
419 $mp_tpl->setVariable(
"DISPLAY_HEIGHT", $height);
420 $mp_tpl->setVariable(
"DISPLAY_WIDTH", $width);
423 $mp_tpl->setVariable(
"FFILE", $this->
getFile());
424 $mp_tpl->setVariable(
"TITLE", $this->
getTitle());
426 include_once(
"./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php");
430 $mp_tpl->parseCurrentBlock();
434 $tpl->addOnLoadCode(
"new MediaElementPlayer('#player_" . $this->
id .
"_" . $this->current_nr .
"');");
442 if (is_int(strpos(
$mimeType,
"audio/mpeg")) ||
445 $mp_tpl =
new ilTemplate(
"tpl.flv_player.html",
true,
true,
"Services/MediaObjects");
446 $preview_output =
false;
449 $mp_tpl->setCurrentBlock(
"adownload");
450 $mp_tpl->setVariable(
"TXT_DOWNLOAD",
$lng->txt(
"download"));
452 $mp_tpl->parseCurrentBlock();
455 $mp_tpl->setCurrentBlock(
"apreview");
461 $mp_tpl->setVariable(
"PTITLE", $this->
getTitle());
462 $mp_tpl->parseCurrentBlock();
463 $preview_output =
true;
465 $mp_tpl->setCurrentBlock(
"audio");
466 if ($preview_output) {
467 $mp_tpl->setVariable(
"ASTYLE",
"margin-top:-30px");
469 $mp_tpl->setVariable(
"AFILE", $this->
getFile());
470 $mp_tpl->setVariable(
"APLAYER_NR", $this->
id .
"_" . $this->current_nr);
471 $mp_tpl->setVariable(
"AEVENT_URL", $this->event_callback_url);
472 $mp_tpl->setVariable(
"AHEIGHT",
"30");
473 $mp_tpl->setVariable(
"AWIDTH",
"320");
474 $mp_tpl->parseCurrentBlock();
475 return $mp_tpl->get();
479 if (is_int(strpos(
$mimeType,
"image/"))) {
480 $mp_tpl =
new ilTemplate(
"tpl.flv_player.html",
true,
true,
"Services/MediaObjects");
483 $mp_tpl->setCurrentBlock(
"idownload");
484 $mp_tpl->setVariable(
"TXT_DOWNLOAD",
$lng->txt(
"download"));
486 $mp_tpl->parseCurrentBlock();
489 $mp_tpl->setCurrentBlock(
"ipreview");
493 $mp_tpl->setVariable(
"IMG_SRC", $this->
getFile());
495 $mp_tpl->setVariable(
"PTITLE", $this->
getTitle());
496 $mp_tpl->parseCurrentBlock();
498 $mp_tpl->setCurrentBlock(
"image");
499 $mp_tpl->setVariable(
"IFILE", $this->
getFile());
500 $mp_tpl->setVariable(
"IPLAYER_NR", $this->
id .
"_" . $this->current_nr);
501 $mp_tpl->setVariable(
"ITITLE", $this->
getTitle());
503 include_once(
"./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php");
506 if ($this->event_callback_url) {
507 $mp_tpl->setVariable(
"IMG_CALLBACK_URL", $this->event_callback_url);
508 $mp_tpl->setVariable(
"IMG_CALLBACK_PLAYER_NR", $this->
id .
"_" . $this->current_nr);
513 $mp_tpl->parseCurrentBlock();
515 return $mp_tpl->get();
521 && strpos(
$mimeType,
"audio/mpeg") ===
false 522 && strpos(
$mimeType,
"image/png") ===
false 523 && strpos(
$mimeType,
"image/gif") ===
false) {
526 'ShowControls="1" ' .
527 'autoplay="false" autostart="false" ' .
528 'width="320" height="240" scale="aspect" ></embed>';
533 $tpl->addJavaScript(
"./Services/MediaObjects/flash_flv_player/swfobject.js");
534 $mp_tpl =
new ilTemplate(
"tpl.flv_player.html",
true,
true,
"Services/MediaObjects");
535 $mp_tpl->setCurrentBlock(
"default");
536 $mp_tpl->setVariable(
"FILE", urlencode($this->
getFile()));
537 $mp_tpl->setVariable(
"PLAYER_NR", $this->current_nr);
538 $mp_tpl->setVariable(
"DISPLAY_HEIGHT", strpos(
$mimeType,
"audio/mpeg") ===
false ?
"240" :
"20");
539 $mp_tpl->setVariable(
"DISPLAY_WIDTH",
"320");
540 $mp_tpl->parseCurrentBlock();
541 return $mp_tpl->get();
static initConnection(ilTemplate $a_main_tpl=null)
Init YUI Connection module.
static getFlashVideoPlayerFilename($a_fullpath=false)
Get flash video player file name.
static get($a_glyph, $a_text="")
Get glyph html.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
special template class to simplify handling of ITX/PEAR
static initMediaElementJs($a_tpl=null)
Init mediaelement.js scripts.
Reload workbook from saved file
Create styles array
The data for the language used.