Class: WowzaCloud::Stream

Inherits:
Client
  • Object
show all
Defined in:
lib/wowza_cloud/stream.rb

Instance Attribute Summary collapse

Attributes inherited from Client

#headers

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ Stream

Returns a new instance of Stream.



28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/wowza_cloud/stream.rb', line 28

def initialize(params = {})
  super
  params.each do |k, v|
    instance_variable_set(:"@#{k}", v) if self.respond_to?("#{k}=")
  end
  if(conn_params = params['source_connection_information'])
    self.streaming_server = conn_params['primary_server']
    self.stream_name      = conn_params['stream_name']
    self.disable_authentication = conn_params['disable_authentication']
    self.username = conn_params['username']
    self.password = conn_params['password']
  end
end

Instance Attribute Details

#access_keyObject

Returns the value of attribute access_key.



3
4
5
# File 'lib/wowza_cloud/stream.rb', line 3

def access_key
  @access_key
end

#api_keyObject

Returns the value of attribute api_key.



3
4
5
# File 'lib/wowza_cloud/stream.rb', line 3

def api_key
  @api_key
end

#aspect_ratio_heightObject

Returns the value of attribute aspect_ratio_height.



3
4
5
# File 'lib/wowza_cloud/stream.rb', line 3

def aspect_ratio_height
  @aspect_ratio_height
end

#aspect_ratio_widthObject

Returns the value of attribute aspect_ratio_width.



3
4
5
# File 'lib/wowza_cloud/stream.rb', line 3

def aspect_ratio_width
  @aspect_ratio_width
end

#billing_modeObject

Returns the value of attribute billing_mode.



3
4
5
# File 'lib/wowza_cloud/stream.rb', line 3

def billing_mode
  @billing_mode
end

#broadcast_locationObject

Returns the value of attribute broadcast_location.



3
4
5
# File 'lib/wowza_cloud/stream.rb', line 3

def broadcast_location
  @broadcast_location
end

#closed_caption_typeObject

Returns the value of attribute closed_caption_type.



3
4
5
# File 'lib/wowza_cloud/stream.rb', line 3

def closed_caption_type
  @closed_caption_type
end

#connection_codeObject

Returns the value of attribute connection_code.



3
4
5
# File 'lib/wowza_cloud/stream.rb', line 3

def connection_code
  @connection_code
end

#connection_code_expires_atObject

Returns the value of attribute connection_code_expires_at.



3
4
5
# File 'lib/wowza_cloud/stream.rb', line 3

def connection_code_expires_at
  @connection_code_expires_at
end

#delivery_methodObject

Returns the value of attribute delivery_method.



3
4
5
# File 'lib/wowza_cloud/stream.rb', line 3

def delivery_method
  @delivery_method
end

#delivery_protocolObject

Returns the value of attribute delivery_protocol.



3
4
5
# File 'lib/wowza_cloud/stream.rb', line 3

def delivery_protocol
  @delivery_protocol
end

#delivery_protocolsObject

Returns the value of attribute delivery_protocols.



3
4
5
# File 'lib/wowza_cloud/stream.rb', line 3

def delivery_protocols
  @delivery_protocols
end

#delivery_typeObject

Returns the value of attribute delivery_type.



3
4
5
# File 'lib/wowza_cloud/stream.rb', line 3

def delivery_type
  @delivery_type
end

#disable_authenticationObject

Returns the value of attribute disable_authentication.



3
4
5
# File 'lib/wowza_cloud/stream.rb', line 3

def disable_authentication
  @disable_authentication
end

#encoderObject

Returns the value of attribute encoder.



3
4
5
# File 'lib/wowza_cloud/stream.rb', line 3

def encoder
  @encoder
end

#hosted_pageObject

Returns the value of attribute hosted_page.



3
4
5
# File 'lib/wowza_cloud/stream.rb', line 3

def hosted_page
  @hosted_page
end

#hosted_page_descriptionObject

Returns the value of attribute hosted_page_description.



3
4
5
# File 'lib/wowza_cloud/stream.rb', line 3

def hosted_page_description
  @hosted_page_description
end

