Class: Twilio::REST::Video::V1::CompositionHookContext

Inherits:
InstanceContext show all
Defined in:
lib/twilio-ruby/rest/video/v1/composition_hook.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, sid) ⇒ CompositionHookContext

Initialize the CompositionHookContext

Parameters:

  • version (Version)

    Version that contains the resource

  • sid (String)

    The SID of the CompositionHook resource to update.



202
203
204
205
206
207
208
209
210
# File 'lib/twilio-ruby/rest/video/v1/composition_hook.rb', line 202

def initialize(version, sid)
    super(version)

    # Path Solution
    @solution = { sid: sid,  }
    @uri = "/CompositionHooks/#{@solution[:sid]}"

    
end

Instance Method Details

#deleteBoolean

Delete the CompositionHookInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



214
215
216
217
# File 'lib/twilio-ruby/rest/video/v1/composition_hook.rb', line 214

def delete

    @version.delete('DELETE', @uri)
end

#fetchCompositionHookInstance

Fetch the CompositionHookInstance

Returns:



222
223
224
225
226
227
228
229
230
# File 'lib/twilio-ruby/rest/video/v1/composition_hook.rb', line 222

def fetch

    payload = @version.fetch('GET', @uri)
    CompositionHookInstance.new(
        @version,
        payload,
        sid: @solution[:sid],
    )
end

#inspectObject

Provide a detailed, user friendly representation



289
290
291
292
# File 'lib/twilio-ruby/rest/video/v1/composition_hook.rb', line 289

def inspect
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Video.V1.CompositionHookContext #{context}>"
end

#to_sObject

Provide a user friendly representation



282
283
284
285
# File 'lib/twilio-ruby/rest/video/v1/composition_hook.rb', line 282

def to_s
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Video.V1.CompositionHookContext #{context}>"
end

#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) ⇒ CompositionHookInstance

Update the CompositionHookInstance

Parameters:

  • friendly_name (String) (defaults to: nil)

    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.

  • enabled (Boolean) (defaults to: :unset)

    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.

  • video_layout (Object) (defaults to: :unset)

    A JSON object that describes the video layout of the composition hook in terms of regions. See [Specifying Video Layouts](www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info.

  • audio_sources (Array[String]) (defaults to: :unset)

    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`.

  • audio_sources_excluded (Array[String]) (defaults to: :unset)

    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.

  • trim (Boolean) (defaults to: :unset)

    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](www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info.

  • format (Format) (defaults to: :unset)
  • resolution (String) (defaults to: :unset)

    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 ‘widthxheight` 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](www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info.

  • status_callback (String) (defaults to: :unset)

    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.

  • status_callback_method (String) (defaults to: :unset)

    The HTTP method we should use to call ‘status_callback`. Can be: `POST` or `GET` and the default is `POST`.

Returns:



245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
# File 'lib/twilio-ruby/rest/video/v1/composition_hook.rb', line 245

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
)

    data = Twilio::Values.of({
        'FriendlyName' => friendly_name,
        'Enabled' => enabled,
        'VideoLayout' => Twilio.serialize_object(video_layout),
        'AudioSources' => Twilio.serialize_list(audio_sources) { |e| e },
        'AudioSourcesExcluded' => Twilio.serialize_list(audio_sources_excluded) { |e| e },
        'Trim' => trim,
        'Format' => format,
        'Resolution' => resolution,
        'StatusCallback' => status_callback,
        'StatusCallbackMethod' => status_callback_method,
    })

    payload = @version.update('POST', @uri, data: data)
    CompositionHookInstance.new(
        @version,
        payload,
        sid: @solution[:sid],
    )
end