|
|
@ -1,7 +1,8 @@
|
|
|
|
class AsciiIo.PlayerView extends Backbone.View
|
|
|
|
class AsciiIo.PlayerView extends Backbone.View
|
|
|
|
|
|
|
|
|
|
|
|
initialize: (options) ->
|
|
|
|
initialize: (options) ->
|
|
|
|
@movie = new AsciiIo.Movie(@model, options.autoPlay)
|
|
|
|
@movie = new AsciiIo.Movie(@model)
|
|
|
|
|
|
|
|
@movie.on 'movie-loaded', @onMovieLoaded, this
|
|
|
|
@movie.load()
|
|
|
|
@movie.load()
|
|
|
|
|
|
|
|
|
|
|
|
@terminalView = new AsciiIo.TerminalView(
|
|
|
|
@terminalView = new AsciiIo.TerminalView(
|
|
|
@ -12,7 +13,6 @@ class AsciiIo.PlayerView extends Backbone.View
|
|
|
|
@vt = new AsciiIo.VT(options.cols, options.lines, @terminalView)
|
|
|
|
@vt = new AsciiIo.VT(options.cols, options.lines, @terminalView)
|
|
|
|
|
|
|
|
|
|
|
|
@createChildViews()
|
|
|
|
@createChildViews()
|
|
|
|
@bindEvents()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
createChildViews: ->
|
|
|
|
createChildViews: ->
|
|
|
|
@$el.append(@terminalView.$el)
|
|
|
|
@$el.append(@terminalView.$el)
|
|
|
@ -22,6 +22,17 @@ class AsciiIo.PlayerView extends Backbone.View
|
|
|
|
@hudView = new AsciiIo.HudView()
|
|
|
|
@hudView = new AsciiIo.HudView()
|
|
|
|
@$el.append(@hudView.$el)
|
|
|
|
@$el.append(@hudView.$el)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onMovieLoaded: (asciicast) ->
|
|
|
|
|
|
|
|
@terminalView.hideLoadingIndicator()
|
|
|
|
|
|
|
|
@hudView.setDuration(asciicast.get('duration'))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@bindEvents()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if @options.autoPlay
|
|
|
|
|
|
|
|
@movie.play()
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
@terminalView.showToggleOverlay()
|
|
|
|
|
|
|
|
|
|
|
|
bindEvents: ->
|
|
|
|
bindEvents: ->
|
|
|
|
@terminalView.on 'terminal-click', =>
|
|
|
|
@terminalView.on 'terminal-click', =>
|
|
|
|
@movie.togglePlay()
|
|
|
|
@movie.togglePlay()
|
|
|
@ -32,12 +43,6 @@ class AsciiIo.PlayerView extends Backbone.View
|
|
|
|
@hudView.on 'hud-seek-click', (percent) =>
|
|
|
|
@hudView.on 'hud-seek-click', (percent) =>
|
|
|
|
@movie.seek(percent)
|
|
|
|
@movie.seek(percent)
|
|
|
|
|
|
|
|
|
|
|
|
@movie.on 'movie-loaded', (asciicast) =>
|
|
|
|
|
|
|
|
@terminalView.hideLoadingIndicator()
|
|
|
|
|
|
|
|
@hudView.setDuration(asciicast.get('duration'))
|
|
|
|
|
|
|
|
unless @options.autoPlay
|
|
|
|
|
|
|
|
@terminalView.showToggleOverlay()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@movie.on 'movie-playback-paused', =>
|
|
|
|
@movie.on 'movie-playback-paused', =>
|
|
|
|
@hudView.onPause()
|
|
|
|
@hudView.onPause()
|
|
|
|
|
|
|
|
|
|
|
|