Class: AnimateIt::PublicPlayersController

Inherits:
ApplicationController show all
Defined in:
app/controllers/animate_it/public_players_controller.rb

Overview

The only production-accessible AnimateIt surface. Compositions must opt in explicitly with public_player!; all Studio and rendering controllers keep their local-environment guard.

Constant Summary collapse

AUDIO_BASE =
Rails.root.join("app/audio").freeze

Constants inherited from ApplicationController

ApplicationController::NullPolicy

Instance Method Summary collapse

Instance Method Details

#audioObject



26
27
28
29
30
31
32
33
34
# File 'app/controllers/animate_it/public_players_controller.rb', line 26

def audio
  segment = audio_segments[params[:index].to_i]
  return head :not_found unless segment

  file_path = resolve_audio_path(segment.source[:path])
  return head :not_found unless file_path

  serve_with_byte_ranges(file_path)
end

#showObject



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/controllers/animate_it/public_players_controller.rb', line 12

def show
  @props = {}
  @track_document = composition.track_document
  TrackDocumentSchema.validate!(@track_document)
  @player_manifest = composition.player_manifest
  @audio_segments = audio_segments
  @public_player = true
  @embedded_player = params[:embedded] == "1"
  @host_navigation = params[:host_navigation] == "1"
  @public_player_options = composition.public_player_options.merge(autoplay: false) if @embedded_player
  @public_player_options ||= composition.public_player_options
  render "animate_it/frames/player"
end