class Playback

Renders an isolated, narrated presentation for review and video capture.

Unlike the live display, playback owns its current slide entirely in the browser and does not update the shared presentation controller.

Definitions

def self.options_from_parameters(parameters)

Extract playback options from decoded query parameters.

Signature

parameter parameters Hash

The decoded query parameters.

returns Hash

Options suitable for passing to .new.

Implementation

def self.options_from_parameters(parameters)
	{
		autoplay: parameters["autoplay"] == "true",
		controls: parameters["controls"] != "false",
	}
end

def initialize(presentation:, recording_urls:, autoplay: false, controls: true)

Signature

parameter presentation Presentation

The presentation to play.

parameter recording_urls Array(String | Nil)

Narration URL for each slide.

parameter autoplay Boolean

Whether playback should begin when ready.

parameter controls Boolean

Whether playback controls should be visible.

Implementation

def initialize(presentation:, recording_urls:, autoplay: false, controls: true)
	@presentation = presentation
	@recording_urls = recording_urls
	@autoplay = autoplay
	@controls = controls
	@renderer = SlideRenderer.new(templates: presentation.templates)
end

def stylesheets

Signature

returns Array(Stylesheet)

The ordered presentation stylesheets.

Implementation

def stylesheets
	@presentation.stylesheets
end

def slides

Signature

returns Array(Slide)

The slides in playback order.

Implementation

def slides
	@presentation.slides
end

def recording_url(index)

Signature

returns String | Nil

The narration URL for a slide index.

Implementation

def recording_url(index)
	@recording_urls[index]
end

def render_slide(slide)

Render one slide as HTML.

Signature

parameter slide Slide

The slide to render.

returns XRB::MarkupString

Implementation

def render_slide(slide)
	@renderer.render_to_html(slide)
end

def call

Render the complete playback page.

Signature

returns String

Implementation

def call
	TEMPLATE.to_string(self)
end