summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorsyeopite <syeopite@syeopite.dev>2021-04-11 06:09:10 -0700
committersyeopite <syeopite@syeopite.dev>2021-05-23 09:22:29 -0700
commitdf0cd3023691aff3a03d365ef13ce90821e264fe (patch)
treedb75bc6503cd6ba7e0132a984b388d94a0a5c89a /src
parent8806c57c63b2d3cba9969a9c4f56eb1e43f96cb4 (diff)
downloadinvidious-df0cd3023691aff3a03d365ef13ce90821e264fe.tar.gz
invidious-df0cd3023691aff3a03d365ef13ce90821e264fe.tar.bz2
invidious-df0cd3023691aff3a03d365ef13ce90821e264fe.zip
Add support for VR videos through videojs-vr
Diffstat (limited to 'src')
-rw-r--r--src/invidious/videos.cr4
-rw-r--r--src/invidious/views/components/player_sources.ecr4
-rw-r--r--src/invidious/views/watch.ecr3
3 files changed, 10 insertions, 1 deletions
diff --git a/src/invidious/videos.cr b/src/invidious/videos.cr
index bf281507..061668a1 100644
--- a/src/invidious/videos.cr
+++ b/src/invidious/videos.cr
@@ -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
diff --git a/src/invidious/views/components/player_sources.ecr b/src/invidious/views/components/player_sources.ecr
index a99fdbca..a146e5a9 100644
--- a/src/invidious/views/components/player_sources.ecr
+++ b/src/invidious/views/components/player_sources.ecr
@@ -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 %>">
diff --git a/src/invidious/views/watch.ecr b/src/invidious/views/watch.ecr
index 8b587eb3..baffa08b 100644
--- a/src/invidious/views/watch.ecr
+++ b/src/invidious/views/watch.ecr
@@ -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>