Class: Ooyala::LiveStream
- Inherits:
-
Object
- Object
- Ooyala::LiveStream
- Defined in:
- lib/ooyala/live_stream.rb
Instance Attribute Summary collapse
-
#result ⇒ Object
readonly
Returns the value of attribute result.
Instance Method Summary collapse
-
#encodings=(enc) ⇒ Object
Transforms encodings as a string (1280:720:800;1280:720:1500;1280:720:2500;) to their final required format- [ { “width”: 800, “height”: 600, “bitrate”: 600 }, { “width”: 800, “height”: 600, “bitrate”: 300 }, { “width”: 400, “height”: 300, “bitrate”: 200 } ] - See more at: support.ooyala.com/developers/documentation/api/asset_livestream.html#sthash.7v0KBwAI.dpuf.
-
#initialize(api, options = {}) ⇒ LiveStream
constructor
A new instance of LiveStream.
- #publish ⇒ Object
Constructor Details
#initialize(api, options = {}) ⇒ LiveStream
Returns a new instance of LiveStream.
9 10 11 12 13 14 15 16 17 |
# File 'lib/ooyala/live_stream.rb', line 9 def initialize(api, = {}) @api = api = .merge({ asset_type: "live_stream", is_flash: true, is_ios: true, primary_encoder_ip: UDPSocket.open {|s| s.connect("64.233.187.99", 1); s.addr.last} }) end |
Instance Attribute Details
#result ⇒ Object (readonly)
Returns the value of attribute result.
7 8 9 |
# File 'lib/ooyala/live_stream.rb', line 7 def result @result end |
Instance Method Details
#encodings=(enc) ⇒ Object
Transforms encodings as a string (1280:720:800;1280:720:1500;1280:720:2500;) to their final required format- [
{ "width": 800, "height": 600, "bitrate": 600 },
{ "width": 800, "height": 600, "bitrate": 300 },
{ "width": 400, "height": 300, "bitrate": 200 }
] - See more at: support.ooyala.com/developers/documentation/api/asset_livestream.html#sthash.7v0KBwAI.dpuf
26 27 28 29 |
# File 'lib/ooyala/live_stream.rb', line 26 def encodings=(enc) formatted = enc.split(";").map {|i| i.split(":") }.map { |item| { width: item.shift, height: item.shift, bitrate: item.shift } } [:encodings] = formatted end |
#publish ⇒ Object
31 32 33 34 |
# File 'lib/ooyala/live_stream.rb', line 31 def publish @result = @api.post('assets', ) @result end |