mirror of
https://github.com/hensm/fx_cast.git
synced 2026-06-10 17:49:58 +00:00
Fix unused locals and better receiver selector available media checking
This commit is contained in:
@@ -1,8 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
import { Message } from "../types";
|
||||
|
||||
|
||||
const WEBSOCKET_DAEMON_URL = "ws://localhost:9556";
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
import defaultOptions from "../defaultOptions";
|
||||
|
||||
import { ReceiverSelectorType } from "../background/receiverSelector";
|
||||
import { Message } from "../types";
|
||||
import { TypedEventTarget } from "./typedEvents";
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
"use strict";
|
||||
|
||||
import { ReceiverSelectorMediaType } from "../background/receiverSelector";
|
||||
|
||||
|
||||
export function getNextEllipsis (ellipsis: string): string {
|
||||
/* tslint:disable:curly */
|
||||
if (ellipsis === "") return ".";
|
||||
@@ -29,6 +32,28 @@ export function stringify (
|
||||
return formattedString;
|
||||
}
|
||||
|
||||
export function getMediaTypesForPageUrl (
|
||||
pageUrl: string): ReceiverSelectorMediaType {
|
||||
|
||||
let availableMediaTypes =
|
||||
ReceiverSelectorMediaType.App
|
||||
| ReceiverSelectorMediaType.Tab
|
||||
| ReceiverSelectorMediaType.Screen
|
||||
| ReceiverSelectorMediaType.File;
|
||||
|
||||
/**
|
||||
* Remove "Screen" option when on an insecure origin as
|
||||
* MediaDevices.getDisplayMedia will not exist (and legacy
|
||||
* MediaDevices.getUserMedia mediaSource constraint will
|
||||
* fail).
|
||||
*/
|
||||
if (!pageUrl.startsWith("https://")) {
|
||||
availableMediaTypes &= ~ReceiverSelectorMediaType.Screen;
|
||||
}
|
||||
|
||||
return availableMediaTypes;
|
||||
}
|
||||
|
||||
|
||||
interface WindowCenteredProps {
|
||||
width: number;
|
||||
|
||||
Reference in New Issue
Block a user