Class: Helios::Videos::Processor
- Inherits:
-
Object
- Object
- Helios::Videos::Processor
- Defined in:
- lib/helios/videos/processor.rb
Direct Known Subclasses
Helios::Videos::Processors::Cloudflare, Helios::Videos::Processors::Mux
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
-
#delete!(video) ⇒ Object
Delete a video from the video service.
-
#download_thumbnail!(video, time: "3s") ⇒ Object
Download and store the video thumbnail.
-
#download_url(video, expiration: 4.hours) ⇒ Object
Return a downloadable MP4 URL for the video (used for migration between providers).
-
#ingest!(video) ⇒ Object
Ingest a video from its ActiveStorage URL into the video service.
-
#ingest_from_url!(video, source_url, provider:) ⇒ Object
Ingest a video from an external URL (used during migration between providers).
-
#initialize(config) ⇒ Processor
constructor
A new instance of Processor.
-
#playback_url(video, signed: false, expiration: 4.hours) ⇒ Object
Return the playback URL for a video.
-
#player_component(video, muted: false, expiration: 4.hours) ⇒ Object
Return an HTML player component for the video.
-
#ready?(video) ⇒ Boolean
Check whether a video has finished processing and is ready for playback.
-
#signed_token(video, expiration: 4.hours) ⇒ Object
Generate a signed token for the video (if supported).
Constructor Details
#initialize(config) ⇒ Processor
Returns a new instance of Processor.
6 7 8 |
# File 'lib/helios/videos/processor.rb', line 6 def initialize(config) @config = config end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
4 5 6 |
# File 'lib/helios/videos/processor.rb', line 4 def config @config end |
Instance Method Details
#delete!(video) ⇒ Object
Delete a video from the video service.
17 18 19 |
# File 'lib/helios/videos/processor.rb', line 17 def delete!(video) raise NotImplementedError, "#{self.class}#delete! must be implemented" end |
#download_thumbnail!(video, time: "3s") ⇒ Object
Download and store the video thumbnail.
55 56 57 |
# File 'lib/helios/videos/processor.rb', line 55 def download_thumbnail!(video, time: "3s") raise NotImplementedError, "#{self.class}#download_thumbnail! must be implemented" end |
#download_url(video, expiration: 4.hours) ⇒ Object
Return a downloadable MP4 URL for the video (used for migration between providers).
37 38 39 |
# File 'lib/helios/videos/processor.rb', line 37 def download_url(video, expiration: 4.hours) raise NotImplementedError, "#{self.class}#download_url must be implemented" end |
#ingest!(video) ⇒ Object
Ingest a video from its ActiveStorage URL into the video service. Should set video.key and video.playback_urls on success.
12 13 14 |
# File 'lib/helios/videos/processor.rb', line 12 def ingest!(video) raise NotImplementedError, "#{self.class}#ingest! must be implemented" end |
#ingest_from_url!(video, source_url, provider:) ⇒ Object
Ingest a video from an external URL (used during migration between providers). Unlike ingest!, this takes a source URL directly rather than using ActiveStorage. Should set new key and playback_urls on the video without changing provider.
44 45 46 |
# File 'lib/helios/videos/processor.rb', line 44 def ingest_from_url!(video, source_url, provider:) raise NotImplementedError, "#{self.class}#ingest_from_url! must be implemented" end |
#playback_url(video, signed: false, expiration: 4.hours) ⇒ Object
Return the playback URL for a video.
22 23 24 |
# File 'lib/helios/videos/processor.rb', line 22 def playback_url(video, signed: false, expiration: 4.hours) raise NotImplementedError, "#{self.class}#playback_url must be implemented" end |
#player_component(video, muted: false, expiration: 4.hours) ⇒ Object
Return an HTML player component for the video.
27 28 29 |
# File 'lib/helios/videos/processor.rb', line 27 def player_component(video, muted: false, expiration: 4.hours) raise NotImplementedError, "#{self.class}#player_component must be implemented" end |
#ready?(video) ⇒ Boolean
Check whether a video has finished processing and is ready for playback. Used by migration CheckIngestionJob to poll for readiness.
50 51 52 |
# File 'lib/helios/videos/processor.rb', line 50 def ready?(video) raise NotImplementedError, "#{self.class}#ready? must be implemented" end |
#signed_token(video, expiration: 4.hours) ⇒ Object
Generate a signed token for the video (if supported).
32 33 34 |
# File 'lib/helios/videos/processor.rb', line 32 def signed_token(video, expiration: 4.hours) raise NotImplementedError, "#{self.class}#signed_token must be implemented" end |