diff --git a/media/livestream/composer.json b/media/livestream/composer.json index 4cef8b74f6..6946109888 100644 --- a/media/livestream/composer.json +++ b/media/livestream/composer.json @@ -2,6 +2,6 @@ "name": "google/live-stream-sample", "type": "project", "require": { - "google/cloud-video-live-stream": "^0.3.0" + "google/cloud-video-live-stream": "^0.5.0" } } diff --git a/media/livestream/src/create_channel.php b/media/livestream/src/create_channel.php index 9d25f3d197..3f548ed1a4 100644 --- a/media/livestream/src/create_channel.php +++ b/media/livestream/src/create_channel.php @@ -25,11 +25,12 @@ namespace Google\Cloud\Samples\Media\LiveStream; // [START livestream_create_channel] -use Google\Cloud\Video\LiveStream\V1\LivestreamServiceClient; use Google\Cloud\Video\LiveStream\V1\AudioStream; use Google\Cloud\Video\LiveStream\V1\Channel; use Google\Cloud\Video\LiveStream\V1\ElementaryStream; use Google\Cloud\Video\LiveStream\V1\InputAttachment; +use Google\Cloud\Video\LiveStream\V1\Client\LivestreamServiceClient; +use Google\Cloud\Video\LiveStream\V1\CreateChannelRequest; use Google\Cloud\Video\LiveStream\V1\Manifest; use Google\Cloud\Video\LiveStream\V1\MuxStream; use Google\Cloud\Video\LiveStream\V1\SegmentSettings; @@ -118,7 +119,11 @@ function create_channel( ]); // Run the channel creation request. The response is a long-running operation ID. - $operationResponse = $livestreamClient->createChannel($parent, $channel, $channelId); + $request = (new CreateChannelRequest()) + ->setParent($parent) + ->setChannel($channel) + ->setChannelId($channelId); + $operationResponse = $livestreamClient->createChannel($request); $operationResponse->pollUntilComplete(); if ($operationResponse->operationSucceeded()) { $result = $operationResponse->getResult(); diff --git a/media/livestream/src/create_channel_event.php b/media/livestream/src/create_channel_event.php index b5000efebc..197429982e 100644 --- a/media/livestream/src/create_channel_event.php +++ b/media/livestream/src/create_channel_event.php @@ -25,8 +25,9 @@ namespace Google\Cloud\Samples\Media\LiveStream; // [START livestream_create_channel_event] -use Google\Cloud\Video\LiveStream\V1\LivestreamServiceClient; use Google\Cloud\Video\LiveStream\V1\Event; +use Google\Cloud\Video\LiveStream\V1\Client\LivestreamServiceClient; +use Google\Cloud\Video\LiveStream\V1\CreateEventRequest; use Google\Protobuf\Duration; /** @@ -56,7 +57,11 @@ function create_channel_event( ->setExecuteNow(true); // Run the channel event creation request. - $response = $livestreamClient->createEvent($parent, $event, $eventId); + $request = (new CreateEventRequest()) + ->setParent($parent) + ->setEvent($event) + ->setEventId($eventId); + $response = $livestreamClient->createEvent($request); // Print results. printf('Channel event: %s' . PHP_EOL, $response->getName()); } diff --git a/media/livestream/src/create_channel_with_backup_input.php b/media/livestream/src/create_channel_with_backup_input.php index 27c2dfb3cf..8fe000053b 100644 --- a/media/livestream/src/create_channel_with_backup_input.php +++ b/media/livestream/src/create_channel_with_backup_input.php @@ -25,11 +25,12 @@ namespace Google\Cloud\Samples\Media\LiveStream; // [START livestream_create_channel_with_backup_input] -use Google\Cloud\Video\LiveStream\V1\LivestreamServiceClient; use Google\Cloud\Video\LiveStream\V1\AudioStream; use Google\Cloud\Video\LiveStream\V1\Channel; use Google\Cloud\Video\LiveStream\V1\ElementaryStream; use Google\Cloud\Video\LiveStream\V1\InputAttachment; +use Google\Cloud\Video\LiveStream\V1\Client\LivestreamServiceClient; +use Google\Cloud\Video\LiveStream\V1\CreateChannelRequest; use Google\Cloud\Video\LiveStream\V1\Manifest; use Google\Cloud\Video\LiveStream\V1\MuxStream; use Google\Cloud\Video\LiveStream\V1\SegmentSettings; @@ -128,7 +129,11 @@ function create_channel_with_backup_input( ]); // Run the channel creation request. The response is a long-running operation ID. - $operationResponse = $livestreamClient->createChannel($parent, $channel, $channelId); + $request = (new CreateChannelRequest()) + ->setParent($parent) + ->setChannel($channel) + ->setChannelId($channelId); + $operationResponse = $livestreamClient->createChannel($request); $operationResponse->pollUntilComplete(); if ($operationResponse->operationSucceeded()) { $result = $operationResponse->getResult(); diff --git a/media/livestream/src/create_input.php b/media/livestream/src/create_input.php index f41dc2bddc..77591a1da6 100644 --- a/media/livestream/src/create_input.php +++ b/media/livestream/src/create_input.php @@ -25,8 +25,9 @@ namespace Google\Cloud\Samples\Media\LiveStream; // [START livestream_create_input] -use Google\Cloud\Video\LiveStream\V1\LivestreamServiceClient; use Google\Cloud\Video\LiveStream\V1\Input; +use Google\Cloud\Video\LiveStream\V1\Client\LivestreamServiceClient; +use Google\Cloud\Video\LiveStream\V1\CreateInputRequest; /** * Creates an input. You send an input video stream to this endpoint. @@ -48,7 +49,11 @@ function create_input( ->setType(Input\Type::RTMP_PUSH); // Run the input creation request. The response is a long-running operation ID. - $operationResponse = $livestreamClient->createInput($parent, $input, $inputId); + $request = (new CreateInputRequest()) + ->setParent($parent) + ->setInput($input) + ->setInputId($inputId); + $operationResponse = $livestreamClient->createInput($request); $operationResponse->pollUntilComplete(); if ($operationResponse->operationSucceeded()) { $result = $operationResponse->getResult(); diff --git a/media/livestream/src/delete_channel.php b/media/livestream/src/delete_channel.php index 61276021b4..69eea1d404 100644 --- a/media/livestream/src/delete_channel.php +++ b/media/livestream/src/delete_channel.php @@ -25,7 +25,8 @@ namespace Google\Cloud\Samples\Media\LiveStream; // [START livestream_delete_channel] -use Google\Cloud\Video\LiveStream\V1\LivestreamServiceClient; +use Google\Cloud\Video\LiveStream\V1\Client\LivestreamServiceClient; +use Google\Cloud\Video\LiveStream\V1\DeleteChannelRequest; /** * Deletes a channel. @@ -44,7 +45,9 @@ function delete_channel( $formattedName = $livestreamClient->channelName($callingProjectId, $location, $channelId); // Run the channel deletion request. The response is a long-running operation ID. - $operationResponse = $livestreamClient->deleteChannel($formattedName); + $request = (new DeleteChannelRequest()) + ->setName($formattedName); + $operationResponse = $livestreamClient->deleteChannel($request); $operationResponse->pollUntilComplete(); if ($operationResponse->operationSucceeded()) { // Print status diff --git a/media/livestream/src/delete_channel_event.php b/media/livestream/src/delete_channel_event.php index a433be8af5..9a5bccbdc2 100644 --- a/media/livestream/src/delete_channel_event.php +++ b/media/livestream/src/delete_channel_event.php @@ -25,7 +25,8 @@ namespace Google\Cloud\Samples\Media\LiveStream; // [START livestream_delete_channel_event] -use Google\Cloud\Video\LiveStream\V1\LivestreamServiceClient; +use Google\Cloud\Video\LiveStream\V1\Client\LivestreamServiceClient; +use Google\Cloud\Video\LiveStream\V1\DeleteEventRequest; /** * Deletes a channel event. @@ -46,7 +47,9 @@ function delete_channel_event( $formattedName = $livestreamClient->eventName($callingProjectId, $location, $channelId, $eventId); // Run the channel event deletion request. - $livestreamClient->deleteEvent($formattedName); + $request = (new DeleteEventRequest()) + ->setName($formattedName); + $livestreamClient->deleteEvent($request); printf('Deleted channel event %s' . PHP_EOL, $eventId); } // [END livestream_delete_channel_event] diff --git a/media/livestream/src/delete_input.php b/media/livestream/src/delete_input.php index dedfd32edd..995cfe0d9e 100644 --- a/media/livestream/src/delete_input.php +++ b/media/livestream/src/delete_input.php @@ -25,7 +25,8 @@ namespace Google\Cloud\Samples\Media\LiveStream; // [START livestream_delete_input] -use Google\Cloud\Video\LiveStream\V1\LivestreamServiceClient; +use Google\Cloud\Video\LiveStream\V1\Client\LivestreamServiceClient; +use Google\Cloud\Video\LiveStream\V1\DeleteInputRequest; /** * Deletes an input. @@ -44,7 +45,9 @@ function delete_input( $formattedName = $livestreamClient->inputName($callingProjectId, $location, $inputId); // Run the input deletion request. The response is a long-running operation ID. - $operationResponse = $livestreamClient->deleteInput($formattedName); + $request = (new DeleteInputRequest()) + ->setName($formattedName); + $operationResponse = $livestreamClient->deleteInput($request); $operationResponse->pollUntilComplete(); if ($operationResponse->operationSucceeded()) { // Print status diff --git a/media/livestream/src/get_channel.php b/media/livestream/src/get_channel.php index 1527d26e9f..ae726eaad3 100644 --- a/media/livestream/src/get_channel.php +++ b/media/livestream/src/get_channel.php @@ -25,7 +25,8 @@ namespace Google\Cloud\Samples\Media\LiveStream; // [START livestream_get_channel] -use Google\Cloud\Video\LiveStream\V1\LivestreamServiceClient; +use Google\Cloud\Video\LiveStream\V1\Client\LivestreamServiceClient; +use Google\Cloud\Video\LiveStream\V1\GetChannelRequest; /** * Gets a channel. @@ -44,7 +45,9 @@ function get_channel( $formattedName = $livestreamClient->channelName($callingProjectId, $location, $channelId); // Get the channel. - $response = $livestreamClient->getChannel($formattedName); + $request = (new GetChannelRequest()) + ->setName($formattedName); + $response = $livestreamClient->getChannel($request); // Print results printf('Channel: %s' . PHP_EOL, $response->getName()); } diff --git a/media/livestream/src/get_channel_event.php b/media/livestream/src/get_channel_event.php index 9489116fbd..78120a9f0d 100644 --- a/media/livestream/src/get_channel_event.php +++ b/media/livestream/src/get_channel_event.php @@ -25,7 +25,8 @@ namespace Google\Cloud\Samples\Media\LiveStream; // [START livestream_get_channel_event] -use Google\Cloud\Video\LiveStream\V1\LivestreamServiceClient; +use Google\Cloud\Video\LiveStream\V1\Client\LivestreamServiceClient; +use Google\Cloud\Video\LiveStream\V1\GetEventRequest; /** * Gets a channel event. @@ -46,7 +47,9 @@ function get_channel_event( $formattedName = $livestreamClient->eventName($callingProjectId, $location, $channelId, $eventId); // Get the channel event. - $response = $livestreamClient->getEvent($formattedName); + $request = (new GetEventRequest()) + ->setName($formattedName); + $response = $livestreamClient->getEvent($request); printf('Channel event: %s' . PHP_EOL, $response->getName()); } // [END livestream_get_channel_event] diff --git a/media/livestream/src/get_input.php b/media/livestream/src/get_input.php index d70fd809ce..60bdcf246b 100644 --- a/media/livestream/src/get_input.php +++ b/media/livestream/src/get_input.php @@ -25,7 +25,8 @@ namespace Google\Cloud\Samples\Media\LiveStream; // [START livestream_get_input] -use Google\Cloud\Video\LiveStream\V1\LivestreamServiceClient; +use Google\Cloud\Video\LiveStream\V1\Client\LivestreamServiceClient; +use Google\Cloud\Video\LiveStream\V1\GetInputRequest; /** * Gets an input. @@ -44,7 +45,9 @@ function get_input( $formattedName = $livestreamClient->inputName($callingProjectId, $location, $inputId); // Get the input. - $response = $livestreamClient->getInput($formattedName); + $request = (new GetInputRequest()) + ->setName($formattedName); + $response = $livestreamClient->getInput($request); // Print results printf('Input: %s' . PHP_EOL, $response->getName()); } diff --git a/media/livestream/src/list_channel_events.php b/media/livestream/src/list_channel_events.php index 38a8685e87..1326e1b3b1 100644 --- a/media/livestream/src/list_channel_events.php +++ b/media/livestream/src/list_channel_events.php @@ -25,7 +25,8 @@ namespace Google\Cloud\Samples\Media\LiveStream; // [START livestream_list_channel_events] -use Google\Cloud\Video\LiveStream\V1\LivestreamServiceClient; +use Google\Cloud\Video\LiveStream\V1\Client\LivestreamServiceClient; +use Google\Cloud\Video\LiveStream\V1\ListEventsRequest; /** * Lists the channel events for a given channel. @@ -42,8 +43,10 @@ function list_channel_events( // Instantiate a client. $livestreamClient = new LivestreamServiceClient(); $parent = $livestreamClient->channelName($callingProjectId, $location, $channelId); + $request = (new ListEventsRequest()) + ->setParent($parent); - $response = $livestreamClient->listEvents($parent); + $response = $livestreamClient->listEvents($request); // Print the channel list. $events = $response->iterateAllElements(); print('Channel events:' . PHP_EOL); diff --git a/media/livestream/src/list_channels.php b/media/livestream/src/list_channels.php index fe44881d18..d3d459fb90 100644 --- a/media/livestream/src/list_channels.php +++ b/media/livestream/src/list_channels.php @@ -25,7 +25,8 @@ namespace Google\Cloud\Samples\Media\LiveStream; // [START livestream_list_channels] -use Google\Cloud\Video\LiveStream\V1\LivestreamServiceClient; +use Google\Cloud\Video\LiveStream\V1\Client\LivestreamServiceClient; +use Google\Cloud\Video\LiveStream\V1\ListChannelsRequest; /** * Lists the channels for a given location. @@ -40,8 +41,10 @@ function list_channels( // Instantiate a client. $livestreamClient = new LivestreamServiceClient(); $parent = $livestreamClient->locationName($callingProjectId, $location); + $request = (new ListChannelsRequest()) + ->setParent($parent); - $response = $livestreamClient->listChannels($parent); + $response = $livestreamClient->listChannels($request); // Print the channel list. $channels = $response->iterateAllElements(); print('Channels:' . PHP_EOL); diff --git a/media/livestream/src/list_inputs.php b/media/livestream/src/list_inputs.php index 8d6246cff7..a24146894a 100644 --- a/media/livestream/src/list_inputs.php +++ b/media/livestream/src/list_inputs.php @@ -25,7 +25,8 @@ namespace Google\Cloud\Samples\Media\LiveStream; // [START livestream_list_inputs] -use Google\Cloud\Video\LiveStream\V1\LivestreamServiceClient; +use Google\Cloud\Video\LiveStream\V1\Client\LivestreamServiceClient; +use Google\Cloud\Video\LiveStream\V1\ListInputsRequest; /** * Lists the inputs for a given location. @@ -40,8 +41,10 @@ function list_inputs( // Instantiate a client. $livestreamClient = new LivestreamServiceClient(); $parent = $livestreamClient->locationName($callingProjectId, $location); + $request = (new ListInputsRequest()) + ->setParent($parent); - $response = $livestreamClient->listInputs($parent); + $response = $livestreamClient->listInputs($request); // Print the input list. $inputs = $response->iterateAllElements(); print('Inputs:' . PHP_EOL); diff --git a/media/livestream/src/start_channel.php b/media/livestream/src/start_channel.php index c50d437806..1a6b4ab726 100644 --- a/media/livestream/src/start_channel.php +++ b/media/livestream/src/start_channel.php @@ -25,7 +25,8 @@ namespace Google\Cloud\Samples\Media\LiveStream; // [START livestream_start_channel] -use Google\Cloud\Video\LiveStream\V1\LivestreamServiceClient; +use Google\Cloud\Video\LiveStream\V1\Client\LivestreamServiceClient; +use Google\Cloud\Video\LiveStream\V1\StartChannelRequest; /** * Starts a channel. @@ -44,7 +45,9 @@ function start_channel( $formattedName = $livestreamClient->channelName($callingProjectId, $location, $channelId); // Run the channel start request. The response is a long-running operation ID. - $operationResponse = $livestreamClient->startChannel($formattedName); + $request = (new StartChannelRequest()) + ->setName($formattedName); + $operationResponse = $livestreamClient->startChannel($request); $operationResponse->pollUntilComplete(); if ($operationResponse->operationSucceeded()) { // Print results diff --git a/media/livestream/src/stop_channel.php b/media/livestream/src/stop_channel.php index 172264d325..8c8d65fd7f 100644 --- a/media/livestream/src/stop_channel.php +++ b/media/livestream/src/stop_channel.php @@ -25,7 +25,8 @@ namespace Google\Cloud\Samples\Media\LiveStream; // [START livestream_stop_channel] -use Google\Cloud\Video\LiveStream\V1\LivestreamServiceClient; +use Google\Cloud\Video\LiveStream\V1\Client\LivestreamServiceClient; +use Google\Cloud\Video\LiveStream\V1\StopChannelRequest; /** * Stops a channel. @@ -44,7 +45,9 @@ function stop_channel( $formattedName = $livestreamClient->channelName($callingProjectId, $location, $channelId); // Run the channel stop request. The response is a long-running operation ID. - $operationResponse = $livestreamClient->stopChannel($formattedName); + $request = (new StopChannelRequest()) + ->setName($formattedName); + $operationResponse = $livestreamClient->stopChannel($request); $operationResponse->pollUntilComplete(); if ($operationResponse->operationSucceeded()) { // Print results diff --git a/media/livestream/src/update_channel.php b/media/livestream/src/update_channel.php index 7548ac1334..05c778f534 100644 --- a/media/livestream/src/update_channel.php +++ b/media/livestream/src/update_channel.php @@ -25,9 +25,10 @@ namespace Google\Cloud\Samples\Media\LiveStream; // [START livestream_update_channel] -use Google\Cloud\Video\LiveStream\V1\LivestreamServiceClient; use Google\Cloud\Video\LiveStream\V1\Channel; use Google\Cloud\Video\LiveStream\V1\InputAttachment; +use Google\Cloud\Video\LiveStream\V1\Client\LivestreamServiceClient; +use Google\Cloud\Video\LiveStream\V1\UpdateChannelRequest; use Google\Protobuf\FieldMask; /** @@ -62,7 +63,10 @@ function update_channel( ]); // Run the channel update request. The response is a long-running operation ID. - $operationResponse = $livestreamClient->updateChannel($channel, ['updateMask' => $updateMask]); + $request = (new UpdateChannelRequest()) + ->setChannel($channel) + ->setUpdateMask($updateMask); + $operationResponse = $livestreamClient->updateChannel($request); $operationResponse->pollUntilComplete(); if ($operationResponse->operationSucceeded()) { diff --git a/media/livestream/src/update_input.php b/media/livestream/src/update_input.php index 0815372f28..22f85720a6 100644 --- a/media/livestream/src/update_input.php +++ b/media/livestream/src/update_input.php @@ -25,9 +25,10 @@ namespace Google\Cloud\Samples\Media\LiveStream; // [START livestream_update_input] -use Google\Cloud\Video\LiveStream\V1\LivestreamServiceClient; use Google\Cloud\Video\LiveStream\V1\Input; +use Google\Cloud\Video\LiveStream\V1\Client\LivestreamServiceClient; use Google\Cloud\Video\LiveStream\V1\PreprocessingConfig; +use Google\Cloud\Video\LiveStream\V1\UpdateInputRequest; use Google\Protobuf\FieldMask; /** @@ -60,7 +61,10 @@ function update_input( ]); // Run the input update request. The response is a long-running operation ID. - $operationResponse = $livestreamClient->updateInput($input, ['updateMask' => $updateMask]); + $request = (new UpdateInputRequest()) + ->setInput($input) + ->setUpdateMask($updateMask); + $operationResponse = $livestreamClient->updateInput($request); $operationResponse->pollUntilComplete(); if ($operationResponse->operationSucceeded()) {