mirror of
https://github.com/hensm/fx_cast.git
synced 2026-06-09 17:19:59 +00:00
Fix media casting handling unified receiver selector
This commit is contained in:
@@ -7,6 +7,8 @@ import StatusManager from "../StatusManager";
|
||||
|
||||
import { getMediaTypesForPageUrl } from "../../lib/utils";
|
||||
|
||||
import { DEFAULT_MEDIA_RECEIVER_APP_ID } from "../../shim/cast/media/";
|
||||
|
||||
import { ReceiverSelector
|
||||
, ReceiverSelectorType } from "./";
|
||||
import { ReceiverSelection
|
||||
@@ -53,7 +55,8 @@ async function getSelector () {
|
||||
*/
|
||||
async function getSelection (
|
||||
contextTabId: number
|
||||
, contextFrameId = 0)
|
||||
, contextFrameId = 0
|
||||
, withMediaSender = false)
|
||||
: Promise<ReceiverSelection> {
|
||||
|
||||
return new Promise(async (resolve, reject) => {
|
||||
@@ -77,7 +80,7 @@ async function getSelection (
|
||||
}
|
||||
|
||||
// Enable app media type if initialized sender app is found
|
||||
if (currentShim) {
|
||||
if (currentShim || withMediaSender) {
|
||||
defaultMediaType = ReceiverSelectorMediaType.App;
|
||||
availableMediaTypes |= ReceiverSelectorMediaType.App;
|
||||
}
|
||||
@@ -96,7 +99,6 @@ async function getSelection (
|
||||
availableMediaTypes &= ~ReceiverSelectorMediaType.File;
|
||||
}
|
||||
|
||||
|
||||
// Close an existing open selector
|
||||
if (sharedSelector && sharedSelector.isOpen) {
|
||||
sharedSelector.close();
|
||||
@@ -128,7 +130,8 @@ async function getSelection (
|
||||
Array.from(StatusManager.getReceivers())
|
||||
, defaultMediaType
|
||||
, availableMediaTypes
|
||||
, currentShim?.requestedAppId);
|
||||
, currentShim?.requestedAppId
|
||||
?? (withMediaSender && DEFAULT_MEDIA_RECEIVER_APP_ID));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user