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
parametersHash 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
presentationPresentation The presentation to play.
-
parameter
recording_urlsArray(String | Nil) Narration URL for each slide.
-
parameter
autoplayBoolean Whether playback should begin when ready.
-
parameter
controlsBoolean 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
slideSlide 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