SUPPORT.TWILIO.COM END OF LIFE NOTICE: This site, support.twilio.com, is scheduled to go End of Life on February 27, 2024. All Twilio Support content has been migrated to help.twilio.com, where you can continue to find helpful Support articles, API docs, and Twilio blog content, and escalate your issues to our Support team. We encourage you to update your bookmarks and begin using the new site today for all your Twilio Support needs.

Dynamic Layouts in Twilio Video Compositions

Overview

Many organizations such as legal firms, educators, and remote teams require video recordings where the layout changes dynamically based on participant actions (for example, switching between a full-screen participant and a split-screen when a document is shared). This article explains what is currently possible with Twilio Programmable Video Compositions, outlines limitations, and provides practical workarounds for achieving dynamic layouts.

 

What Are Video Composition Layouts?

Twilio Programmable Video Compositions allow you to record video rooms and define how participant video tracks are arranged in the final recording. Layouts can be customized at the time the composition is created, including grid, presenter, and custom region-based layouts.

 

Current Limitations

Dynamic or real-time layout changes during an ongoing composition are not supported.

  • The layout is fixed when the composition starts and cannot be changed automatically in response to participant actions (such as starting or stopping screen sharing).
  • If a layout includes a region for a participant or shared content that is not present, that region will remain blank in the recording.

 

What You Need To Know

Workarounds and Best Practices

  1. Use Static Layouts
  • Choose a static layout that best fits your most common use case.
  • Twilio provides several complex layout options that can be configured at composition creation.
  • If a participant or shared content is missing, their region will be blank.
  1. Segment and Stitch Compositions
  • Monitor your application for key events (e.g., when screen sharing starts or stops).
  • Start a new composition with the appropriate layout each time the state changes.
  • After the session, use a video editing tool (such as FFmpeg) to stitch the resulting video files together for a seamless experience.
  1. Post-Processing with External Tools
  • Record all tracks separately.
  • Use video editing software (like FFmpeg) to combine and edit tracks after the session, allowing for custom transitions and layouts.

Example Use Cases

Scenario Native Support Workaround Available
Full-screen participant, then split with shared doc No Yes (segment & stitch, post-process)
Static grid or presenter layout Yes N/A
Dynamic switching based on participant actions No Yes (see above)

 

Future Enhancements

Twilio is continuously working to improve its video composition features, including more flexible and dynamic layout options. For the latest updates, refer to the Twilio Changelog.

 

Conclusion

While Twilio Video Compositions do not currently support real-time dynamic layout changes, you can achieve similar results through careful application logic and post-processing. For most dynamic scenarios, segmenting recordings and combining them after the session is the recommended approach.

Below you find references to useful documents: 

If you have further questions or need implementation guidance, please reach out to Twilio Support.

 

Have more questions? Submit a request
Powered by Zendesk