Module: WscSdk::TranscoderSharedMethods
- Included in:
- Models::LiveStream, Models::Transcoder
- Defined in:
- lib/wsc_sdk/modules/transcoder_shared_methods.rb
Overview
Module for providing methods to handle state actions and transitions for a Transcoder or Live Stream model, since they have a lot of shared functionality.
Instance Method Summary collapse
-
#reset(options = {}) {|wait_state, transcoder_state| ... } ⇒ WscSdk::Model::TranscoderState
Reset the transcoder/live stream.
-
#start(options = {}) {|wait_state, transcoder_state| ... } ⇒ WscSdk::Model::TranscoderState
Start the transcoder/live stream.
-
#state ⇒ WscSdk::Model::TranscoderState
Return the current state of the transcoder/live stream.
-
#stats ⇒ WscSdk::Model::TranscoderStats
Return the url of the current stats for the transcoder/live stream.
-
#stop(options = {}) {|wait_state, transcoder_state| ... } ⇒ WscSdk::Model::TranscoderState
Stop the transcoder.
-
#thumbnail_url ⇒ WscSdk::Model::TranscoderThumbnailUrl
Return the url of the current thumbnail for transcoder/live stream.
Instance Method Details
#reset(options = {}) {|wait_state, transcoder_state| ... } ⇒ WscSdk::Model::TranscoderState
Reset the transcoder/live stream
If a block is passed to the call, the SDK will start a state request loop that checks the state of the transcoder for a given period of time (timeout). Each iteration of the wait loop will call the block with the current state of the wait loop, and the current state of the transcoder
The wait state will be one of 3 options: :waiting, :complete or :timeout
The loop will exit when the transcoder state is “started” or the timeout limit is reached.
147 148 149 150 151 |
# File 'lib/wsc_sdk/modules/transcoder_shared_methods.rb', line 147 def reset(={}, &block) current_state = self.endpoint.reset(self.id) return wait_for_state(:started, , &block) if current_state.success? and block_given? return current_state end |
#start(options = {}) {|wait_state, transcoder_state| ... } ⇒ WscSdk::Model::TranscoderState
Start the transcoder/live stream
If a block is passed to the call, the SDK will start a state request loop that checks the state of the transcoder for a given period of time (timeout). Each iteration of the wait loop will call the block with the current state of the wait loop, and the current state of the transcoder
The wait state will be one of 3 options: :waiting, :complete or :timeout
The loop will exit when the transcoder state is “started” or the timeout limit is reached.
59 60 61 62 63 |
# File 'lib/wsc_sdk/modules/transcoder_shared_methods.rb', line 59 def start(={}, &block) current_state = self.endpoint.start(self.id) return wait_for_state(:started, , &block) if current_state.success? and block_given? return current_state end |
#state ⇒ WscSdk::Model::TranscoderState
Return the current state of the transcoder/live stream.
157 158 159 |
# File 'lib/wsc_sdk/modules/transcoder_shared_methods.rb', line 157 def state return self.endpoint.state(self.id) end |
#stats ⇒ WscSdk::Model::TranscoderStats
Return the url of the current stats for the transcoder/live stream.
174 175 176 |
# File 'lib/wsc_sdk/modules/transcoder_shared_methods.rb', line 174 def stats return self.endpoint.stats(self.id) end |
#stop(options = {}) {|wait_state, transcoder_state| ... } ⇒ WscSdk::Model::TranscoderState
Stop the transcoder
If a block is passed to the call, the SDK will start a state request loop that checks the state of the transcoder for a given period of time (timeout). Each iteration of the wait loop will call the block with the current state of the wait loop, and the current state of the transcoder
The wait state will be one of 3 options: :waiting, :complete or :timeout
The loop will exit when the transcoder state is “stopped” or the timeout limit is reached.
103 104 105 106 107 |
# File 'lib/wsc_sdk/modules/transcoder_shared_methods.rb', line 103 def stop(={}, &block) current_state = self.endpoint.stop(self.id) return wait_for_state(:stopped, , &block) if current_state.success? and block_given? return current_state end |
#thumbnail_url ⇒ WscSdk::Model::TranscoderThumbnailUrl
Return the url of the current thumbnail for transcoder/live stream.
166 167 168 |
# File 'lib/wsc_sdk/modules/transcoder_shared_methods.rb', line 166 def thumbnail_url return self.endpoint.thumbnail_url(self.id) end |