Live video on the AT Protocol
1import { IsPlatform } from "./usePlatform.shared";
2// it's only for setting defaults, i promise!
3import uaParser from "ua-parser-js";
4import { topSafeHeight } from "./platform";
5
6function supportsHLS() {
7 var video = document.createElement("video");
8 return Boolean(
9 video.canPlayType("application/vnd.apple.mpegURL") ||
10 video.canPlayType("audio/mpegurl"),
11 );
12}
13
14let ua;
15
16export default function usePlatform(): IsPlatform {
17 if (!ua) {
18 const parser = uaParser.UAParser;
19 ua = parser(navigator.userAgent);
20 }
21 const electron = typeof window["SP_ELECTRON"] !== "undefined";
22 return {
23 topSafeHeight,
24 isNative: false,
25 isIOS: false,
26 isAndroid: false,
27 isWeb: true,
28 isElectron: electron,
29 isBrowser: !electron,
30 isSafari: ua.browser.name.includes("Safari"),
31 isFirefox: ua.browser.name === "Firefox",
32 isChrome: ua.browser.name === "Chrome",
33 };
34}