Get Html for MP3 Player.
204 : string {
207
209
210 if (!self::$lightbox_initialized && $a_preview) {
212 $lb->setWidth("660px");
213 $lb->addLightbox();
214 self::$lightbox_initialized = true;
215 }
216
217
220 $mp_tpl =
new ilTemplate(
"tpl.flv_player.html",
true,
true,
"Services/MediaObjects");
221 if ($a_preview) {
223 $mp_tpl->setCurrentBlock("ytdownload");
224 $mp_tpl->setVariable(
"TXT_DOWNLOAD",
$lng->
txt(
"download"));
226 $mp_tpl->parseCurrentBlock();
227 }
228
229 $mp_tpl->setCurrentBlock("ytpreview");
232 } else {
234 }
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();
242 }
243 $mp_tpl->setCurrentBlock("youtube");
244 if ($a_preview) {
245 $mp_tpl->setVariable("CLASS", "ilNoDisplay");
246 }
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());
252 if ($a_preview) {
254 }
255 $mp_tpl->parseCurrentBlock();
256 return $mp_tpl->get();
257 }
258
259
261 $mp_tpl =
new ilTemplate(
"tpl.flv_player.html",
true,
true,
"Services/MediaObjects");
262 if ($a_preview) {
264 $mp_tpl->setCurrentBlock("ytdownload");
265 $mp_tpl->setVariable(
"TXT_DOWNLOAD",
$lng->
txt(
"download"));
267 $mp_tpl->parseCurrentBlock();
268 }
269
270 $mp_tpl->setCurrentBlock("ytpreview");
273 } else {
275 }
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();
283 }
284 $mp_tpl->setCurrentBlock("youtube");
285 if ($a_preview) {
286 $mp_tpl->setVariable("CLASS", "ilNoDisplay");
287 }
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");
293 if ($a_preview) {
295 }
296 $mp_tpl->parseCurrentBlock();
297 return $mp_tpl->get();
298 }
299
301
302
303 if (in_array(
$mimeType, array(
"video/mp4",
304 "video/m4v",
305 "video/rtmp",
306 "video/x-flv",
307 "video/webm",
308 "video/youtube",
309 "video/vimeo",
310 "video/ogg"
311 ))) {
312 $style = "";
315 }
316
317 $mp_tpl =
new ilTemplate(
"tpl.flv_player.html",
true,
true,
"Services/MediaObjects");
318
319
320 if ($a_preview) {
322 $mp_tpl->setCurrentBlock("download");
323 $mp_tpl->setVariable(
"TXT_DOWNLOAD",
$lng->
txt(
"download"));
325 $mp_tpl->parseCurrentBlock();
326 }
327
328 $mp_tpl->setCurrentBlock("preview");
331 } else {
333 }
334 $mp_tpl->setVariable("IMG_ALT", $this->video_preview_pic_alt);
335 $mp_tpl->setVariable(
"PTITLE", $this->
getTitle());
336 $mp_tpl->parseCurrentBlock();
337 }
338 $mp_tpl->setCurrentBlock("mejs_video");
339
340 if ($a_preview) {
341 $mp_tpl->setVariable("WRAP_CLASS", "ilNoDisplay");
342 $mp_tpl->setVariable("CLASS", "mejs__player ilNoDisplay");
343 }
344
345
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"));
350
351 $onload_code = "il.MediaObjects.setPlayerConfig('player_" . $player_nr .
352 "', {event_url: '" . $this->event_callback_url . "'});";
353
354 $this->tpl->addOnLoadCode(
355 $onload_code
356 );
357
360 if (is_int(strpos(
$mimeType,
"audio/mpeg"))) {
361
362 }
363
364 if ($height != "") {
365 $style = "height: " . $height . "; ";
366 }
367 if ($width != "") {
368 $style .= "width: " . $width . "; ";
369 }
370 if ($style != "") {
371 $mp_tpl->setVariable("STYLE", "style='$style'");
372 }
373 $mp_tpl->setVariable(
"FILE", $this->
getFile());
375 $mp_tpl->setVariable(
"TITLE", $this->
getTitle());
377 if ($a_preview) {
379 }
380 $mp_tpl->parseCurrentBlock();
381 $r = $mp_tpl->get();
382
383 if (!$a_preview) {
384 $tpl->
addOnLoadCode(
"new MediaElementPlayer('player_" . $this->
id .
"_" . $this->current_nr .
"');");
385 }
386
387
388 return $r;
389 }
390
391
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();
403 }
404
405 $mp_tpl->setCurrentBlock("apreview");
408 } else {
410 }
411 $mp_tpl->setVariable(
"PTITLE", $this->
getTitle());
412 $mp_tpl->parseCurrentBlock();
413 $preview_output = true;
414 }
415 $mp_tpl->setCurrentBlock("audio");
416 if ($preview_output) {
417 $mp_tpl->setVariable("ASTYLE", "margin-top:-40px");
418 }
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();
426 }
427
428
429 if (is_int(strpos(
$mimeType,
"image/"))) {
430 $mp_tpl =
new ilTemplate(
"tpl.flv_player.html",
true,
true,
"Services/MediaObjects");
431
433 $mp_tpl->setCurrentBlock("idownload");
434 $mp_tpl->setVariable(
"TXT_DOWNLOAD",
$lng->
txt(
"download"));
436 $mp_tpl->parseCurrentBlock();
437 }
438
439 $mp_tpl->setCurrentBlock("ipreview");
442 } else {
443 $mp_tpl->setVariable(
"IMG_SRC", $this->
getFile());
444 }
445 $mp_tpl->setVariable(
"PTITLE", $this->
getTitle());
446 $mp_tpl->parseCurrentBlock();
447
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());
454
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);
458 }
459
462 $mp_tpl->parseCurrentBlock();
463
464 return $mp_tpl->get();
465 }
466
467
470 && strpos(
$mimeType,
"audio/mpeg") ===
false
471 && strpos(
$mimeType,
"image/png") ===
false
472 && strpos(
$mimeType,
"image/gif") ===
false) {
473 $html =
'<embed src="' . $this->
getFile() .
'" ' .
475 'ShowControls="1" ' .
476 'autoplay="false" autostart="false" ' .
477 'width="320" height="240" scale="aspect" ></embed>';
478 return $html;
479 }
480
481 return "";
482 }
static get(string $a_glyph, string $a_text="")
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...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static initMediaElementJs(ilGlobalTemplateInterface $a_tpl=null)
Init mediaelement.js scripts.
special template class to simplify handling of ITX/PEAR
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
addOnLoadCode(string $a_code, int $a_batch=2)
Add on load code.