From 7e5be8e05e5a4f24d527c88bf3fb43f9a379d9e2 Mon Sep 17 00:00:00 2001 From: nyanmisaka Date: Mon, 27 Jul 2020 21:11:12 +0800 Subject: [PATCH] add initial support for Edge chromium --- src/assets/img/devices/edgechromium.svg | 1 + src/components/apphost.js | 4 +++- src/components/playback/playerSelectionMenu.js | 2 +- src/scripts/browser.js | 9 +++++++-- src/scripts/browserDeviceProfile.js | 6 +++++- src/scripts/imagehelper.js | 5 +++++ src/scripts/site.js | 2 +- 7 files changed, 23 insertions(+), 6 deletions(-) create mode 100644 src/assets/img/devices/edgechromium.svg diff --git a/src/assets/img/devices/edgechromium.svg b/src/assets/img/devices/edgechromium.svg new file mode 100644 index 0000000000..14d68a5d48 --- /dev/null +++ b/src/assets/img/devices/edgechromium.svg @@ -0,0 +1 @@ +Microsoft Edge icon diff --git a/src/components/apphost.js b/src/components/apphost.js index d447c7ea45..7bb6db41b9 100644 --- a/src/components/apphost.js +++ b/src/components/apphost.js @@ -105,6 +105,8 @@ define(['appSettings', 'browser', 'events', 'htmlMediaHelper', 'webSettings', 'g deviceName = 'Sony PS4'; } else if (browser.chrome) { deviceName = 'Chrome'; + } else if (browser.edgeChromium) { + deviceName = 'Edge Chromium'; } else if (browser.edge) { deviceName = 'Edge'; } else if (browser.firefox) { @@ -291,7 +293,7 @@ define(['appSettings', 'browser', 'events', 'htmlMediaHelper', 'webSettings', 'g features.push('fileinput'); } - if (browser.chrome) { + if (browser.chrome || browser.edgeChromium) { features.push('chromecast'); } diff --git a/src/components/playback/playerSelectionMenu.js b/src/components/playback/playerSelectionMenu.js index 6e5a346c03..7799613400 100644 --- a/src/components/playback/playerSelectionMenu.js +++ b/src/components/playback/playerSelectionMenu.js @@ -121,7 +121,7 @@ export function show(button) { // Unfortunately we can't allow the url to change or chromecast will throw a security error // Might be able to solve this in the future by moving the dialogs to hashbangs - if (!(!browser.chrome || appHost.supports('castmenuhashchange'))) { + if (!(!browser.chrome && !browser.edgeChromium || appHost.supports('castmenuhashchange'))) { menuOptions.enableHistory = false; } diff --git a/src/scripts/browser.js b/src/scripts/browser.js index 5ce823f8e8..41e95fa6b4 100644 --- a/src/scripts/browser.js +++ b/src/scripts/browser.js @@ -127,7 +127,10 @@ define([], function () { var uaMatch = function (ua) { ua = ua.toLowerCase(); - var match = /(edge)[ \/]([\w.]+)/.exec(ua) || + var match = /(edg)[ \/]([\w.]+)/.exec(ua) || + /(edga)[ \/]([\w.]+)/.exec(ua) || + /(edgios)[ \/]([\w.]+)/.exec(ua) || + /(edge)[ \/]([\w.]+)/.exec(ua) || /(opera)[ \/]([\w.]+)/.exec(ua) || /(opr)[ \/]([\w.]+)/.exec(ua) || /(chrome)[ \/]([\w.]+)/.exec(ua) || @@ -190,7 +193,9 @@ define([], function () { browser[matched.platform] = true; } - if (!browser.chrome && !browser.edge && !browser.opera && userAgent.toLowerCase().indexOf('webkit') !== -1) { + browser.edgeChromium = browser.edg || browser.edga || browser.edgios; + + if (!browser.chrome && !browser.edgeChromium && !browser.edge && !browser.opera && userAgent.toLowerCase().indexOf('webkit') !== -1) { browser.safari = true; } diff --git a/src/scripts/browserDeviceProfile.js b/src/scripts/browserDeviceProfile.js index a96ee8b460..ec80147919 100644 --- a/src/scripts/browserDeviceProfile.js +++ b/src/scripts/browserDeviceProfile.js @@ -144,6 +144,10 @@ define(['browser'], function (browser) { return true; } + if (browser.edgeChromium && browser.windows) { + return true; + } + if (browser.edgeUwp) { return true; } @@ -210,7 +214,7 @@ define(['browser'], function (browser) { supported = browser.tizen; break; case 'mov': - supported = browser.tizen || browser.web0s || browser.chrome || browser.edgeUwp; + supported = browser.tizen || browser.web0s || browser.chrome || browser.edgeChromium || browser.edgeUwp; videoCodecs.push('h264'); break; case 'm2ts': diff --git a/src/scripts/imagehelper.js b/src/scripts/imagehelper.js index 03039e1428..c79f721738 100644 --- a/src/scripts/imagehelper.js +++ b/src/scripts/imagehelper.js @@ -31,6 +31,11 @@ case 'Safari iPad': case 'Safari iPhone': return baseUrl + 'safari.svg'; + case 'Edge Chromium': + case 'Edge Chromium Android': + case 'Edge Chromium iPad': + case 'Edge Chromium iPhone': + return baseUrl + 'edgechromium.svg'; case 'Edge': return baseUrl + 'edge.svg'; case 'Internet Explorer': diff --git a/src/scripts/site.js b/src/scripts/site.js index cddf2506a0..2beb45959a 100644 --- a/src/scripts/site.js +++ b/src/scripts/site.js @@ -492,7 +492,7 @@ function initClient() { if (appHost.supports('remotecontrol')) { list.push('plugins/sessionPlayer/plugin'); - if (browser.chrome || browser.opera) { + if (browser.chrome || browser.edgeChromium || browser.opera) { list.push('plugins/chromecastPlayer/plugin'); } }