From f0c75211fb0956e85980630363d24e8fa5d1be40 Mon Sep 17 00:00:00 2001 From: calzoneman Date: Thu, 23 Apr 2015 21:40:08 -0500 Subject: [PATCH] Start working on player rewrite --- player/.gitkeep | 0 player/base.coffee | 37 +++++++++++++++ player/videojs.coffee | 6 +++ player/youtube.coffee | 27 +++++++++++ www/js/player-new.js | 108 ++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 178 insertions(+) delete mode 100644 player/.gitkeep create mode 100644 player/base.coffee create mode 100644 player/videojs.coffee create mode 100644 player/youtube.coffee diff --git a/player/.gitkeep b/player/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/player/base.coffee b/player/base.coffee new file mode 100644 index 00000000..76b581be --- /dev/null +++ b/player/base.coffee @@ -0,0 +1,37 @@ +class Player + constructor: (data) -> + @load(data) + @paused = false + + load: (data) -> + @mediaId = data.id + @mediaType = data.type + + play: -> + @paused = false + + pause: -> + @paused = true + + seekTo: (time) -> + + setVolume: (volume) -> + + getTime: (cb) -> + cb(0) + + isPaused: (cb) -> + cb(@paused) + + getVolume: (cb) -> + cb(VOLUME) + +window.Player = Player + +window.removeOld = (replace) -> + $('#sc_volume').remove() + replace ?= $('
').addClass('embed-responsive-item') + old = $('#ytapiplayer') + replace.insertBefore(old) + old.remove() + replace.attr('id', 'ytapiplayer') diff --git a/player/videojs.coffee b/player/videojs.coffee new file mode 100644 index 00000000..0def6f76 --- /dev/null +++ b/player/videojs.coffee @@ -0,0 +1,6 @@ +class VideoJSPlayer extends Player + constructor: (data) -> + + load: (data) -> + video = $('