Skip to content

Commit

Permalink
code improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
ferishili committed Nov 22, 2024
1 parent 0eab30e commit 911a80d
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions classes/local/output_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,19 +138,16 @@ public static function output_episode($ocinstanceid, $episodeid, $modinstanceid,
return;
}

// Find aspect-ratio if there is only one video track.
// Find aspect-ratio of the first video track.
$wrapperattrs = [];
if (!empty($data['streams']) && !empty($data['streams'][0]['sources'])) {
$sources = $data['streams'][0]['sources'];
$res = $sources[array_key_first($sources)][0]['res'];
$resolution = $res['w'] . '/' . $res['h'];
echo \html_writer::start_div('player-wrapper', ['style' => '--aspect-ratio:' . $resolution]);
} else {
echo \html_writer::start_div('player-wrapper');
$wrapperattrs['style'] = '--aspect-ratio:' . $resolution;
}

if (empty($data['streams'])) {
\core\notification::error(get_string('erroremptystreamsources', 'mod_opencast'));
}
echo \html_writer::start_div('player-wrapper', $wrapperattrs);

echo '<iframe src="player.html" id="player-iframe" class="mod-opencast-paella-player" allowfullscreen"></iframe>';
echo \html_writer::end_div();
Expand Down

0 comments on commit 911a80d

Please sign in to comment.