1
0

BxBaseFileHandlerVideosViewer.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php defined('BX_DOL') or die('hack attempt');
  2. /**
  3. * Copyright (c) UNA, Inc - https://una.io
  4. * MIT License - https://opensource.org/licenses/MIT
  5. *
  6. * @defgroup UnaBaseView UNA Base Representation Classes
  7. * @{
  8. */
  9. /**
  10. * Videos viewer (player) preview video files.
  11. * @see BxDolFileHandler
  12. */
  13. class BxBaseFileHandlerVideosViewer extends BxBaseFileHandler
  14. {
  15. protected $_aTranscoders;
  16. public function __construct ($aObject, $oTemplate)
  17. {
  18. parent::__construct ($aObject, $oTemplate);
  19. $this->_aTranscoders = [];
  20. }
  21. public function setTranscoder($aTranscoders)
  22. {
  23. $this->_aTranscoders = $aTranscoders;
  24. }
  25. public function display ($sFileUrl, $aFile)
  26. {
  27. $this->addCssJs();
  28. $sVideoUrlHd = '';
  29. if(!empty($aFile['dimensions']) && $this->_aTranscoders['mp4_hd']->isProcessHD($aFile['dimensions']))
  30. $sVideoUrlHd = $this->_aTranscoders['mp4_hd']->getFileUrl($aFile['id']);
  31. return $this->_aTranscoders ? BxTemplFunctions::getInstance()->videoPlayer(
  32. $this->_aTranscoders['poster']->getFileUrl($aFile['id']),
  33. $this->_aTranscoders['mp4']->getFileUrl($aFile['id']),
  34. $sVideoUrlHd,
  35. false, ''
  36. ) : '';
  37. }
  38. }
  39. /** @} */