Implement HTML5 hack for google drive

Requires enabling in config.yaml
google-drive:
  html5-hack-enabled: true

Requires a recent version of node and an IPv6 address

EXPERIMENTAL
This commit is contained in:
calzoneman 2016-08-11 20:04:51 -07:00
parent d9d385f85e
commit af663bfbcf
6 changed files with 38 additions and 10 deletions

View file

@ -30,6 +30,14 @@ window.loadMediaPlayer = (data) ->
window.PLAYER = new VideoJSPlayer(data)
catch e
console.error e
else if data.type is 'gd'
try
if data.meta.html5hack
window.PLAYER = new VideoJSPlayer(data)
else
window.PLAYER = new GoogleDriveYouTubePlayer(data)
catch e
console.error e
else if data.type of TYPE_MAP
try
window.PLAYER = TYPE_MAP[data.type](data)

View file

@ -114,12 +114,13 @@ window.VideoJSPlayer = class VideoJSPlayer extends Player
# not to run until the ready() function returns.
setTimeout(->
$('#ytapiplayer .vjs-subtitles-button .vjs-menu-item').each((i, elem) ->
if elem.textContent == localStorage.lastSubtitle
textNode = elem.childNodes[0]
if textNode.textContent == localStorage.lastSubtitle
elem.click()
elem.onclick = ->
if elem.attributes['aria-selected'].value == 'true'
localStorage.lastSubtitle = elem.textContent
if elem.attributes['aria-checked'].value == 'true'
localStorage.lastSubtitle = textNode.textContent
)
, 1)
)