'3.0', 'cvid' => 'urn:bbc:pips:pid:...'] $url = MEDIASELECTOR_BASE; $options['format'] = 'json'; foreach ($options as $k => $v) { $url .= "/$k/$v"; } $ctx = stream_context_get_default(); if (isset($token)) { stream_context_set_option($ctx, 'http', 'header', "Authorization: Bearer $token"); } return json_decode(file_get_contents($url, context: $ctx)); } function mediaselector_findHls(string $vpid, ?string $token = null): ?string { $resp = mediaselector_lookup([ 'version' => '3.0', 'proto' => 'https', 'transferformat' => 'hls', 'mediaset' => 'pc', 'cvid' => "urn:bbc:pips:pid:$vpid", ], $token); if (isset($resp->result) && $resp->result == 'selectionunavailable') { return null; } return $resp->media[0]->connection[0]->href; } function mediaselector_findLiveHls(string $service): ?string { $jwt = sounds_getLiveBearerToken($service); return mediaselector_findHls($service, $jwt); }