Sha256: 05caabb41c492693f20503a2e986b6f5308173afe42f0c2b4091a6b0362d6dd8

Contents?: true

Size: 950 Bytes

Versions: 4

Compression:

Stored size: 950 Bytes

Contents

#= require trix/watchdog/player
#= require trix/watchdog/player_view

class Trix.Watchdog.PlayerController
  constructor: (@element, @recording) ->
    @player = new Trix.Watchdog.Player @recording
    @player.delegate = this

    @view = new Trix.Watchdog.PlayerView @element
    @view.delegate = this

    @view.setLength(@player.length)
    @player.seek(0)

  play: ->
    @player.play()

  stop: ->
    @player.stop()

  playerViewDidClickPlayButton: ->
    if @player.isPlaying()
      @player.stop()
    else
      @player.play()

  playerViewDidChangeSliderValue: (value) ->
    @player.seek(value)

  playerDidSeekToIndex: (index) ->
    @view.setIndex(index)

    if snapshot = @player.getSnapshot(index)
      @view.renderSnapshot(snapshot)

    if events = @player.getEvents(index)
      @view.renderEvents(events)

  playerDidStartPlaying: ->
    @view.playerDidStartPlaying()

  playerDidStopPlaying: ->
    @view.playerDidStopPlaying()

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
vapid-0.1.3 lib/vapid/vendor/trix/src/trix/inspector/watchdog/player_controller.coffee
vapid-0.1.2 lib/vapid/vendor/trix/src/trix/inspector/watchdog/player_controller.coffee
vapid-0.1.1 lib/vapid/vendor/trix/src/trix/inspector/watchdog/player_controller.coffee
vapid-0.1.0 lib/vapid/vendor/trix/src/trix/inspector/watchdog/player_controller.coffee