Skip to content

Latest commit

 

History

History
604 lines (419 loc) · 17.7 KB

SpacesApi.md

File metadata and controls

604 lines (419 loc) · 17.7 KB

MuxPhp\SpacesApi

All URIs are relative to https://api.mux.com, except if the operation defines another base path.

Method HTTP request Description
createSpace() POST /video/v1/spaces Create a space
createSpaceBroadcast() POST /video/v1/spaces/{SPACE_ID}/broadcasts Create a space broadcast
deleteSpace() DELETE /video/v1/spaces/{SPACE_ID} Delete a space
deleteSpaceBroadcast() DELETE /video/v1/spaces/{SPACE_ID}/broadcasts/{BROADCAST_ID} Delete a space broadcast
getSpace() GET /video/v1/spaces/{SPACE_ID} Retrieve a space
getSpaceBroadcast() GET /video/v1/spaces/{SPACE_ID}/broadcasts/{BROADCAST_ID} Retrieve space broadcast
listSpaces() GET /video/v1/spaces List spaces
startSpaceBroadcast() POST /video/v1/spaces/{SPACE_ID}/broadcasts/{BROADCAST_ID}/start Start a space broadcast
stopSpaceBroadcast() POST /video/v1/spaces/{SPACE_ID}/broadcasts/{BROADCAST_ID}/stop Stop a space broadcast

createSpace()

createSpace($create_space_request): \MuxPhp\Models\SpaceResponse

Create a space

Create a new space. Spaces are used to build real-time video applications.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure HTTP basic authorization: accessToken
$config = MuxPhp\Configuration::getDefaultConfiguration()
              ->setUsername('YOUR_USERNAME')
              ->setPassword('YOUR_PASSWORD');


$apiInstance = new MuxPhp\Api\SpacesApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);

// This API method wants a \MuxPhp\Models\CreateSpaceRequest
// as the second parameter.  That being said, these API docs are 
// auto-generated from our OpenAPI specification, which 
// gives us the example parameter as a JSON string.  In this example,
// we'll use json_decode() to turn it into an associative array, which
// is compatible with the model.
//
// In your own code you should use an associative array, or
// use a "new \MuxPhp\Models\CreateSpaceRequest" directly.
$create_space_request = json_decode('{"type":"server"}',true); // \MuxPhp\Models\CreateSpaceRequest

