Menu

Expand
Rate this page:

Billing and Resource Management

We are no longer allowing new customers to onboard to Twilio Live. Effective November 30, 2023, Twilio Live will End of Life. We have created this Migration Guide to help you identify an alternative solution for your use case.

To create a livestream with Twilio Live, you create two different resources:

  • A MediaProcessor, to join a Video Room and create the livestream content from the Room
  • A PlayerStreamer, to send that livestream to a Player SDK

Both PlayerStreamer and MediaProcessor resources end via commands from the REST API or when the MediaProcessor's maximum duration has been reached, unless there is an error in the stream. They do not end automatically when you leave the Video Room that's being streamed.

It is important that you stop these resources via the API when the livestream is over, both for billing and account quota management. Each account has a limit on the number of concurrent PlayerStreamer and MediaProcessor resources it can have. Livestreams are billed per minute streamed, so to avoid unnecessary usage charges, we recommend ending the resources as soon as you no longer need them. View Twilio Live pricing here.

Additionally, you can set the maximum duration of PlayerStreamers and MediaProcessors based on how long you anticipate your streams to last, so the resources automatically terminate after a specific amount of time if you forget to terminate them via the API. By default, the maximum duration of either resource type is 300 seconds (5 minutes). If you retain this default value, the live stream will terminate after five minutes. You can customize the maximum duration when creating the PlayerStreamer and the MediaProcessor.

You can use the REST API to understand your current resource usage. Use the API to retrieve lists of PlayerStreamers that are in the created or started state and MediaProcessors that are in the started state to verify that you are only running the livestreaming resources you need. PlayerStreamer's in created or started state and MediaProcessors in the started state are considered resources with active usage.

Graceful resource termination

When a livestream finishes, you need to terminate all the resources related to that specific live stream. This is how your application should manage Twilio Live's resources (see the sequence diagram below for further clarification):

  • Create a PlayerStreamer
  • Create a MediaProcessor using the PlayerStreamer and specifying a Media Extension
  • Streaming session starts, media flows and the audience joins
  • Streaming session ends
  • Explicitly end the MediaProcessor
  • Explicitly end the PlayerStreamer

Twilio Live Resource Management

API Commands for Resource Management

Terminate resources

Stop a PlayerStreamer

        
        
        

        Stop a PlayerStreamer

        Stop a MediaProcessor

              
              
              

              Stop a MediaProcessor

              Understand resource usage

              List all created PlayerStreamers

                    
                    
                    

                    List all created PlayerStreamers

                    List all started PlayerStreamers

                          
                          
                          

                          List all started PlayerStreamers

                          List all started MediaProcessors

                                
                                
                                

                                List all started MediaProcessors

                                Rate this page:

                                Need some help?

                                We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd by visiting Twilio's Stack Overflow Collective or browsing the Twilio tag on Stack Overflow.

                                      
                                      
                                      

                                      Thank you for your feedback!

                                      Please select the reason(s) for your feedback. The additional information you provide helps us improve our documentation:

                                      Sending your feedback...
                                      🎉 Thank you for your feedback!
                                      Something went wrong. Please try again.

                                      Thanks for your feedback!

                                      thanks-feedback-gif