Fix help video events

Removing the protocol broke the video player event hooks.
This commit is contained in:
Matt Lott 2015-01-29 16:45:15 -08:00
parent 5addacddf0
commit 92f070ecca

View file

@ -94,18 +94,13 @@ module.exports = class LevelGuideView extends CocoView
window.tracker?.trackEvent 'Finish help video', level: @levelID, ls: @sessionID, style: @helpVideos[@helpVideosIndex].style
@trackedHelpVideoFinish = true
# we wan't to always use the same scheme (HTTP/HTTPS) as the page was loaded with, but don't want to require Artisans to have to remember
# not to include a scheme in help video url
fixupUri = (uri) ->
n = uri.indexOf('/')
if n < 1
return uri
return uri.slice(n)
setupVideoPlayer: () ->
return unless @helpVideos.length > 0
helpVideoURL = fixupUri(@helpVideos[@helpVideosIndex].url)
@setupVimeoVideoPlayer helpVideoURL
return unless @helpVideos?.length > 0
return unless url = @helpVideos[@helpVideosIndex]?.url
# Always use HTTPS
# TODO: Not specifying the protocol should work based on Vimeo docs, but breaks postMessage/eventing in practice.
url = "https:" + url.substr url.indexOf '/'
@setupVimeoVideoPlayer url
setupVimeoVideoPlayer: (helpVideoURL) ->
# Setup Vimeo player