class Twilio::REST::Video::V1::CompositionHookInstance
Public Class Methods
Initialize the CompositionHookInstance
@param [Version] version Version
that contains the resource @param [Hash] payload payload that contains response from Twilio
@param [String] sid The SID of the CompositionHook resource to fetch. @return [CompositionHookInstance] CompositionHookInstance
Twilio::REST::InstanceResource::new
# File lib/twilio-ruby/rest/video/v1/composition_hook.rb 416 def initialize(version, payload, sid: nil) 417 super(version) 418 419 # Marshaled Properties 420 @properties = { 421 'account_sid' => payload['account_sid'], 422 'friendly_name' => payload['friendly_name'], 423 'enabled' => payload['enabled'], 424 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), 425 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), 426 'sid' => payload['sid'], 427 'audio_sources' => payload['audio_sources'], 428 'audio_sources_excluded' => payload['audio_sources_excluded'], 429 'video_layout' => payload['video_layout'], 430 'resolution' => payload['resolution'], 431 'trim' => payload['trim'], 432 'format' => payload['format'], 433 'status_callback' => payload['status_callback'], 434 'status_callback_method' => payload['status_callback_method'], 435 'url' => payload['url'], 436 } 437 438 # Context 439 @instance_context = nil 440 @params = {'sid' => sid || @properties['sid'], } 441 end
Public Instance Methods
@return [String] The SID of the Account that created the resource
# File lib/twilio-ruby/rest/video/v1/composition_hook.rb 456 def account_sid 457 @properties['account_sid'] 458 end
@return [Array] The array of track names to include in the compositions created by the composition hook
# File lib/twilio-ruby/rest/video/v1/composition_hook.rb 492 def audio_sources 493 @properties['audio_sources'] 494 end
@return [Array] The array of track names to exclude from the compositions created by the composition hook
# File lib/twilio-ruby/rest/video/v1/composition_hook.rb 498 def audio_sources_excluded 499 @properties['audio_sources_excluded'] 500 end
Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context @return [CompositionHookContext] CompositionHookContext
for this CompositionHookInstance
# File lib/twilio-ruby/rest/video/v1/composition_hook.rb 447 def context 448 unless @instance_context 449 @instance_context = CompositionHookContext.new(@version, @params['sid'], ) 450 end 451 @instance_context 452 end
@return [Time] The ISO 8601 date and time in GMT when the resource was created
# File lib/twilio-ruby/rest/video/v1/composition_hook.rb 474 def date_created 475 @properties['date_created'] 476 end
@return [Time] The ISO 8601 date and time in GMT when the resource was last updated
# File lib/twilio-ruby/rest/video/v1/composition_hook.rb 480 def date_updated 481 @properties['date_updated'] 482 end
Delete the CompositionHookInstance
@return [Boolean] true if delete succeeds, false otherwise
# File lib/twilio-ruby/rest/video/v1/composition_hook.rb 554 def delete 555 context.delete 556 end
@return [Boolean] Whether the CompositionHook is active
# File lib/twilio-ruby/rest/video/v1/composition_hook.rb 468 def enabled 469 @properties['enabled'] 470 end
Fetch the CompositionHookInstance
@return [CompositionHookInstance] Fetched CompositionHookInstance
# File lib/twilio-ruby/rest/video/v1/composition_hook.rb 547 def fetch 548 context.fetch 549 end
@return [composition_hook.Format] The container format of the media files used by the compositions created by the composition hook
# File lib/twilio-ruby/rest/video/v1/composition_hook.rb 522 def format 523 @properties['format'] 524 end
@return [String] The string that you assigned to describe the resource
# File lib/twilio-ruby/rest/video/v1/composition_hook.rb 462 def friendly_name 463 @properties['friendly_name'] 464 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/video/v1/composition_hook.rb 649 def inspect 650 values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") 651 "<Twilio.Video.V1.CompositionHookInstance #{values}>" 652 end
@return [String] The dimensions of the video image in pixels expressed as columns (width) and rows (height)
# File lib/twilio-ruby/rest/video/v1/composition_hook.rb 510 def resolution 511 @properties['resolution'] 512 end
@return [String] The unique string that identifies the resource
# File lib/twilio-ruby/rest/video/v1/composition_hook.rb 486 def sid 487 @properties['sid'] 488 end
@return [String] The URL to send status information to your application
# File lib/twilio-ruby/rest/video/v1/composition_hook.rb 528 def status_callback 529 @properties['status_callback'] 530 end
@return [String] The HTTP
method we should use to call status_callback
# File lib/twilio-ruby/rest/video/v1/composition_hook.rb 534 def status_callback_method 535 @properties['status_callback_method'] 536 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/video/v1/composition_hook.rb 642 def to_s 643 values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") 644 "<Twilio.Video.V1.CompositionHookInstance #{values}>" 645 end
@return [Boolean] Whether intervals with no media are clipped
# File lib/twilio-ruby/rest/video/v1/composition_hook.rb 516 def trim 517 @properties['trim'] 518 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 625 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) 626 context.update( 627 friendly_name: friendly_name, 628 enabled: enabled, 629 video_layout: video_layout, 630 audio_sources: audio_sources, 631 audio_sources_excluded: audio_sources_excluded, 632 trim: trim, 633 format: format, 634 resolution: resolution, 635 status_callback: status_callback, 636 status_callback_method: status_callback_method, 637 ) 638 end
@return [String] The absolute URL of the resource
# File lib/twilio-ruby/rest/video/v1/composition_hook.rb 540 def url 541 @properties['url'] 542 end
@return [Hash] A JSON object that describes the video layout of the Composition
# File lib/twilio-ruby/rest/video/v1/composition_hook.rb 504 def video_layout 505 @properties['video_layout'] 506 end