mux-php
mux-php copied to clipboard
Cannot update test stream - 'Cannot use max continuous duration with test live streams'
I am trying to use the Livestream Update request via this PHP library to update an existing livestream. I did not set an explicit max_continuous_duration either when creating or updating.
The following code sets the max_continuous_duration even if I don't define it, and even if I do define it and set it to null
$updateLivestreamRequest = new UpdateLiveStreamRequest([
"playback_policy" => [
0 => "public"
],
"new_asset_settings" => null,
"use_slate_for_standard_latency" => false,
"reconnect_window" => 10,
"latency_mode" => "low",
"test" => true,
"passthrough" => "Test4-2"
]);
$stream = $this->liveStreamsApi->updateLiveStream($livestream->remote_id, $updateLivestreamRequest);
This then yields the following error when sending the request
[400] Client error: `PATCH https://api.mux.com/video/v1/live-streams/kgvb005y2nnF228vfurRO5CZif6UqHAr9qg9tP8hYiN00` resulted in a `400 Bad Request` response:
{"error":{"type":"invalid_parameters","messages":["Cannot use max continuous duration with test live streams"]}}
I tried the following workaround but this gives an error down the line.
[...]
// Workaround
if ($livestream->is_test) {
$updateLivestreamRequest->offsetUnset('max_continuous_duration');
}
$stream = $this->liveStreamsApi->updateLiveStream($livestream->remote_id, $updateLivestreamRequest);
Yields
Undefined array key "max_continuous_duration"
on a different line
The following workaround, DOES work;
// Workaround - https://github.com/muxinc/mux-php/issues/68
if ($livestream->is_test) {
$updateLivestreamRequest->offsetSet('max_continuous_duration', null);
}