You are here

function brightcove_save_video in Brightcove Video Connect 7.7

Same name and namespace in other branches
  1. 7.6 brightcove.video.inc \brightcove_save_video()

Saves a Video.

Parameters

\Brightcove\Object\Video\Video $video:

Entity $client:

Return value

\Brightcove\Object\Video\Video

1 call to brightcove_save_video()
BrightcoveVideoEntityController::save in ./brightcove.video.inc
Implements EntityAPIControllerInterface.

File

./brightcove.video.inc, line 104
Brightcove video related functions.

Code

function brightcove_save_video(\Brightcove\Object\Video\Video $video, Entity $client) {
  $video_id = $video
    ->getId();
  $op = empty($video_id) ? 'create' : 'update';
  brightcove_try(function () use (&$video, $client, $op) {

    /** @var \Brightcove\API\CMS $cms */
    list($cms, ) = brightcove_create_classes($client);
    $video = $cms
      ->{"{$op}Video"}($video);
    brightcove_invalidate_cache("brightcove:video:{$video->getId()}:{$client->bcid}");
  });
  return $video;
}