Просмотр исходного кода

#2222 Videos: video in timeline is cut on right side

Alex Trofimov 7 лет назад
Родитель
Сommit
33fc8ac999

+ 2 - 2
modules/boonex/plyr/classes/BxPlyrPlayer.php

@@ -81,7 +81,7 @@ class BxPlyrPlayer extends BxDolPlayer
 
         // attrs
 
-        $sId = 'BxPlyr' . mt_rand();
+        $sId = isset($aParams['attrs']) && isset($aParams['attrs']['id']) ? $aParams['attrs']['id'] : 'BxPlyr' . mt_rand();
         $sAttrsWrapper = '';
         $aAttrsDefault = array(
             'id' => $sId,
@@ -155,7 +155,7 @@ class BxPlyrPlayer extends BxDolPlayer
             'settings' => $aSettings,
         ), $this->_aConfCustom);
         $sInitEditor = "
-            gl$sId = new Plyr('#$sId', " . json_encode($aOptions) . ");
+            glBxPlyr" . mt_rand() . " = new Plyr('#$sId', " . json_encode($aOptions) . ");
         ";
 
         // load necessary JS and CSS

+ 5 - 11
modules/boonex/timeline/classes/BxTimelineModule.php

@@ -80,18 +80,12 @@ class BxTimelineModule extends BxBaseModNotificationsModule implements iBxDolCon
         if($aData === false || !isset($aData['content']['videos'][$iVideoId]))
             return;
 
-        $iNameIndex = BX_PAGE_CLEAR;
-        $oTemplate = $this->_oTemplate;
-        if(getParam('sys_player_default') == 'bx_plyr') {
-            $iNameIndex = BX_PAGE_EMBED;
-            $oTemplate = BxDolTemplate::getInstance();
-            $oTemplate->addJs(array(
-                'jquery.min.js', 
-                'embedly-player.min.js'
-            ));
-        }
 
-        $oTemplate->setPageNameIndex ($iNameIndex);
+        $oTemplate = BxDolTemplate::getInstance();
+        $oTemplate->addJs(array(
+            'embedly-player.min.js'
+        ));
+        $oTemplate->setPageNameIndex (BX_PAGE_EMBED);
         $oTemplate->setPageContent ('page_main_code', $this->_oTemplate->getVideo($aEvent, $aData['content']['videos'][$iVideoId]));
         $oTemplate->getPageCode();
     }

+ 9 - 1
modules/boonex/timeline/classes/BxTimelineTemplate.php

@@ -983,8 +983,16 @@ class BxTimelineTemplate extends BxBaseModNotificationsTemplate
     public function getVideo($aEvent, $aVideo)
     {
         $sVideoId = $this->_oConfig->getHtmlIds('view', 'video') . $aEvent['id'] . '-' . $aVideo['id'];
+        $oPlayer = BxDolPlayer::getObjectInstance();
+        if (!$oPlayer)
+            return '';
+        $sPlayer = $oPlayer->getCodeVideo (BX_PLAYER_EMBED, array(
+            'poster' => $aVideo['src_poster'],
+            'mp4' => array('sd' => $aVideo['src_mp4'], 'hd' => $aVideo['src_mp4_hd']),
+            'attrs' => array('id' => $sVideoId),
+        ));
         return $this->parseHtmlByName('video_player.html', array(
-            'player' => BxTemplFunctions::getInstance()->videoPlayer($aVideo['src_poster'], $aVideo['src_mp4'], $aVideo['src_mp4_hd'], array('id' => $sVideoId)),
+            'player' => $sPlayer,
             'html_id' => $sVideoId
         ));
     }