#hosted_page_logo_imageObject

Returns the value of attribute hosted_page_logo_image.



3
4
5
# File 'lib/wowza_cloud/stream.rb', line 3

def hosted_page_logo_image
  @hosted_page_logo_image
end

#hosted_page_sharing_iconsObject

Returns the value of attribute hosted_page_sharing_icons.



3
4
5
# File 'lib/wowza_cloud/stream.rb', line 3

def hosted_page_sharing_icons
  @hosted_page_sharing_icons
end

#hosted_page_titleObject

Returns the value of attribute hosted_page_title.



3
4
5
# File 'lib/wowza_cloud/stream.rb', line 3

def hosted_page_title
  @hosted_page_title
end

#idObject

Returns the value of attribute id.



3
4
5
# File 'lib/wowza_cloud/stream.rb', line 3

def id
  @id
end

#low_latencyObject

Returns the value of attribute low_latency.



3
4
5
# File 'lib/wowza_cloud/stream.rb', line 3

def low_latency
  @low_latency
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/wowza_cloud/stream.rb', line 3

def name
  @name
end

#passwordObject

Returns the value of attribute password.



3
4
5
# File 'lib/wowza_cloud/stream.rb', line 3

def password
  @password
end

#player_countdownObject

Returns the value of attribute player_countdown.



3
4
5
# File 'lib/wowza_cloud/stream.rb', line 3

def player_countdown
  @player_countdown
end

#player_countdown_atObject

Returns the value of attribute player_countdown_at.



3
4
5
# File 'lib/wowza_cloud/stream.rb', line 3

def player_countdown_at
  @player_countdown_at
end

#player_embed_codeObject

Returns the value of attribute player_embed_code.



3
4
5
# File 'lib/wowza_cloud/stream.rb', line 3

def player_embed_code
  @player_embed_code
end

#player_idObject

Returns the value of attribute player_id.



3
4
5
# File 'lib/wowza_cloud/stream.rb', line 3

def player_id
  @player_id
end

#player_logo_imageObject

Returns the value of attribute player_logo_image.



3
4
5
# File 'lib/wowza_cloud/stream.rb', line 3

def player_logo_image
  @player_logo_image
end

#player_resposiveObject

Returns the value of attribute player_resposive.



3
4
5
# File 'lib/wowza_cloud/stream.rb', line 3

def player_resposive
  @player_resposive
end

#player_typeObject

Returns the value of attribute player_type.



3
4
5
# File 'lib/wowza_cloud/stream.rb', line 3

def player_type
  @player_type
end

#player_video_poster_imageObject

Returns the value of attribute player_video_poster_image.



3
4
5
# File 'lib/wowza_cloud/stream.rb', line 3

def player_video_poster_image
  @player_video_poster_image
end

#player_widthObject

Returns the value of attribute player_width.



3
4
5
# File 'lib/wowza_cloud/stream.rb', line 3

def player_width
  @player_width
end

#recordingObject

Returns the value of attribute recording.



3
4
5
# File 'lib/wowza_cloud/stream.rb', line 3

def recording
  @recording
end

#remove_hosted_page_logo_imageObject

Returns the value of attribute remove_hosted_page_logo_image.



3
4
5
# File 'lib/wowza_cloud/stream.rb', line 3

def remove_hosted_page_logo_image
  @remove_hosted_page_logo_image
end

#remove_player_video_poster_imageObject

Returns the value of attribute remove_player_video_poster_image.



3
4
5
# File 'lib/wowza_cloud/stream.rb', line 3

def remove_player_video_poster_image
  @remove_player_video_poster_image
end

#source_connection_informationObject

Returns the value of attribute source_connection_information.



3
4
5
# File 'lib/wowza_cloud/stream.rb', line 3

def source_connection_information
  @source_connection_information
end

#source_urlObject

Returns the value of attribute source_url.



3
4
5
# File 'lib/wowza_cloud/stream.rb', line 3

def source_url
  @source_url
end

#stream_nameObject

Returns the value of attribute stream_name.



3
4
5
# File 'lib/wowza_cloud/stream.rb', line 3

def stream_name
  @stream_name
