Procházet zdrojové kódy

Streams: aspect ratio isn't always set correctly #4273

Alex Trofimov před 3 roky
rodič
revize
b78e0683af

+ 2 - 0
modules/boonex/stream/classes/BxStrmTemplate.php

@@ -44,9 +44,11 @@ class BxStrmTemplate extends BxBaseModTextTemplate
 
         $CNF = &$this->getModule()->_oConfig->CNF;
 
+        $aAspect = preg_split("/[\/:]+/", trim(getParam('bx_stream_aspect_ratio')), 2, PREG_SPLIT_NO_EMPTY);
         return $this->parseHtmlByName('stream_broadcast_ome.html', array(
             'suffix' => md5($aContentInfo[$CNF['FIELD_KEY']]),
             'broadcast_url' => $oEngine->getWebrtcIngestUrl($aContentInfo[$CNF['FIELD_KEY']]),
+            'aspect_ratio' => $aAspect && is_array($aAspect) && $aAspect[0] && $aAspect[1] ? $aAspect[0] / $aAspect[1] : 0,
             'popup_share' => $this->popupShare($aContentInfo),
             'popup_settings' => $this->popupSettings($aContentInfo),
         ));

+ 1 - 0
modules/boonex/stream/install/langs/en.xml

@@ -26,6 +26,7 @@
     <string name="_bx_stream_option_dash_enabled"><![CDATA[Enable MPEG-DASH streaming]]></string>
     <string name="_bx_stream_option_hls_enabled"><![CDATA[Enable HLS streaming]]></string>
     <string name="_bx_stream_option_recordings_url"><![CDATA[Base URL for recordings (experimental)]]></string>
+    <string name="_bx_stream_option_aspect_ratio"><![CDATA[Preferable video aspect ratio (must match transcoding resolution aspect ratio)]]></string>
     <string name="_bx_stream_option_enable_auto_approve"><![CDATA[Auto approve a stream after creation]]></string>
     <string name="_bx_stream_option_summary_chars"><![CDATA[Number of characters in auto-cropped stream summary]]></string>
     <string name="_bx_stream_option_plain_summary_chars"><![CDATA[Number of characters in plain stream description when stream hasn't thumb]]></string>

+ 2 - 1
modules/boonex/stream/install/sql/enable.sql

@@ -19,7 +19,8 @@ INSERT INTO `sys_options` (`name`, `value`, `category_id`, `caption`, `type`, `c
 ('bx_stream_sources_pattern', '', @iCategId, '_bx_stream_option_sources_pattern', 'text', '', '', '', 24),
 ('bx_stream_dash_enabled', '', @iCategId, '_bx_stream_option_dash_enabled', 'checkbox', '', '', '', 26),
 ('bx_stream_hls_enabled', '', @iCategId, '_bx_stream_option_hls_enabled', 'checkbox', '', '', '', 28),
-('bx_stream_recordings_url', '', @iCategId, '_bx_stream_option_recordings_url', 'digit', '', '', '', 30);
+('bx_stream_recordings_url', '', @iCategId, '_bx_stream_option_recordings_url', 'digit', '', '', '', 30),
+('bx_stream_aspect_ratio', '', @iCategId, '_bx_stream_option_aspect_ratio', 'digit', '', '', '', 40);
 
 INSERT INTO `sys_options_categories` (`type_id`, `name`, `caption`, `order`)
 VALUES (@iTypeId, 'bx_stream_engine_ome', '_bx_stream_options_cat_engine_ome', 2);

+ 2 - 0
modules/boonex/stream/template/stream_broadcast_ome.html

@@ -84,6 +84,8 @@ __popup_settings__
                     exact: videoDeviceId
                 }
             };
+            if (__aspect_ratio__)
+                newConstraint.video[aspectRatio] = {ideal: __aspect_ratio__};
         }
 
         if (audioDeviceId) {