Class: Vonage::Video::Broadcasts

Inherits:
Namespace
  • Object
show all
Defined in:
lib/vonage/video/broadcasts.rb

Defined Under Namespace

Classes: ListResponse

Instance Method Summary collapse

Instance Method Details

#add_stream(broadcast_id:, stream_id:, **params) ⇒ Object

Add a stream to a live streaming broadcast.



48
49
50
51
52
53
54
# File 'lib/vonage/video/broadcasts.rb', line 48

def add_stream(broadcast_id:, stream_id:, **params)
  request(
    '/v2/project/' + @config.application_id + '/broadcast/' + broadcast_id + '/streams',
    params: camelcase(params.merge(addStream: stream_id)),
    type: Patch
  )
end

#change_layout(broadcast_id:, **params) ⇒ Object

Dynamically change layout of a broadcast.



68
69
70
71
72
73
# File 'lib/vonage/video/broadcasts.rb', line 68

def change_layout(broadcast_id:, **params)
  request(
    '/v2/project/' + @config.application_id + '/broadcast/' + broadcast_id + '/layout',
    params: camelcase(params),
    type: Put)
end

#info(broadcast_id:) ⇒ Object

Return information for specified broadcast.



25
26
27
# File 'lib/vonage/video/broadcasts.rb', line 25

def info(broadcast_id:)
  request('/v2/project/' + @config.application_id + '/broadcast/' + broadcast_id)
end

#list(**params) ⇒ Object

Get a list of live streaming broadcasts for a specified Vonage application.



16
17
18
19
20
21
# File 'lib/vonage/video/broadcasts.rb', line 16

def list(**params)
  path = '/v2/project/' + @config.application_id + '/broadcast'
  path += "?#{Params.encode(camelcase(params))}" unless params.empty?

  request(path, response_class: ListResponse)
end

#remove_stream(broadcast_id:, stream_id:) ⇒ Object

Remove a stream from a live streaming broadcast.



58
59
60
61
62
63
64
# File 'lib/vonage/video/broadcasts.rb', line 58

def remove_stream(broadcast_id:, stream_id:)
  request(
    '/v2/project/' + @config.application_id + '/broadcast/' + broadcast_id + '/streams',
    params: {removeStream: stream_id},
    type: Patch
  )
end

#start(session_id:, **params) ⇒ Object

Start a new live streaming broadcast.



31
32
33
34
35
36
37
# File 'lib/vonage/video/broadcasts.rb', line 31

def start(session_id:, **params)
  request(
    '/v2/project/' + @config.application_id + '/broadcast',
    params: camelcase(params.merge(session_id: session_id)),
    type: Post
  )
end

#stop(broadcast_id:) ⇒ Object

Stop a specified broadcast.



41
42
43
# File 'lib/vonage/video/broadcasts.rb', line 41

def stop(broadcast_id:)
  request('/v2/project/' + @config.application_id + '/broadcast/' + broadcast_id + '/stop', type: Post)
end