class Twilio::REST::Video::V1::CompositionHookContext
Public Class Methods
Initialize the CompositionHookContext
@param [Version] version Version
that contains the resource @param [String] sid The SID of the CompositionHook resource to fetch. @return [CompositionHookContext] CompositionHookContext
Twilio::REST::InstanceContext::new
# File lib/twilio-ruby/rest/video/v1/composition_hook.rb 284 def initialize(version, sid) 285 super(version) 286 287 # Path Solution 288 @solution = {sid: sid, } 289 @uri = "/CompositionHooks/#{@solution[:sid]}" 290 end
Public Instance Methods
Delete the CompositionHookInstance
@return [Boolean] true if delete succeeds, false otherwise
# File lib/twilio-ruby/rest/video/v1/composition_hook.rb 304 def delete 305 @version.delete('DELETE', @uri) 306 end
Fetch the CompositionHookInstance
@return [CompositionHookInstance] Fetched CompositionHookInstance
# File lib/twilio-ruby/rest/video/v1/composition_hook.rb 295 def fetch 296 payload = @version.fetch('GET', @uri) 297 298 CompositionHookInstance.new(@version, payload, sid: @solution[:sid], ) 299 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/video/v1/composition_hook.rb 403 def inspect 404 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 405 "#<Twilio.Video.V1.CompositionHookContext #{context}>" 406 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/video/v1/composition_hook.rb 396 def to_s 397 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 398 "#<Twilio.Video.V1.CompositionHookContext #{context}>" 399 end
Update the CompositionHookInstance
@param [String] friendly_name A descriptive string that you create to describe
the resource. It can be up to 100 characters long and it must be unique within the account.
@param [Boolean] enabled Whether the composition hook is active. When `true`,
the composition hook will be triggered for every completed Group Room in the account. When `false`, the composition hook never triggers.
@param [Hash] video_layout A JSON object that describes the video layout of the
composition hook in terms of regions. See {Specifying Video Layouts}[https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts] for more info.
@param [Array] audio_sources An array of track names from the same group
room to merge into the compositions created by the composition hook. Can include zero or more track names. A composition triggered by the composition hook includes all audio sources specified in `audio_sources` except those specified in `audio_sources_excluded`. The track names in this parameter can include an asterisk as a wild card character, which matches zero or more characters in a track name. For example, `student*` includes tracks named `student` as well as `studentTeam`.
@param [Array] audio_sources_excluded An array of track names to
exclude. A composition triggered by the composition hook includes all audio sources specified in `audio_sources` except for those specified in `audio_sources_excluded`. The track names in this parameter can include an asterisk as a wild card character, which matches zero or more characters in a track name. For example, `student*` excludes `student` as well as `studentTeam`. This parameter can also be empty.
@param [Boolean] trim Whether to clip the intervals where there is no active
media in the compositions triggered by the composition hook. The default is `true`. Compositions with `trim` enabled are shorter when the Room is created and no Participant joins for a while as well as if all the Participants leave the room and join later, because those gaps will be removed. See {Specifying Video Layouts}[https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts] for more info.
@param [composition_hook.Format] format The container format of the media files
used by the compositions created by the composition hook. Can be: `mp4` or `webm` and the default is `webm`. If `mp4` or `webm`, `audio_sources` must have one or more tracks and/or a `video_layout` element must contain a valid `video_sources` list, otherwise an error occurs.
@param [String] resolution A string that describes the columns (width) and rows
(height) of the generated composed video in pixels. Defaults to `640x480`. The string's format is `{width}x{height}` where: * 16 <= `{width}` <= 1280 * 16 <= `{height}` <= 1280 * `{width}` * `{height}` <= 921,600 Typical values are: * HD = `1280x720` * PAL = `1024x576` * VGA = `640x480` * CIF = `320x240` Note that the `resolution` imposes an aspect ratio to the resulting composition. When the original video tracks are constrained by the aspect ratio, they are scaled to fit. See {Specifying Video Layouts}[https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts] for more info.
@param [String] status_callback The URL we should call using the
`status_callback_method` to send status information to your application on every composition event. If not provided, status callback events will not be dispatched.
@param [String] status_callback_method The HTTP
method we should use to call
`status_callback`. Can be: `POST` or `GET` and the default is `POST`.
@return [CompositionHookInstance] Updated CompositionHookInstance
# File lib/twilio-ruby/rest/video/v1/composition_hook.rb 375 def update(friendly_name: nil, enabled: :unset, video_layout: :unset, audio_sources: :unset, audio_sources_excluded: :unset, trim: :unset, format: :unset, resolution: :unset, status_callback: :unset, status_callback_method: :unset) 376 data = Twilio::Values.of({ 377 'FriendlyName' => friendly_name, 378 'Enabled' => enabled, 379 'VideoLayout' => Twilio.serialize_object(video_layout), 380 'AudioSources' => Twilio.serialize_list(audio_sources) { |e| e }, 381 'AudioSourcesExcluded' => Twilio.serialize_list(audio_sources_excluded) { |e| e }, 382 'Trim' => trim, 383 'Format' => format, 384 'Resolution' => resolution, 385 'StatusCallback' => status_callback, 386 'StatusCallbackMethod' => status_callback_method, 387 }) 388 389 payload = @version.update('POST', @uri, data: data) 390 391 CompositionHookInstance.new(@version, payload, sid: @solution[:sid], ) 392 end