Add support for VR videos through videojs-vr

This commit is contained in:
syeopite
2021-04-11 06:09:10 -07:00
parent 8806c57c63
commit df0cd30236
6 changed files with 192 additions and 1 deletions

View File

@ -760,6 +760,10 @@ struct Video
info["microformat"]?.try &.["playerMicroformatRenderer"]["isFamilySafe"]?.try &.as_bool || false
end
def is_vr : Bool
info["streamingData"]?.try &.["adaptiveFormats"].as_a[0]?.try &.["projectionType"].as_s == "MESH" ? true : false || false
end
def wilson_score : Float64
ci_lower_bound(likes, likes + dislikes).round(4)
end

View File

@ -4,7 +4,9 @@
<link rel="stylesheet" href="/css/videojs-share.css?v=<%= ASSET_COMMIT %>">
<link rel="stylesheet" href="/css/videojs-vtt-thumbnails.css?v=<%= ASSET_COMMIT %>">
<link rel="stylesheet" href="/css/videojs-mobile-ui.css?v=<%= ASSET_COMMIT %>">
<link rel="stylesheet" href="/css/videojs-vr.css?v=<%= ASSET_COMMIT %>">
<link rel="stylesheet" href="/css/player.css?v=<%= ASSET_COMMIT %>">
<script src="/js/video.min.js?v=<%= ASSET_COMMIT %>"></script>
<script src="/js/videojs-mobile-ui.min.js?v=<%= ASSET_COMMIT %>"></script>
<script src="/js/videojs-contrib-quality-levels.min.js?v=<%= ASSET_COMMIT %>"></script>
@ -12,6 +14,8 @@
<script src="/js/videojs-markers.min.js?v=<%= ASSET_COMMIT %>"></script>
<script src="/js/videojs-share.min.js?v=<%= ASSET_COMMIT %>"></script>
<script src="/js/videojs-vtt-thumbnails.min.js?v=<%= ASSET_COMMIT %>"></script>
<script src="/js/videojs-vr.min.js?v=<%= ASSET_COMMIT %>"></script>
<% if params.annotations %>
<link rel="stylesheet" href="/css/videojs-youtube-annotations.min.css?v=<%= ASSET_COMMIT %>">

View File

@ -57,7 +57,8 @@ we're going to need to do it here in order to allow for translations.
"show_replies_text" => HTML.escape(translate(locale, "Show replies")),
"params" => params,
"preferences" => preferences,
"premiere_timestamp" => video.premiere_timestamp.try &.to_unix
"premiere_timestamp" => video.premiere_timestamp.try &.to_unix,
"vr" => video.is_vr
}.to_pretty_json
%>
</script>