Auto-adjusting of poster to given t

rails
Marcin Kulik 8 years ago
parent dfde97417f
commit 4d9c9ff0c5

@ -8,7 +8,7 @@ function tryCreatePlayer(parentNode, asciicast, options) {
{
width: asciicast.width,
height: asciicast.height,
snapshot: asciicast.snapshot,
poster: options.poster || asciicast.snapshot,
speed: options.speed,
autoPlay: options.autoPlay,
loop: options.loop,

@ -1,3 +1,12 @@
class EmbedPlaybackOptions < PlaybackOptions
attribute :autoplay, Boolean, default: false
def as_json(*)
if !poster && t && t > 0
super.merge({ poster: "npt:#{t}" })
else
super
end
end
end

@ -22,6 +22,7 @@ class PlaybackOptions
attribute :theme, String, default: Theme::DEFAULT
attribute :t, Time
attribute :v0, Boolean, default: false
attribute :poster, String
def as_json(*)
opts = {
@ -31,6 +32,7 @@ class PlaybackOptions
preload: preload,
fontSize: size,
theme: theme,
poster: poster,
}
if t

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save