Add captions to embedded videos

This commit is contained in:
Omar Roth 2018-08-02 17:08:33 -05:00
parent 42405a34f1
commit a12690cbfd
3 changed files with 20 additions and 10 deletions

View file

@ -1440,6 +1440,12 @@ get "/embed/:id" do |env|
next templated "error"
end
player_response = JSON.parse(video.info["player_response"])
if player_response["captions"]?
captions = player_response["captions"]["playerCaptionsTracklistRenderer"]["captionTracks"]?.try &.as_a
end
captions ||= [] of JSON::Any
if video.info["hlsvp"]?
hlsvp = video.info["hlsvp"]