mirror of
https://github.com/hensm/fx_cast.git
synced 2026-06-10 09:39:58 +00:00
Filter receiver list depending on capabilities in session request
This commit is contained in:
@@ -6,7 +6,7 @@ import { TypedEventTarget } from "../lib/TypedEventTarget";
|
||||
|
||||
import { Message, Port } from "../messaging";
|
||||
import { ReceiverDevice, ReceiverDeviceCapabilities } from "../types";
|
||||
import { ReceiverStatus } from "../cast/api/types";
|
||||
import { ReceiverStatus } from "../cast/sdk/types";
|
||||
|
||||
interface EventMap {
|
||||
receiverDeviceUp: { deviceInfo: ReceiverDevice };
|
||||
@@ -84,16 +84,6 @@ export default new (class extends TypedEventTarget<EventMap> {
|
||||
case "main:receiverDeviceUp": {
|
||||
const { deviceId, deviceInfo } = message.data;
|
||||
|
||||
// TODO: Add proper support for Chromecast Audio devices
|
||||
if (
|
||||
!(
|
||||
deviceInfo.capabilities &
|
||||
ReceiverDeviceCapabilities.VIDEO_OUT
|
||||
)
|
||||
) {
|
||||
break;
|
||||
}
|
||||
|
||||
this.receiverDevices.set(deviceId, deviceInfo);
|
||||
this.dispatchEvent(
|
||||
new CustomEvent("receiverDeviceUp", {
|
||||
|
||||
@@ -6,6 +6,7 @@ import options from "../../lib/options";
|
||||
|
||||
import { TypedEventTarget } from "../../lib/TypedEventTarget";
|
||||
import { ReceiverDevice } from "../../types";
|
||||
import { SessionRequest } from "../../cast/sdk/classes";
|
||||
|
||||
import {
|
||||
ReceiverSelectionCast,
|
||||
@@ -26,6 +27,7 @@ export interface PageInfo {
|
||||
url: string;
|
||||
tabId: number;
|
||||
frameId: number;
|
||||
sessionRequest?: SessionRequest;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,6 +4,7 @@ import options from "../../lib/options";
|
||||
import logger from "../../lib/logger";
|
||||
|
||||
import CastManager from "../../cast/CastManager";
|
||||
import { SessionRequest } from "../../cast/sdk/classes";
|
||||
import receiverDevices from "../receiverDevices";
|
||||
|
||||
import { getMediaTypesForPageUrl } from "../../lib/utils";
|
||||
@@ -47,7 +48,10 @@ async function getSelector() {
|
||||
async function getSelection(
|
||||
contextTabId: number,
|
||||
contextFrameId = 0,
|
||||
selectionOpts?: { withMediaSender?: boolean }
|
||||
selectionOpts?: {
|
||||
sessionRequest: SessionRequest;
|
||||
withMediaSender?: boolean;
|
||||
}
|
||||
): Promise<ReceiverSelection | null> {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
let castInstance = CastManager.getInstance(
|
||||
@@ -220,7 +224,8 @@ async function getSelection(
|
||||
? {
|
||||
url: pageUrl,
|
||||
tabId: contextTabId,
|
||||
frameId: contextFrameId
|
||||
frameId: contextFrameId,
|
||||
sessionRequest: selectionOpts?.sessionRequest
|
||||
}
|
||||
: undefined;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user