|
@@ -0,0 +1,77 @@
|
|
|
+export function checkWebrtcHevcSupport() {
|
|
|
+ let h265Supported = false;
|
|
|
+ try {
|
|
|
+ const codecs = RTCRtpSender.getCapabilities('video').codecs;
|
|
|
+ let codecsFound = new Set();
|
|
|
+
|
|
|
+
|
|
|
+ codecs.forEach(codec => {
|
|
|
+ if (!['video/red', 'video/ulpfec', 'video/rtx'].includes(codec.mimeType)) {
|
|
|
+ codecsFound.add(codec.mimeType.replace('video/', '').toUpperCase());
|
|
|
+ if (codec.mimeType.toLowerCase().includes('h265')) {
|
|
|
+ h265Supported = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ // Check Chrome version
|
|
|
+ let chromeVersion = null;
|
|
|
+ let isChrome = false;
|
|
|
+ const userAgent = navigator.userAgent;
|
|
|
+
|
|
|
+ if (userAgent.includes('Chrome/') && !userAgent.includes('Edg/')) {
|
|
|
+ isChrome = true;
|
|
|
+ const match = userAgent.match(/Chrome\/(\d+)/);
|
|
|
+ if (match) {
|
|
|
+ chromeVersion = parseInt(match[1]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return h265Supported;
|
|
|
+
|
|
|
+
|
|
|
+ } catch (error) {
|
|
|
+ console.error(error);
|
|
|
+ return h265Supported;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+function BorwserIsEdge(userAgent = window.navigator.userAgent)
|
|
|
+{
|
|
|
+ return /Edge/.test(userAgent) || /Edg/.test(userAgent);
|
|
|
+}
|
|
|
+
|
|
|
+function BrowserIsChrome(userAgent = window.navigator.userAgent)
|
|
|
+{
|
|
|
+ return /chrome/i.test(userAgent) && !BorwserIsEdge(userAgent);
|
|
|
+}
|
|
|
+
|
|
|
+function BrowserIsSafari(userAgent = window.navigator.userAgent)
|
|
|
+{
|
|
|
+ return /safari/i.test(userAgent) && !BorwserIsEdge(userAgent);
|
|
|
+}
|
|
|
+
|
|
|
+function BrowserIsFirefox(userAgent = window.navigator.userAgent)
|
|
|
+{
|
|
|
+ return /firefox/i.test(userAgent) ;
|
|
|
+}
|
|
|
+
|
|
|
+function BrowserIsOpera(userAgent = window.navigator.userAgent)
|
|
|
+{
|
|
|
+ return /opr\//i.test(userAgent);
|
|
|
+}
|
|
|
+
|
|
|
+function BorwserIsMobile(userAgent = window.navigator.userAgent)
|
|
|
+{
|
|
|
+ return /mobile/i.test(userAgent);
|
|
|
+}
|
|
|
+
|
|
|
+function BrowserIsIeWin7(userAgent = window.navigator.userAgent)
|
|
|
+{
|
|
|
+ return /Windows NT 6.1/i.test(userAgent) && /rv:11/i.test(userAgent);
|
|
|
+}
|
|
|
+
|
|
|
+function BrowserIsOldSafari(userAgent = window.navigator.userAgent)
|
|
|
+{
|
|
|
+ return BrowserIsSafari(userAgent) && (/Version\/8/i.test(userAgent) || /Version\/9/i.test(userAgent));
|
|
|
+}
|