Class: Helios::Videos::Processor

Inherits:
Object
  • Object
show all
Defined in:
lib/helios/videos/processor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#configObject (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.

Raises:

  • (NotImplementedError)


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.

Raises:

  • (NotImplementedError)


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).

Raises:

  • (NotImplementedError)


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.

Raises:

  • (NotImplementedError)


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.

Raises:

  • (NotImplementedError)


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.

Raises:

  • (NotImplementedError)


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.

Raises:

  • (NotImplementedError)


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.

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


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).

Raises:

  • (NotImplementedError)


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