summaryrefslogtreecommitdiff
path: root/lib/bbcnext.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/bbcnext.php')
-rw-r--r--lib/bbcnext.php20
1 files changed, 19 insertions, 1 deletions
diff --git a/lib/bbcnext.php b/lib/bbcnext.php
index ed58a4f..f4ad4ec 100644
--- a/lib/bbcnext.php
+++ b/lib/bbcnext.php
@@ -3,8 +3,22 @@
require_once __DIR__ . '/rms.php';
require_once __DIR__ . '/mediaselector.php';
+const INCLUDE_RMS_DATA = false;
+
function next_renderFromRms(string $path) {
- next_renderExperience(rms_fetch($path)->data);
+ $resp = rms_fetch($path);
+ try {
+ next_renderExperience($resp->data);
+ } catch (Exception|TypeError $e) {
+ echo '<exception>'
+ . htmlspecialchars($e->getMessage())
+ . '</exception>';
+ }
+ if (INCLUDE_RMS_DATA) {
+ echo '<details><summary>Raw data from RMS</summary><pre>';
+ echo json_encode($resp, JSON_PRETTY_PRINT);
+ echo '</pre></details>';
+ }
}
function next_renderExperience(array $modules) {
@@ -38,6 +52,10 @@ function next_renderModule(stdClass $module) {
$url = mediaselector_findHls($module->data[0]->id);
echo '<audio controls hidden id="hls-player" data-hls="' . $url . '" />';
echo '<script src="static/hls-player.js" defer></script>';
+ } elseif ($module->id == 'live_play_area') {
+ $url = mediaselector_findLiveHls($module->data[0]->service_id);
+ echo '<audio controls hidden id="hls-player" data-hls="' . $url . '" />';
+ echo '<script src="static/hls-player.js" defer></script>';
}
echo "</$type>";
}