sync/player/base.coffee

37 lines
641 B
CoffeeScript
Raw Normal View History

2015-05-02 11:45:35 -05:00
window.Player = class Player
2015-04-23 21:40:08 -05:00
constructor: (data) ->
2015-05-02 11:45:35 -05:00
if not (this instanceof Player)
return new Player(data)
2015-04-23 22:24:43 -05:00
@setMediaProperties(data)
2015-04-23 21:40:08 -05:00
@paused = false
load: (data) ->
2015-04-23 22:24:43 -05:00
@setMediaProperties(data)
setMediaProperties: (data) ->
2015-04-23 21:40:08 -05:00
@mediaId = data.id
@mediaType = data.type
2015-04-23 22:24:43 -05:00
@mediaLength = data.seconds
2015-04-23 21:40:08 -05:00
play: ->
@paused = false
pause: ->
@paused = true
seekTo: (time) ->
setVolume: (volume) ->
getTime: (cb) ->
cb(0)
isPaused: (cb) ->
cb(@paused)
getVolume: (cb) ->
cb(VOLUME)
destroy: ->