Skip to content
Permalink
Browse files

Added MediaPlayer code port

* Leverage ajax-fetch.wb WET ajax method with caching to minimize redundant http calls
* Used TB3.0 Progress bars with aria states
* Minized WET 3.1 CSS leveraging tranistions and events from WET 4.0
* Started hooks with new YouTube api chromeless player
* Added Progress element back into media player
* Corrected some vague variables

TODO: Captioning code port
  • Loading branch information...
masterbee committed Sep 24, 2013
1 parent bab3948 commit 99dd609f0240ab46afdeea1d8ada51d25f779642
Showing with 20 additions and 20 deletions.
  1. +20 −20 src/plugins/mediaplayer/mediaplayer.coffee
@@ -64,20 +64,20 @@ do ($ = jQuery, window, document, vapour, undef = undefined) ->
## caption tools ##

parse_html = (content) ->
s = ".wet-boew-tt"
te = content.find(s)
selector = ".wet-boew-tt"
te = content.find(selector)
captions = []
te.each ->
e = $(this)
elm = $(this)
begin = -1
end = -1
if e.attr("data-begin") isnt undef
if elm.attr("data-begin") isnt undef

#HTML5 captions (seperate attributes)
begin = parse_time(e.attr("data-begin"))
end = (if e.attr("data-end") isnt undef then parse_time(e.attr("data-end")) else parse_time(e.attr("data-dur")) + begin)
else if e.attr("data") isnt undef
json = e.attr("data")
begin = parse_time(elm.attr("data-begin"))
end = (if elm.attr("data-end") isnt undef then parse_time(elm.attr("data-end")) else parse_time(elm.attr("data-dur")) + begin)
else if elm.attr("data") isnt undef
json = elm.attr("data")

#Sanitze the JSON
json = json.replace(/(begin|dur|end)/g, "\"$1\"").replace(/'/g, "\"")
@@ -96,21 +96,21 @@ do ($ = jQuery, window, document, vapour, undef = undefined) ->
captions

parse_xml = (content) ->
s = "[begin]"
te = content.find(s)
selector = "[begin]"
te = content.find(selector)
captions = []
te.each ->
e = $(this)
elm = $(this)
begin = -1
end = -1
begin = parse_time(e.attr("begin"))
end = (if e.attr("end") isnt undef then parse_time(e.attr("end")) else parse_time(e.attr("dur")) + begin)
begin = parse_time(elm.attr("begin"))
end = (if elm.attr("end") isnt undef then parse_time(elm.attr("end")) else parse_time(elm.attr("dur")) + begin)

#Removes nested captions if any
e = e.clone()
e.find(s).detach()
elm = e.clone()
elm.find(selector).detach()
captions[captions.length] =
text: e.html()
text: elm.html()
begin: begin
end: end

@@ -148,13 +148,13 @@ do ($ = jQuery, window, document, vapour, undef = undefined) ->

update_captions = (area, seconds, captions) ->
area.empty()
c = 0
counter = 0
_clen = captions.length

while c < _clen
caption = captions[c]
while counter < _clen
caption = captions[counter]
area.append $("<div>" + caption.text + "</div>") if seconds >= caption.begin and seconds <= caption.end
c += 1
counter += 1

playerapi = (fn, args)->
switch fn

0 comments on commit 99dd609

Please sign in to comment.
You can’t perform that action at this time.