Skip to content

Commit

Permalink
Merge pull request #44 from ferishili/issue-43
Browse files Browse the repository at this point in the history
Fix: null value for array_key_first
  • Loading branch information
NinaHerrmann authored Mar 4, 2024
2 parents cba289d + a52d142 commit a7412b6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion classes/local/output_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,13 @@ public static function output_episode($ocinstanceid, $episodeid, $modinstanceid,
echo '<br>';

// Find aspect-ratio if there is only one video track.
if (count($data['streams']) === 1) {
if (count($data['streams']) === 1 && !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 {
\core\notification::error(get_string('erroremptystreamsources', 'mod_opencast'));
echo \html_writer::start_div('player-wrapper');
}

Expand Down
1 change: 1 addition & 0 deletions lang/en/opencast.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

$string['episode'] = 'Opencast episode';
$string['errorfetchingvideo'] = 'There was a problem fetching the video.';
$string['erroremptystreamsources'] = 'There is no video source available. Please contact your system administrator.';

$string['gridview'] = 'View as grid';

Expand Down

0 comments on commit a7412b6

Please sign in to comment.