opentok/Opentok-Java-SDK

Dynamic layout for archives

IGitGotIt opened this issue · 1 comments

This is a proposal to add dynamic layout property support for archives
https://tokbox.com/developer/rest/#change_composed_archive_layout

You can dynamically set the archive layout (while the archive is being recorded) using the setArchiveLayout(String archiveId, ArchiveProperties properties)
method.
You can use the ArchiveProperties builder as follows:

ArchiveProperties properties = new ArchiveProperties.Builder()
.layout(new ArchiveLayout(ArchiveLayout.Type.VERTICAL))
.build();
opentok.setArchiveLayout(archiveId, properties);

// For custom layouts the builder looks like:
ArchiveProperties properties = new ArchiveProperties.Builder()
.layout(new ArchiveLayout(ArchiveLayout.Type.CUSTOM, "stream { position: absolute; }"))
.build();

The exceptions thrown are

  switch (response.getStatusCode()) {
                case 200:
                    responseString = response.getResponseBody();
                    break;
                case 400:
                    throw new RequestException("Could not set the layout. Either an invalid JSON or an invalid layout options.");
                case 403:
                    throw new RequestException("Could not set the layout. The request was not authorized.");
                case 500:
                    throw new RequestException("Could not set the layout. A server error occurred.");
                default:
                    throw new RequestException("Could not set the layout. The server response was invalid." +
                            " response code: " + response.getStatusCode());
            }
        } catch (InterruptedException | ExecutionException e) {
            throw new RequestException("Could not delete an OpenTok Archive. archiveId = " + archiveId, e);
        }

Valid layout type values are "bestFit" (best fit), "custom" (custom), "horizontalPresentation" (horizontal presentation), "pip" (picture-in-picture), and "verticalPresentation" (vertical presentation)). If you specify a "custom" layout type, set the stylesheet property to the stylesheet. (For other layout types, do not set the stylesheet property.)

stylesheet (Object) — Optional. Specify this only if you set the type property to "custom". Set the stylesheet property to the stylesheet. (For other layout types, do not set the stylesheet property.)

This has been released with 4.3.0