Skip to content

Archive stream layout #157

@IGitGotIt

Description

@IGitGotIt

This is a proposal to add dynamically changing streams layout properties of a composed archive
https://tokbox.com/developer/rest/#change-stream-layout-classes-composed

You can also change the individual streams layout of a composed archive , as follows:

//id (String) — The stream ID.
//layoutClassList (Array) — An array of layout classes (each strings) for the stream.
StreamProperties streamProps = new StreamProperties.Builder()
                                    .id(streamId)
                                    .addLayoutClass("full")
                                    .addLayoutClass("focus")
                                    .build();
StreamListProperties properties = new StreamListProperties.Builder()
                                    .addStreamProperties(streamProps)
                                    .build();
// If you want to effect multiple streams create as many StreamProperties objects 
// as you want and add them to  StreamListProperties as follows:

StreamListProperties properties = new StreamListProperties.Builder()
                                    .addStreamProperties(streamProps1)
                                    .addStreamProperties(streamProps2)
                                    .build();

// Call to opentok sdk
opentok.setArchiveStreamsLayout(sessionId, properties);

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, sessionId = " + sessionId, e);
        }

Valid layout classes values are "bestFit" (best fit), "custom" (custom), "horizontalPresentation" (horizontal presentation), "pip" (picture-in-picture), and "verticalPresentation" (vertical presentation)).

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions