Skip to content

Commit

Permalink
Fix error notification (#51)
Browse files Browse the repository at this point in the history
* Fix error notification

The error notification is shown if two or more streams are available, but
it should only be displayed if there are no streams.

* code improvements

---------

Co-authored-by: ferishili <[email protected]>
  • Loading branch information
geichelberger and ferishili authored Dec 1, 2024
1 parent cf7e231 commit 89dbe1a
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions classes/local/output_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,16 +135,17 @@ public static function output_episode($ocinstanceid, $episodeid, $modinstanceid,
return;
}

// Find aspect-ratio if there is only one video track.
if (count($data['streams']) === 1 && !empty($data['streams'][0]['sources'])) {
// 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;
}

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 89dbe1a

Please sign in to comment.