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.



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

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



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

def delete

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    @version.delete('DELETE', @uri, headers: headers)
end

#fetchCompositionHookInstance

Fetch the CompositionHookInstance

Returns:



236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
# File 'lib/twilio-ruby/rest/video/v1/composition_hook.rb', line 236

def fetch

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.fetch('GET', @uri, headers: headers)
    CompositionHookInstance.new(
        @version,
        payload,
        sid: @solution[:sid],
    )
end

#inspectObject

Provide a detailed, user friendly representation



315
316
317
318
# File 'lib/twilio-ruby/rest/video/v1/composition_hook.rb', line 315

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

#to_sObject

Provide a user friendly representation



308
309
310
311
# File 'lib/twilio-ruby/rest/video/v1/composition_hook.rb', line 308

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:



265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
# File 'lib/twilio-ruby/rest/video/v1/composition_hook.rb', line 265

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,
    })

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.update('POST', @uri, data: data, headers: headers)
    CompositionHookInstance.new(
        @version,
        payload,
        sid: @solution[:sid],
    )
end