2015-04-03 16:04:00 +00:00
|
|
|
<div class="player"></div>
|
2014-06-24 18:34:34 +00:00
|
|
|
|
2015-04-03 16:04:00 +00:00
|
|
|
<p class="processing-info" style="display: none">
|
|
|
|
This recording is being pre-processed at the moment. It will open automatically in a few seconds.
|
|
|
|
</p>
|
2013-09-20 21:21:25 +00:00
|
|
|
|
2015-04-03 16:04:00 +00:00
|
|
|
<script>
|
2013-09-20 21:21:25 +00:00
|
|
|
$(function() {
|
2015-04-03 16:04:00 +00:00
|
|
|
var model = new Asciinema.Asciicast(<%= asciicast.to_json.gsub('</', '<\/').html_safe %>);
|
2014-06-24 18:34:34 +00:00
|
|
|
|
|
|
|
function createPlayer() {
|
2015-04-03 16:04:00 +00:00
|
|
|
var source = new asciinema.HttpArraySource(model.get('stdout_frames_url'), <%= options.speed %>);
|
2014-06-24 18:34:34 +00:00
|
|
|
var snapshot = model.get('snapshot');
|
|
|
|
var movie = new asciinema.Movie(model.get('width'), model.get('height'), source, snapshot, model.get('duration'));
|
|
|
|
|
|
|
|
React.renderComponent(
|
2014-06-30 17:30:18 +00:00
|
|
|
asciinema.Player({
|
2015-04-03 16:04:00 +00:00
|
|
|
fontSize: '<%= options.size %>',
|
|
|
|
autoPlay: <%= options.autoplay %>,
|
|
|
|
loop: <%= options.loop %>,
|
2014-06-30 17:30:18 +00:00
|
|
|
movie: movie,
|
2015-04-03 16:04:00 +00:00
|
|
|
theme: '<%= h options.theme %>',
|
2014-06-30 17:30:18 +00:00
|
|
|
}),
|
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();
|
2013-09-20 21:21:25 +00:00
|
|
|
});
|
2015-04-03 16:04:00 +00:00
|
|
|
</script>
|