sync/player/base.coffee

35 lines
624 B
CoffeeScript
Raw Normal View History

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