asciinema.org/app/views/asciicasts/_player.html.slim

40 lines
1.1 KiB
Plaintext
Raw Normal View History

2014-06-24 18:34:34 +00:00
.player
p.processing-info style="display: none"
| This recording is being pre-processed at the moment. It will open automatically in a few seconds.
javascript:
$(function() {
2014-06-24 18:34:34 +00:00
var model = new Asciinema.Asciicast(#{asciicast.html_safe});
function createPlayer() {
var source = new asciinema.HttpArraySource(model.get('stdout_frames_url'), #{options.speed});
var snapshot = model.get('snapshot');
var movie = new asciinema.Movie(model.get('width'), model.get('height'), source, snapshot, model.get('duration'));
React.renderComponent(
asciinema.Player({
fontSize: '#{options.size}',
autoPlay: #{options.autoplay},
movie: movie,
theme: '#{h options.theme}',
}),
2014-06-24 18:34:34 +00:00
$('.player')[0]
);
}
function tryCreatePlayer() {
if (model.get('stdout_frames_url')) {
$('.processing-info').remove();
createPlayer();
} else {
$('.processing-info').show();
setTimeout(function() {
model.fetch({ success: tryCreatePlayer });
}, 2000);
}
}
2013-11-18 11:04:57 +00:00
2014-06-24 18:34:34 +00:00
tryCreatePlayer();
});