try {
    $result = $apiInstance->createSpace($create_space_request);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling SpacesApi->createSpace: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
create_space_request \MuxPhp\Models\CreateSpaceRequest

Return type

\MuxPhp\Models\SpaceResponse

Authorization

accessToken

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

createSpaceBroadcast()

createSpaceBroadcast($space_id, $create_broadcast_request): \MuxPhp\Models\BroadcastResponse

Create a space broadcast

Creates a new broadcast. Broadcasts are used to create composited versions of your space, which can be broadcast to live streams. Note: By default only a single broadcast destination can be specified. Contact Mux support if you need more.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure HTTP basic authorization: accessToken
$config = MuxPhp\Configuration::getDefaultConfiguration()
              ->setUsername('YOUR_USERNAME')
              ->setPassword('YOUR_PASSWORD');


$apiInstance = new MuxPhp\Api\SpacesApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$space_id = 'space_id_example'; // string | The space ID.

// This API method wants a \MuxPhp\Models\CreateBroadcastRequest
// as the second parameter.  That being said, these API docs are 
// auto-generated from our OpenAPI specification, which 
// gives us the example parameter as a JSON string.  In this example,
// we'll use json_decode() to turn it into an associative array, which
// is compatible with the model.
//
// In your own code you should use an associative array, or
// use a "new \MuxPhp\Models\CreateBroadcastRequest" directly.
$create_broadcast_request = json_decode('{"live_stream_id":"GQ9025mPqzyjOy3kKQW006qKTqmULW9vFO"}',true); // \MuxPhp\Models\CreateBroadcastRequest

try {
    $result = $apiInstance->createSpaceBroadcast($space_id, $create_broadcast_request);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling SpacesApi->createSpaceBroadcast: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
space_id string The space ID.
create_broadcast_request \MuxPhp\Models\CreateBroadcastRequest

Return type

\MuxPhp\Models\BroadcastResponse

Authorization

accessToken

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

deleteSpace()

deleteSpace($space_id)

Delete a space

Deletes a space. Spaces can only be deleted when idle.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure HTTP basic authorization: accessToken
$config = MuxPhp\Configuration::getDefaultConfiguration()
              ->setUsername('YOUR_USERNAME')
              ->setPassword('YOUR_PASSWORD');


$apiInstance = new MuxPhp\Api\SpacesApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$space_id = 'space_id_example'; // string | The space ID.

try {
    $apiInstance->deleteSpace($space_id);
} catch (Exception $e) {
    echo 'Exception when calling SpacesApi->deleteSpace: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
space_id string The space ID.

Return type

void (empty response body)

Authorization

accessToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

[Back to top] [Back to API list] [Back to Model list] [Back to README]

deleteSpaceBroadcast()

deleteSpaceBroadcast($space_id, $broadcast_id)

Delete a space broadcast

Deletes a single broadcast of a specific space. Broadcasts can only be deleted when idle.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure HTTP basic authorization: accessToken
$config = MuxPhp\Configuration::getDefaultConfiguration()
              ->setUsername('YOUR_USERNAME')
              ->setPassword('YOUR_PASSWORD');


$apiInstance = new MuxPhp\Api\SpacesApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$space_id = 'space_id_example'; // string | The space ID.
$broadcast_id = 'broadcast_id_example'; // string | The broadcast ID.

try {
    $apiInstance->deleteSpaceBroadcast($space_id, $broadcast_id);
} catch (Exception $e) {
    echo 'Exception when calling SpacesApi->deleteSpaceBroadcast: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
space_id string The space ID.
broadcast_id string The broadcast ID.

Return type

void (empty response body)

Authorization

accessToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getSpace()

getSpace($space_id): \MuxPhp\Models\SpaceResponse

Retrieve a space

Retrieves the details of a space that has previously been created. Supply the unique space ID that was returned from your create space request, and Mux will return the information about the corresponding space. The same information is returned when creating a space.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure HTTP basic authorization: accessToken
$config = MuxPhp\Configuration::getDefaultConfiguration()
              ->setUsername('YOUR_USERNAME')
              ->setPassword('YOUR_PASSWORD');


$apiInstance = new MuxPhp\Api\SpacesApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$space_id = 'space_id_example'; // string | The space ID.

try {
    $result = $apiInstance->getSpace($space_id);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling SpacesApi->getSpace: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
space_id string The space ID.

Return type

\MuxPhp\Models\SpaceResponse

Authorization

accessToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getSpaceBroadcast()

getSpaceBroadcast($space_id, $broadcast_id): \MuxPhp\Models\BroadcastResponse

Retrieve space broadcast

Retrieves the details of a broadcast of a specific space.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure HTTP basic authorization: accessToken
$config = MuxPhp\Configuration::getDefaultConfiguration()
              ->setUsername('YOUR_USERNAME')
              ->setPassword('YOUR_PASSWORD');


$apiInstance = new MuxPhp\Api\SpacesApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$space_id = 'space_id_example'; // string | The space ID.
$broadcast_id = 'broadcast_id_example'; // string | The broadcast ID.

try {
    $result = $apiInstance->getSpaceBroadcast($space_id, $broadcast_id);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling SpacesApi->getSpaceBroadcast: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
space_id string The space ID.
broadcast_id string The broadcast ID.

Return type

\MuxPhp\Models\BroadcastResponse

Authorization

accessToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

listSpaces()

listSpaces($limit, $page): \MuxPhp\Models\ListSpacesResponse

List spaces

List all spaces in the current environment.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure HTTP basic authorization: accessToken
$config = MuxPhp\Configuration::getDefaultConfiguration()
              ->setUsername('YOUR_USERNAME')
              ->setPassword('YOUR_PASSWORD');


$apiInstance = new MuxPhp\Api\SpacesApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$limit = 25; // int | Number of items to include in the response
$page = 1; // int | Offset by this many pages, of the size of `limit`

try {
    $result = $apiInstance->listSpaces($limit, $page);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling SpacesApi->listSpaces: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
limit int Number of items to include in the response [optional] [default to 25]
page int Offset by this many pages, of the size of `limit` [optional] [default to 1]

Return type

\MuxPhp\Models\ListSpacesResponse

Authorization

accessToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

startSpaceBroadcast()

startSpaceBroadcast($space_id, $broadcast_id): \MuxPhp\Models\StartSpaceBroadcastResponse

Start a space broadcast

Starts broadcasting a space to the associated destination. Broadcasts can only be started when the space is active (when there are participants connected).

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure HTTP basic authorization: accessToken
$config = MuxPhp\Configuration::getDefaultConfiguration()
              ->setUsername('YOUR_USERNAME')
              ->setPassword('YOUR_PASSWORD');


$apiInstance = new MuxPhp\Api\SpacesApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$space_id = 'space_id_example'; // string | The space ID.
$broadcast_id = 'broadcast_id_example'; // string | The broadcast ID.

try {
    $result = $apiInstance->startSpaceBroadcast($space_id, $broadcast_id);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling SpacesApi->startSpaceBroadcast: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
space_id string The space ID.
broadcast_id string The broadcast ID.

Return type

\MuxPhp\Models\StartSpaceBroadcastResponse

Authorization

accessToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

stopSpaceBroadcast()

stopSpaceBroadcast($space_id, $broadcast_id): \MuxPhp\Models\StopSpaceBroadcastResponse

Stop a space broadcast

Stops broadcasting a space, causing the destination live stream to become idle. This API also automatically calls complete on the destination live stream. Broadcasts are also automatically stopped when a space becomes idle.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure HTTP basic authorization: accessToken
$config = MuxPhp\Configuration::getDefaultConfiguration()
              ->setUsername('YOUR_USERNAME')
              ->setPassword('YOUR_PASSWORD');


$apiInstance = new MuxPhp\Api\SpacesApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$space_id = 'space_id_example'; // string | The space ID.
$broadcast_id = 'broadcast_id_example'; // string | The broadcast ID.

try {
    $result = $apiInstance->stopSpaceBroadcast($space_id, $broadcast_id);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling SpacesApi->stopSpaceBroadcast: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
space_id string The space ID.
broadcast_id string The broadcast ID.

Return type

\MuxPhp\Models\StopSpaceBroadcastResponse

Authorization

accessToken

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]