end

#streaming_serverObject

Returns the value of attribute streaming_server.



3
4
5
# File 'lib/wowza_cloud/stream.rb', line 3

def streaming_server
  @streaming_server
end

#target_delivery_protocolObject

Returns the value of attribute target_delivery_protocol.



3
4
5
# File 'lib/wowza_cloud/stream.rb', line 3

def target_delivery_protocol
  @target_delivery_protocol
end

#transcoder_typeObject

Returns the value of attribute transcoder_type.



3
4
5
# File 'lib/wowza_cloud/stream.rb', line 3

def transcoder_type
  @transcoder_type
end

#use_stream_sourceObject

Returns the value of attribute use_stream_source.



3
4
5
# File 'lib/wowza_cloud/stream.rb', line 3

def use_stream_source
  @use_stream_source
end

#usernameObject

Returns the value of attribute username.



3
4
5
# File 'lib/wowza_cloud/stream.rb', line 3

def username
  @username
end

#video_fallbackObject

Returns the value of attribute video_fallback.



3
4
5
# File 'lib/wowza_cloud/stream.rb', line 3

def video_fallback
  @video_fallback
end

Class Method Details

.allObject



11
12
13
14
15
16
17
18
19
# File 'lib/wowza_cloud/stream.rb', line 11

def self.all()
  result = []
  headers = {'wsc-api-key' => WowzaCloud.configuration.api_key, 'wsc-access-key' => WowzaCloud.configuration.access_key}
  raw_result = get('/live_streams', headers: headers)
  raw_result['live_streams'].each do |data|
    result << WowzaCloud::Stream.new(data)
  end
  return result
end

.get_stream(stream_id) ⇒ Object



21
22
23
24
25
# File 'lib/wowza_cloud/stream.rb', line 21

def self.get_stream(stream_id)
  headers    = {'wsc-api-key' => WowzaCloud.configuration.api_key, 'wsc-access-key' => WowzaCloud.configuration.access_key}
  raw_result = get("/live_streams/#{stream_id}", headers: headers)
  return WowzaCloud::Stream.new(raw_result['live_stream'])
end

Instance Method Details

#resetObject



69
70
71
72
# File 'lib/wowza_cloud/stream.rb', line 69

def reset
  raw_response = self.class.put("/live_streams/#{self.id}/reset", headers: @headers) 
  return raw_response['live_stream']['state']
end

#scheduleObject

Returns the first active schedule attached to this stream, if one exists



80
81
82
# File 'lib/wowza_cloud/stream.rb', line 80

def schedule
  Schedule.all.select{|s| s.transcoder_id == @id && s.state == 'enabled' }.first
end

#schedulesObject



84
85
86
# File 'lib/wowza_cloud/stream.rb', line 84

def schedules
  Schedule.all.select{|s| s.transcoder_id == @id } 
end

#startObject



64
65
66
67
# File 'lib/wowza_cloud/stream.rb', line 64

def start
  raw_response = self.class.put("/live_streams/#{self.id}/start", headers: @headers) 
  return raw_response['live_stream']['state']
end

#statsObject



54
55
56
57
# File 'lib/wowza_cloud/stream.rb', line 54

def stats
  raw_response = self.class.get("/live_streams/#{self.id}/stats", headers: @headers) 
  return raw_response['live_stream']
end

#statusObject Also known as: state

end



47
48
49
50
# File 'lib/wowza_cloud/stream.rb', line 47

def status
  raw_response = self.class.get("/live_streams/#{self.id}/state/", headers: @headers) 
  return raw_response['live_stream']['state']
end

#stopObject



74
75
76
77
# File 'lib/wowza_cloud/stream.rb', line 74

def stop
  raw_response = self.class.put("/live_streams/#{self.id}/stop", headers: @headers) 
  return raw_response['live_stream']['state']
end

#thumbnailObject



59
60
61
62
# File 'lib/wowza_cloud/stream.rb', line 59

def thumbnail
  raw_response = self.class.get("/live_streams/#{self.id}/thumbnail_url", headers: @headers) 
  return raw_response['live_stream']['thumbnail_url']
end