From df0cd3023691aff3a03d365ef13ce90821e264fe Mon Sep 17 00:00:00 2001 From: syeopite Date: Sun, 11 Apr 2021 06:09:10 -0700 Subject: Add support for VR videos through videojs-vr --- src/invidious/videos.cr | 4 ++++ src/invidious/views/components/player_sources.ecr | 4 ++++ src/invidious/views/watch.ecr | 3 ++- 3 files changed, 10 insertions(+), 1 deletion(-) (limited to 'src') 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 @@ + + @@ -12,6 +14,8 @@ + + <% if params.annotations %> 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 %> -- cgit v1.2.3