From 3f50729358f0200a6cdbcabd7df55aaa544b48a5 Mon Sep 17 00:00:00 2001 From: Imanol Fernandez Date: Tue, 14 Jan 2020 23:19:19 +0100 Subject: [PATCH] Autodetect 360 stereo projection (#2635) --- app/src/main/assets/web_extensions/webcompat_vimeo/main.js | 4 ++++ app/src/main/assets/web_extensions/webcompat_youtube/main.js | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/src/main/assets/web_extensions/webcompat_vimeo/main.js b/app/src/main/assets/web_extensions/webcompat_vimeo/main.js index 412e50046..7e3f925cf 100644 --- a/app/src/main/assets/web_extensions/webcompat_vimeo/main.js +++ b/app/src/main/assets/web_extensions/webcompat_vimeo/main.js @@ -331,6 +331,10 @@ try { if (newObjData.name === 'window.vimeo.clip_page_config') { if (configObj.clip.canvas === 1 || configObj.clip.is_spatial === true) { is360 = true; + // Detect 360 stereo videos + if (configObj.clip.title.toLowerCase().indexOf('stereo') >= 0) { + QS_DEFAULTS.mozVideoProjection = "360s_auto"; + } } configObj.clip.canvas = 1; diff --git a/app/src/main/assets/web_extensions/webcompat_youtube/main.js b/app/src/main/assets/web_extensions/webcompat_youtube/main.js index ece898e04..d439000fa 100644 --- a/app/src/main/assets/web_extensions/webcompat_youtube/main.js +++ b/app/src/main/assets/web_extensions/webcompat_youtube/main.js @@ -87,9 +87,10 @@ class YoutubeExtension { document.querySelector(YT_SELECTORS.disclaimer), document.querySelector(YT_SELECTORS.embedTitle) ]; - let is360 = targets.some((node) => node && node.textContent.includes('360')); + const is360 = targets.some((node) => node && node.textContent.includes('360')); if (is360) { - qs.set('mozVideoProjection', '360_auto'); + const stereo = targets.some((node) => node && node.textContent.toLowerCase().includes('stereo')); + qs.set('mozVideoProjection', stereo ? '360s_auto' : '360_auto'); this.updateURL(qs); this.updateVideoStyle(); logDebug(`Video projection set to: ${qs.get(VIDEO_PROJECTION_PARAM)}`);