=begin #Mux API #Mux is how developers build online video. This API encompasses both Mux Video and Mux Data functionality to help you build your video-related projects better and faster than ever before. The version of the OpenAPI document: v1 Contact: devex@mux.com Generated by: https://openapi-generator.tech OpenAPI Generator version: 5.0.1 =end require 'cgi' module MuxRuby class LiveStreamsApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Create a live stream # Creates a new live stream. Once created, an encoder can connect to Mux via the specified stream key and begin streaming to an audience. # @param create_live_stream_request [CreateLiveStreamRequest] # @param [Hash] opts the optional parameters # @return [LiveStreamResponse] def create_live_stream(create_live_stream_request, opts = {}) data, _status_code, _headers = create_live_stream_with_http_info(create_live_stream_request, opts) data end # Create a live stream # Creates a new live stream. Once created, an encoder can connect to Mux via the specified stream key and begin streaming to an audience. # @param create_live_stream_request [CreateLiveStreamRequest] # @param [Hash] opts the optional parameters # @return [Array<(LiveStreamResponse, Integer, Hash)>] LiveStreamResponse data, response status code and response headers def create_live_stream_with_http_info(create_live_stream_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LiveStreamsApi.create_live_stream ...' end # verify the required parameter 'create_live_stream_request' is set if @api_client.config.client_side_validation && create_live_stream_request.nil? fail ArgumentError, "Missing the required parameter 'create_live_stream_request' when calling LiveStreamsApi.create_live_stream" end # resource path local_var_path = '/video/v1/live-streams' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(create_live_stream_request) # return_type return_type = opts[:debug_return_type] || 'LiveStreamResponse' # auth_names auth_names = opts[:debug_auth_names] || ['accessToken'] new_options = opts.merge( :operation => :"LiveStreamsApi.create_live_stream", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: LiveStreamsApi#create_live_stream\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Create a live stream playback ID # Create a new playback ID for this live stream, through which a viewer can watch the streamed content of the live stream. # @param live_stream_id [String] The live stream ID # @param create_playback_id_request [CreatePlaybackIDRequest] # @param [Hash] opts the optional parameters # @return [CreatePlaybackIDResponse] def create_live_stream_playback_id(live_stream_id, create_playback_id_request, opts = {}) data, _status_code, _headers = create_live_stream_playback_id_with_http_info(live_stream_id, create_playback_id_request, opts) data end # Create a live stream playback ID # Create a new playback ID for this live stream, through which a viewer can watch the streamed content of the live stream. # @param live_stream_id [String] The live stream ID # @param create_playback_id_request [CreatePlaybackIDRequest] # @param [Hash] opts the optional parameters # @return [Array<(CreatePlaybackIDResponse, Integer, Hash)>] CreatePlaybackIDResponse data, response status code and response headers def create_live_stream_playback_id_with_http_info(live_stream_id, create_playback_id_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LiveStreamsApi.create_live_stream_playback_id ...' end # verify the required parameter 'live_stream_id' is set if @api_client.config.client_side_validation && live_stream_id.nil? fail ArgumentError, "Missing the required parameter 'live_stream_id' when calling LiveStreamsApi.create_live_stream_playback_id" end # verify the required parameter 'create_playback_id_request' is set if @api_client.config.client_side_validation && create_playback_id_request.nil? fail ArgumentError, "Missing the required parameter 'create_playback_id_request' when calling LiveStreamsApi.create_live_stream_playback_id" end # resource path local_var_path = '/video/v1/live-streams/{LIVE_STREAM_ID}/playback-ids'.sub('{' + 'LIVE_STREAM_ID' + '}', CGI.escape(live_stream_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(create_playback_id_request) # return_type return_type = opts[:debug_return_type] || 'CreatePlaybackIDResponse' # auth_names auth_names = opts[:debug_auth_names] || ['accessToken'] new_options = opts.merge( :operation => :"LiveStreamsApi.create_live_stream_playback_id", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: LiveStreamsApi#create_live_stream_playback_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Create a live stream simulcast target # Create a simulcast target for the parent live stream. Simulcast target can only be created when the parent live stream is in idle state. Only one simulcast target can be created at a time with this API. # @param live_stream_id [String] The live stream ID # @param create_simulcast_target_request [CreateSimulcastTargetRequest] # @param [Hash] opts the optional parameters # @return [SimulcastTargetResponse] def create_live_stream_simulcast_target(live_stream_id, create_simulcast_target_request, opts = {}) data, _status_code, _headers = create_live_stream_simulcast_target_with_http_info(live_stream_id, create_simulcast_target_request, opts) data end # Create a live stream simulcast target # Create a simulcast target for the parent live stream. Simulcast target can only be created when the parent live stream is in idle state. Only one simulcast target can be created at a time with this API. # @param live_stream_id [String] The live stream ID # @param create_simulcast_target_request [CreateSimulcastTargetRequest] # @param [Hash] opts the optional parameters # @return [Array<(SimulcastTargetResponse, Integer, Hash)>] SimulcastTargetResponse data, response status code and response headers def create_live_stream_simulcast_target_with_http_info(live_stream_id, create_simulcast_target_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LiveStreamsApi.create_live_stream_simulcast_target ...' end # verify the required parameter 'live_stream_id' is set if @api_client.config.client_side_validation && live_stream_id.nil? fail ArgumentError, "Missing the required parameter 'live_stream_id' when calling LiveStreamsApi.create_live_stream_simulcast_target" end # verify the required parameter 'create_simulcast_target_request' is set if @api_client.config.client_side_validation && create_simulcast_target_request.nil? fail ArgumentError, "Missing the required parameter 'create_simulcast_target_request' when calling LiveStreamsApi.create_live_stream_simulcast_target" end # resource path local_var_path = '/video/v1/live-streams/{LIVE_STREAM_ID}/simulcast-targets'.sub('{' + 'LIVE_STREAM_ID' + '}', CGI.escape(live_stream_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(create_simulcast_target_request) # return_type return_type = opts[:debug_return_type] || 'SimulcastTargetResponse' # auth_names auth_names = opts[:debug_auth_names] || ['accessToken'] new_options = opts.merge( :operation => :"LiveStreamsApi.create_live_stream_simulcast_target", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: LiveStreamsApi#create_live_stream_simulcast_target\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Delete a live stream # Deletes a live stream from the current environment. If the live stream is currently active and being streamed to, ingest will be terminated and the encoder will be disconnected. # @param live_stream_id [String] The live stream ID # @param [Hash] opts the optional parameters # @return [nil] def delete_live_stream(live_stream_id, opts = {}) delete_live_stream_with_http_info(live_stream_id, opts) nil end # Delete a live stream # Deletes a live stream from the current environment. If the live stream is currently active and being streamed to, ingest will be terminated and the encoder will be disconnected. # @param live_stream_id [String] The live stream ID # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def delete_live_stream_with_http_info(live_stream_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LiveStreamsApi.delete_live_stream ...' end # verify the required parameter 'live_stream_id' is set if @api_client.config.client_side_validation && live_stream_id.nil? fail ArgumentError, "Missing the required parameter 'live_stream_id' when calling LiveStreamsApi.delete_live_stream" end # resource path local_var_path = '/video/v1/live-streams/{LIVE_STREAM_ID}'.sub('{' + 'LIVE_STREAM_ID' + '}', CGI.escape(live_stream_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || ['accessToken'] new_options = opts.merge( :operation => :"LiveStreamsApi.delete_live_stream", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: LiveStreamsApi#delete_live_stream\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Delete a live stream playback ID # Deletes the playback ID for the live stream. This will not disable ingest (as the live stream still exists). New attempts to play back the live stream will fail immediately. However, current viewers will be able to continue watching the stream for some period of time. # @param live_stream_id [String] The live stream ID # @param playback_id [String] The live stream's playback ID. # @param [Hash] opts the optional parameters # @return [nil] def delete_live_stream_playback_id(live_stream_id, playback_id, opts = {}) delete_live_stream_playback_id_with_http_info(live_stream_id, playback_id, opts) nil end # Delete a live stream playback ID # Deletes the playback ID for the live stream. This will not disable ingest (as the live stream still exists). New attempts to play back the live stream will fail immediately. However, current viewers will be able to continue watching the stream for some period of time. # @param live_stream_id [String] The live stream ID # @param playback_id [String] The live stream's playback ID. # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def delete_live_stream_playback_id_with_http_info(live_stream_id, playback_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LiveStreamsApi.delete_live_stream_playback_id ...' end # verify the required parameter 'live_stream_id' is set if @api_client.config.client_side_validation && live_stream_id.nil? fail ArgumentError, "Missing the required parameter 'live_stream_id' when calling LiveStreamsApi.delete_live_stream_playback_id" end # verify the required parameter 'playback_id' is set if @api_client.config.client_side_validation && playback_id.nil? fail ArgumentError, "Missing the required parameter 'playback_id' when calling LiveStreamsApi.delete_live_stream_playback_id" end # resource path local_var_path = '/video/v1/live-streams/{LIVE_STREAM_ID}/playback-ids/{PLAYBACK_ID}'.sub('{' + 'LIVE_STREAM_ID' + '}', CGI.escape(live_stream_id.to_s)).sub('{' + 'PLAYBACK_ID' + '}', CGI.escape(playback_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || ['accessToken'] new_options = opts.merge( :operation => :"LiveStreamsApi.delete_live_stream_playback_id", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: LiveStreamsApi#delete_live_stream_playback_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Delete a Live Stream Simulcast Target # Delete the simulcast target using the simulcast target ID returned when creating the simulcast target. Simulcast Target can only be deleted when the parent live stream is in idle state. # @param live_stream_id [String] The live stream ID # @param simulcast_target_id [String] The ID of the simulcast target. # @param [Hash] opts the optional parameters # @return [nil] def delete_live_stream_simulcast_target(live_stream_id, simulcast_target_id, opts = {}) delete_live_stream_simulcast_target_with_http_info(live_stream_id, simulcast_target_id, opts) nil end # Delete a Live Stream Simulcast Target # Delete the simulcast target using the simulcast target ID returned when creating the simulcast target. Simulcast Target can only be deleted when the parent live stream is in idle state. # @param live_stream_id [String] The live stream ID # @param simulcast_target_id [String] The ID of the simulcast target. # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def delete_live_stream_simulcast_target_with_http_info(live_stream_id, simulcast_target_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LiveStreamsApi.delete_live_stream_simulcast_target ...' end # verify the required parameter 'live_stream_id' is set if @api_client.config.client_side_validation && live_stream_id.nil? fail ArgumentError, "Missing the required parameter 'live_stream_id' when calling LiveStreamsApi.delete_live_stream_simulcast_target" end # verify the required parameter 'simulcast_target_id' is set if @api_client.config.client_side_validation && simulcast_target_id.nil? fail ArgumentError, "Missing the required parameter 'simulcast_target_id' when calling LiveStreamsApi.delete_live_stream_simulcast_target" end # resource path local_var_path = '/video/v1/live-streams/{LIVE_STREAM_ID}/simulcast-targets/{SIMULCAST_TARGET_ID}'.sub('{' + 'LIVE_STREAM_ID' + '}', CGI.escape(live_stream_id.to_s)).sub('{' + 'SIMULCAST_TARGET_ID' + '}', CGI.escape(simulcast_target_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || ['accessToken'] new_options = opts.merge( :operation => :"LiveStreamsApi.delete_live_stream_simulcast_target", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: LiveStreamsApi#delete_live_stream_simulcast_target\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Disable a live stream # Disables a live stream, making it reject incoming RTMP streams until re-enabled. The API also ends the live stream recording immediately when active. Ending the live stream recording adds the `EXT-X-ENDLIST` tag to the HLS manifest which notifies the player that this live stream is over. Mux also closes the encoder connection immediately. Any attempt from the encoder to re-establish connection will fail till the live stream is re-enabled. # @param live_stream_id [String] The live stream ID # @param [Hash] opts the optional parameters # @return [DisableLiveStreamResponse] def disable_live_stream(live_stream_id, opts = {}) data, _status_code, _headers = disable_live_stream_with_http_info(live_stream_id, opts) data end # Disable a live stream # Disables a live stream, making it reject incoming RTMP streams until re-enabled. The API also ends the live stream recording immediately when active. Ending the live stream recording adds the `EXT-X-ENDLIST` tag to the HLS manifest which notifies the player that this live stream is over. Mux also closes the encoder connection immediately. Any attempt from the encoder to re-establish connection will fail till the live stream is re-enabled. # @param live_stream_id [String] The live stream ID # @param [Hash] opts the optional parameters # @return [Array<(DisableLiveStreamResponse, Integer, Hash)>] DisableLiveStreamResponse data, response status code and response headers def disable_live_stream_with_http_info(live_stream_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LiveStreamsApi.disable_live_stream ...' end # verify the required parameter 'live_stream_id' is set if @api_client.config.client_side_validation && live_stream_id.nil? fail ArgumentError, "Missing the required parameter 'live_stream_id' when calling LiveStreamsApi.disable_live_stream" end # resource path local_var_path = '/video/v1/live-streams/{LIVE_STREAM_ID}/disable'.sub('{' + 'LIVE_STREAM_ID' + '}', CGI.escape(live_stream_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'DisableLiveStreamResponse' # auth_names auth_names = opts[:debug_auth_names] || ['accessToken'] new_options = opts.merge( :operation => :"LiveStreamsApi.disable_live_stream", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: LiveStreamsApi#disable_live_stream\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Enable a live stream # Enables a live stream, allowing it to accept an incoming RTMP stream. # @param live_stream_id [String] The live stream ID # @param [Hash] opts the optional parameters # @return [EnableLiveStreamResponse] def enable_live_stream(live_stream_id, opts = {}) data, _status_code, _headers = enable_live_stream_with_http_info(live_stream_id, opts) data end # Enable a live stream # Enables a live stream, allowing it to accept an incoming RTMP stream. # @param live_stream_id [String] The live stream ID # @param [Hash] opts the optional parameters # @return [Array<(EnableLiveStreamResponse, Integer, Hash)>] EnableLiveStreamResponse data, response status code and response headers def enable_live_stream_with_http_info(live_stream_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LiveStreamsApi.enable_live_stream ...' end # verify the required parameter 'live_stream_id' is set if @api_client.config.client_side_validation && live_stream_id.nil? fail ArgumentError, "Missing the required parameter 'live_stream_id' when calling LiveStreamsApi.enable_live_stream" end # resource path local_var_path = '/video/v1/live-streams/{LIVE_STREAM_ID}/enable'.sub('{' + 'LIVE_STREAM_ID' + '}', CGI.escape(live_stream_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'EnableLiveStreamResponse' # auth_names auth_names = opts[:debug_auth_names] || ['accessToken'] new_options = opts.merge( :operation => :"LiveStreamsApi.enable_live_stream", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: LiveStreamsApi#enable_live_stream\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Retrieve a live stream # Retrieves the details of a live stream that has previously been created. Supply the unique live stream ID that was returned from your previous request, and Mux will return the corresponding live stream information. The same information is returned when creating a live stream. # @param live_stream_id [String] The live stream ID # @param [Hash] opts the optional parameters # @return [LiveStreamResponse] def get_live_stream(live_stream_id, opts = {}) data, _status_code, _headers = get_live_stream_with_http_info(live_stream_id, opts) data end # Retrieve a live stream # Retrieves the details of a live stream that has previously been created. Supply the unique live stream ID that was returned from your previous request, and Mux will return the corresponding live stream information. The same information is returned when creating a live stream. # @param live_stream_id [String] The live stream ID # @param [Hash] opts the optional parameters # @return [Array<(LiveStreamResponse, Integer, Hash)>] LiveStreamResponse data, response status code and response headers def get_live_stream_with_http_info(live_stream_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LiveStreamsApi.get_live_stream ...' end # verify the required parameter 'live_stream_id' is set if @api_client.config.client_side_validation && live_stream_id.nil? fail ArgumentError, "Missing the required parameter 'live_stream_id' when calling LiveStreamsApi.get_live_stream" end # resource path local_var_path = '/video/v1/live-streams/{LIVE_STREAM_ID}'.sub('{' + 'LIVE_STREAM_ID' + '}', CGI.escape(live_stream_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'LiveStreamResponse' # auth_names auth_names = opts[:debug_auth_names] || ['accessToken'] new_options = opts.merge( :operation => :"LiveStreamsApi.get_live_stream", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: LiveStreamsApi#get_live_stream\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Retrieve a live stream playback ID # Fetches information about a live stream's playback ID, through which a viewer can watch the streamed content from this live stream. # @param live_stream_id [String] The live stream ID # @param playback_id [String] The live stream's playback ID. # @param [Hash] opts the optional parameters # @return [GetLiveStreamPlaybackIDResponse] def get_live_stream_playback_id(live_stream_id, playback_id, opts = {}) data, _status_code, _headers = get_live_stream_playback_id_with_http_info(live_stream_id, playback_id, opts) data end # Retrieve a live stream playback ID # Fetches information about a live stream's playback ID, through which a viewer can watch the streamed content from this live stream. # @param live_stream_id [String] The live stream ID # @param playback_id [String] The live stream's playback ID. # @param [Hash] opts the optional parameters # @return [Array<(GetLiveStreamPlaybackIDResponse, Integer, Hash)>] GetLiveStreamPlaybackIDResponse data, response status code and response headers def get_live_stream_playback_id_with_http_info(live_stream_id, playback_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LiveStreamsApi.get_live_stream_playback_id ...' end # verify the required parameter 'live_stream_id' is set if @api_client.config.client_side_validation && live_stream_id.nil? fail ArgumentError, "Missing the required parameter 'live_stream_id' when calling LiveStreamsApi.get_live_stream_playback_id" end # verify the required parameter 'playback_id' is set if @api_client.config.client_side_validation && playback_id.nil? fail ArgumentError, "Missing the required parameter 'playback_id' when calling LiveStreamsApi.get_live_stream_playback_id" end # resource path local_var_path = '/video/v1/live-streams/{LIVE_STREAM_ID}/playback-ids/{PLAYBACK_ID}'.sub('{' + 'LIVE_STREAM_ID' + '}', CGI.escape(live_stream_id.to_s)).sub('{' + 'PLAYBACK_ID' + '}', CGI.escape(playback_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'GetLiveStreamPlaybackIDResponse' # auth_names auth_names = opts[:debug_auth_names] || ['accessToken'] new_options = opts.merge( :operation => :"LiveStreamsApi.get_live_stream_playback_id", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: LiveStreamsApi#get_live_stream_playback_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Retrieve a Live Stream Simulcast Target # Retrieves the details of the simulcast target created for the parent live stream. Supply the unique live stream ID and simulcast target ID that was returned in the response of create simulcast target request, and Mux will return the corresponding information. # @param live_stream_id [String] The live stream ID # @param simulcast_target_id [String] The ID of the simulcast target. # @param [Hash] opts the optional parameters # @return [SimulcastTargetResponse] def get_live_stream_simulcast_target(live_stream_id, simulcast_target_id, opts = {}) data, _status_code, _headers = get_live_stream_simulcast_target_with_http_info(live_stream_id, simulcast_target_id, opts) data end # Retrieve a Live Stream Simulcast Target # Retrieves the details of the simulcast target created for the parent live stream. Supply the unique live stream ID and simulcast target ID that was returned in the response of create simulcast target request, and Mux will return the corresponding information. # @param live_stream_id [String] The live stream ID # @param simulcast_target_id [String] The ID of the simulcast target. # @param [Hash] opts the optional parameters # @return [Array<(SimulcastTargetResponse, Integer, Hash)>] SimulcastTargetResponse data, response status code and response headers def get_live_stream_simulcast_target_with_http_info(live_stream_id, simulcast_target_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LiveStreamsApi.get_live_stream_simulcast_target ...' end # verify the required parameter 'live_stream_id' is set if @api_client.config.client_side_validation && live_stream_id.nil? fail ArgumentError, "Missing the required parameter 'live_stream_id' when calling LiveStreamsApi.get_live_stream_simulcast_target" end # verify the required parameter 'simulcast_target_id' is set if @api_client.config.client_side_validation && simulcast_target_id.nil? fail ArgumentError, "Missing the required parameter 'simulcast_target_id' when calling LiveStreamsApi.get_live_stream_simulcast_target" end # resource path local_var_path = '/video/v1/live-streams/{LIVE_STREAM_ID}/simulcast-targets/{SIMULCAST_TARGET_ID}'.sub('{' + 'LIVE_STREAM_ID' + '}', CGI.escape(live_stream_id.to_s)).sub('{' + 'SIMULCAST_TARGET_ID' + '}', CGI.escape(simulcast_target_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'SimulcastTargetResponse' # auth_names auth_names = opts[:debug_auth_names] || ['accessToken'] new_options = opts.merge( :operation => :"LiveStreamsApi.get_live_stream_simulcast_target", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: LiveStreamsApi#get_live_stream_simulcast_target\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # List live streams # Lists the live streams that currently exist in the current environment. # @param [Hash] opts the optional parameters # @option opts [Integer] :limit Number of items to include in the response (default to 25) # @option opts [Integer] :page Offset by this many pages, of the size of `limit` (default to 1) # @option opts [String] :stream_key Filter response to return live stream for this stream key only # @option opts [LiveStreamStatus] :status Filter response to return live streams with the specified status only # @return [ListLiveStreamsResponse] def list_live_streams(opts = {}) data, _status_code, _headers = list_live_streams_with_http_info(opts) data end # List live streams # Lists the live streams that currently exist in the current environment. # @param [Hash] opts the optional parameters # @option opts [Integer] :limit Number of items to include in the response # @option opts [Integer] :page Offset by this many pages, of the size of `limit` # @option opts [String] :stream_key Filter response to return live stream for this stream key only # @option opts [LiveStreamStatus] :status Filter response to return live streams with the specified status only # @return [Array<(ListLiveStreamsResponse, Integer, Hash)>] ListLiveStreamsResponse data, response status code and response headers def list_live_streams_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LiveStreamsApi.list_live_streams ...' end # resource path local_var_path = '/video/v1/live-streams' # query parameters query_params = opts[:query_params] || {} query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? query_params[:'stream_key'] = opts[:'stream_key'] if !opts[:'stream_key'].nil? query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'ListLiveStreamsResponse' # auth_names auth_names = opts[:debug_auth_names] || ['accessToken'] new_options = opts.merge( :operation => :"LiveStreamsApi.list_live_streams", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: LiveStreamsApi#list_live_streams\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Reset a live stream's stream key # Reset a live stream key if you want to immediately stop the current stream key from working and create a new stream key that can be used for future broadcasts. # @param live_stream_id [String] The live stream ID # @param [Hash] opts the optional parameters # @return [LiveStreamResponse] def reset_stream_key(live_stream_id, opts = {}) data, _status_code, _headers = reset_stream_key_with_http_info(live_stream_id, opts) data end # Reset a live stream's stream key # Reset a live stream key if you want to immediately stop the current stream key from working and create a new stream key that can be used for future broadcasts. # @param live_stream_id [String] The live stream ID # @param [Hash] opts the optional parameters # @return [Array<(LiveStreamResponse, Integer, Hash)>] LiveStreamResponse data, response status code and response headers def reset_stream_key_with_http_info(live_stream_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LiveStreamsApi.reset_stream_key ...' end # verify the required parameter 'live_stream_id' is set if @api_client.config.client_side_validation && live_stream_id.nil? fail ArgumentError, "Missing the required parameter 'live_stream_id' when calling LiveStreamsApi.reset_stream_key" end # resource path local_var_path = '/video/v1/live-streams/{LIVE_STREAM_ID}/reset-stream-key'.sub('{' + 'LIVE_STREAM_ID' + '}', CGI.escape(live_stream_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'LiveStreamResponse' # auth_names auth_names = opts[:debug_auth_names] || ['accessToken'] new_options = opts.merge( :operation => :"LiveStreamsApi.reset_stream_key", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: LiveStreamsApi#reset_stream_key\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Signal a live stream is finished # (Optional) End the live stream recording immediately instead of waiting for the reconnect_window. `EXT-X-ENDLIST` tag is added to the HLS manifest which notifies the player that this live stream is over. Mux does not close the encoder connection immediately. Encoders are often configured to re-establish connections immediately which would result in a new recorded asset. For this reason, Mux waits for 60s before closing the connection with the encoder. This 60s timeframe is meant to give encoder operators a chance to disconnect from their end. # @param live_stream_id [String] The live stream ID # @param [Hash] opts the optional parameters # @return [SignalLiveStreamCompleteResponse] def signal_live_stream_complete(live_stream_id, opts = {}) data, _status_code, _headers = signal_live_stream_complete_with_http_info(live_stream_id, opts) data end # Signal a live stream is finished # (Optional) End the live stream recording immediately instead of waiting for the reconnect_window. `EXT-X-ENDLIST` tag is added to the HLS manifest which notifies the player that this live stream is over. Mux does not close the encoder connection immediately. Encoders are often configured to re-establish connections immediately which would result in a new recorded asset. For this reason, Mux waits for 60s before closing the connection with the encoder. This 60s timeframe is meant to give encoder operators a chance to disconnect from their end. # @param live_stream_id [String] The live stream ID # @param [Hash] opts the optional parameters # @return [Array<(SignalLiveStreamCompleteResponse, Integer, Hash)>] SignalLiveStreamCompleteResponse data, response status code and response headers def signal_live_stream_complete_with_http_info(live_stream_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LiveStreamsApi.signal_live_stream_complete ...' end # verify the required parameter 'live_stream_id' is set if @api_client.config.client_side_validation && live_stream_id.nil? fail ArgumentError, "Missing the required parameter 'live_stream_id' when calling LiveStreamsApi.signal_live_stream_complete" end # resource path local_var_path = '/video/v1/live-streams/{LIVE_STREAM_ID}/complete'.sub('{' + 'LIVE_STREAM_ID' + '}', CGI.escape(live_stream_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'SignalLiveStreamCompleteResponse' # auth_names auth_names = opts[:debug_auth_names] || ['accessToken'] new_options = opts.merge( :operation => :"LiveStreamsApi.signal_live_stream_complete", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: LiveStreamsApi#signal_live_stream_complete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update a live stream # Updates the parameters of a previously-created live stream. This currently supports a subset of variables. Supply the live stream ID and the updated parameters and Mux will return the corresponding live stream information. The information returned will be the same after update as for subsequent get live stream requests. # @param live_stream_id [String] The live stream ID # @param update_live_stream_request [UpdateLiveStreamRequest] # @param [Hash] opts the optional parameters # @return [LiveStreamResponse] def update_live_stream(live_stream_id, update_live_stream_request, opts = {}) data, _status_code, _headers = update_live_stream_with_http_info(live_stream_id, update_live_stream_request, opts) data end # Update a live stream # Updates the parameters of a previously-created live stream. This currently supports a subset of variables. Supply the live stream ID and the updated parameters and Mux will return the corresponding live stream information. The information returned will be the same after update as for subsequent get live stream requests. # @param live_stream_id [String] The live stream ID # @param update_live_stream_request [UpdateLiveStreamRequest] # @param [Hash] opts the optional parameters # @return [Array<(LiveStreamResponse, Integer, Hash)>] LiveStreamResponse data, response status code and response headers def update_live_stream_with_http_info(live_stream_id, update_live_stream_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LiveStreamsApi.update_live_stream ...' end # verify the required parameter 'live_stream_id' is set if @api_client.config.client_side_validation && live_stream_id.nil? fail ArgumentError, "Missing the required parameter 'live_stream_id' when calling LiveStreamsApi.update_live_stream" end # verify the required parameter 'update_live_stream_request' is set if @api_client.config.client_side_validation && update_live_stream_request.nil? fail ArgumentError, "Missing the required parameter 'update_live_stream_request' when calling LiveStreamsApi.update_live_stream" end # resource path local_var_path = '/video/v1/live-streams/{LIVE_STREAM_ID}'.sub('{' + 'LIVE_STREAM_ID' + '}', CGI.escape(live_stream_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(update_live_stream_request) # return_type return_type = opts[:debug_return_type] || 'LiveStreamResponse' # auth_names auth_names = opts[:debug_auth_names] || ['accessToken'] new_options = opts.merge( :operation => :"LiveStreamsApi.update_live_stream", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: LiveStreamsApi#update_live_stream\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update a live stream's embedded subtitles # Configures a live stream to receive embedded closed captions. The resulting Asset's subtitle text track will have `closed_captions: true` set. # @param live_stream_id [String] The live stream ID # @param update_live_stream_embedded_subtitles_request [UpdateLiveStreamEmbeddedSubtitlesRequest] # @param [Hash] opts the optional parameters # @return [LiveStreamResponse] def update_live_stream_embedded_subtitles(live_stream_id, update_live_stream_embedded_subtitles_request, opts = {}) data, _status_code, _headers = update_live_stream_embedded_subtitles_with_http_info(live_stream_id, update_live_stream_embedded_subtitles_request, opts) data end # Update a live stream's embedded subtitles # Configures a live stream to receive embedded closed captions. The resulting Asset's subtitle text track will have `closed_captions: true` set. # @param live_stream_id [String] The live stream ID # @param update_live_stream_embedded_subtitles_request [UpdateLiveStreamEmbeddedSubtitlesRequest] # @param [Hash] opts the optional parameters # @return [Array<(LiveStreamResponse, Integer, Hash)>] LiveStreamResponse data, response status code and response headers def update_live_stream_embedded_subtitles_with_http_info(live_stream_id, update_live_stream_embedded_subtitles_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LiveStreamsApi.update_live_stream_embedded_subtitles ...' end # verify the required parameter 'live_stream_id' is set if @api_client.config.client_side_validation && live_stream_id.nil? fail ArgumentError, "Missing the required parameter 'live_stream_id' when calling LiveStreamsApi.update_live_stream_embedded_subtitles" end # verify the required parameter 'update_live_stream_embedded_subtitles_request' is set if @api_client.config.client_side_validation && update_live_stream_embedded_subtitles_request.nil? fail ArgumentError, "Missing the required parameter 'update_live_stream_embedded_subtitles_request' when calling LiveStreamsApi.update_live_stream_embedded_subtitles" end # resource path local_var_path = '/video/v1/live-streams/{LIVE_STREAM_ID}/embedded-subtitles'.sub('{' + 'LIVE_STREAM_ID' + '}', CGI.escape(live_stream_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(update_live_stream_embedded_subtitles_request) # return_type return_type = opts[:debug_return_type] || 'LiveStreamResponse' # auth_names auth_names = opts[:debug_auth_names] || ['accessToken'] new_options = opts.merge( :operation => :"LiveStreamsApi.update_live_stream_embedded_subtitles", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: LiveStreamsApi#update_live_stream_embedded_subtitles\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end