Skip to content

Can't set custom layout when starting an archive #353

@leftbak

Description

@leftbak

Cannot set a custom layout using the "layout" key in the options array for the startArchive method as this key is stripped from the options array because it is not contained in the defaults array.

Expected Behavior

Should be able to provide a layout type and custom CSS for starting an archive

Current Behavior

The combination of these two lines in OpenTok.php: startArchive method strips out any keys present in $options that are not in $defaults - however a key of "layout" is legal as per the API documentation.

$defaults = array(
        'name' => null,
        'hasVideo' => true,
        'hasAudio' => true,
        'outputMode' => OutputMode::COMPOSED,
        'resolution' => null,
        'streamMode' => StreamMode::AUTO,
    );

$options = array_merge($defaults, array_intersect_key($options, $defaults));

Possible Solution

Add "layout" into the defaults array

Steps to Reproduce (for bugs)

$opentok = new OpenTok($apiKey, $apiSecret);

$sessionOptions = [
    'archiveMode' => ArchiveMode::MANUAL,
    'mediaMode' => MediaMode::ROUTED,
];
$session = $opentok->createSession($sessionOptions);
$sessionId = $session->getSessionId();

$options = [
            'name' => 'WeAudition Self Tape',
            'hasVideo' => true,
            'hasAudio' => true,
            'outputMode' => OutputMode::COMPOSED,
            'layout' => ['type' => 'custom', 'stylesheet' => 'stream { width:100%; height:100%; display: block; position:absolute; top:0px; left:0px; } stream.ini { width:100%; height:100%; display: block; position:absolute; top:0px; left:0px; } stream.reader { width:1px; height:1px; display: block; position:absolute; top:0px; left:0px; }'],
            'resolution' => '1280x720'
        ];

$archive = $openTok->startArchive($sessionId, $options);

Archive will not be created using custom layout

Context

Can't create archives with a custom layout using the PHP SDK

Your Environment

  • Version used: v4.14.4
  • Environment name and version (e.g. PHP 5.4 on nginx 1.9.1): PHP v8.2, multiple server environments

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions