Module: Helios::Videos::VideoConcern
- Extended by:
- ActiveSupport::Concern
- Included in:
- Video
- Defined in:
- app/models/concerns/helios/videos/video_concern.rb
Instance Method Summary collapse
- #check_for_processing! ⇒ Object
- #download_and_store_thumbnail!(time: "3s") ⇒ Object
- #download_url(expiration: 4.hours) ⇒ Object
-
#effective_processor ⇒ Object
Returns the processor for this specific video based on its provider column, falling back to the globally configured processor.
- #playback_url(signed: false, expiration: 4.hours) ⇒ Object
- #player_component(muted: false, expiration: 4.hours) ⇒ Object
- #requires_signed_urls? ⇒ Boolean
- #signed_url(expiration: 4.hours) ⇒ Object
- #thumbnail_url(time: "4s") ⇒ Object
Instance Method Details
#check_for_processing! ⇒ Object
59 60 61 |
# File 'app/models/concerns/helios/videos/video_concern.rb', line 59 def check_for_processing! effective_processor.ingest!(self) end |
#download_and_store_thumbnail!(time: "3s") ⇒ Object
47 48 49 |
# File 'app/models/concerns/helios/videos/video_concern.rb', line 47 def download_and_store_thumbnail!(time: "3s") effective_processor.download_thumbnail!(self, time: time) end |
#download_url(expiration: 4.hours) ⇒ Object
43 44 45 |
# File 'app/models/concerns/helios/videos/video_concern.rb', line 43 def download_url(expiration: 4.hours) effective_processor.download_url(self, expiration: expiration) end |
#effective_processor ⇒ Object
Returns the processor for this specific video based on its provider column, falling back to the globally configured processor.
23 24 25 26 27 28 29 |
# File 'app/models/concerns/helios/videos/video_concern.rb', line 23 def effective_processor if respond_to?(:provider) && provider.present? Helios::Videos.processor_for(provider.to_sym) else Helios::Videos.processor end end |
#playback_url(signed: false, expiration: 4.hours) ⇒ Object
35 36 37 |
# File 'app/models/concerns/helios/videos/video_concern.rb', line 35 def playback_url(signed: false, expiration: 4.hours) effective_processor.playback_url(self, signed: signed, expiration: expiration) end |
#player_component(muted: false, expiration: 4.hours) ⇒ Object
31 32 33 |
# File 'app/models/concerns/helios/videos/video_concern.rb', line 31 def player_component(muted: false, expiration: 4.hours) effective_processor.player_component(self, muted: muted, expiration: expiration) end |
#requires_signed_urls? ⇒ Boolean
55 56 57 |
# File 'app/models/concerns/helios/videos/video_concern.rb', line 55 def requires_signed_urls? respond_to?(:requires_signed_urls) ? super : false end |
#signed_url(expiration: 4.hours) ⇒ Object
39 40 41 |
# File 'app/models/concerns/helios/videos/video_concern.rb', line 39 def signed_url(expiration: 4.hours) playback_url(signed: true, expiration: expiration) end |
#thumbnail_url(time: "4s") ⇒ Object
51 52 53 |
# File 'app/models/concerns/helios/videos/video_concern.rb', line 51 def thumbnail_url(time: "4s") thumbnail_image.attached? ? thumbnail_image : nil end |