Fix mirror sender and use getDisplayMedia

This commit is contained in:
hensm
2019-07-07 10:35:52 +01:00
parent 3cb928c1de
commit 43fcd5b351
4 changed files with 10 additions and 37 deletions

View File

@@ -646,39 +646,8 @@ async function onConnectShim (port: browser.runtime.Port) {
: ReceiverSelectorType.Popup);
// Media type for initial opener sender
let openerMediaType: ReceiverSelectorMediaType;
function onReceiverSelectorSelected (
ev: ReceiverSelectorSelectedEvent) {
/**
* If the media type returned from the selector has been
* changed, we need to cancel the current sender and switch
* it out for the right one.
*
* TODO: Seamlessly connect selector to the new sender
*/
if (ev.detail.mediaType !== openerMediaType) {
onReceiverSelectorCancelled();
switch (ev.detail.mediaType) {
case ReceiverSelectorMediaType.App: {
// TODO: Keep track of page apps
break;
}
case ReceiverSelectorMediaType.Screen:
case ReceiverSelectorMediaType.Tab: {
loadMirrorCastSender(tabId, frameId, ev.detail.mediaType);
break;
}
}
return;
}
port.postMessage({
subject: "shim:/selectReceiverEnd"
, data: ev.detail
@@ -781,10 +750,9 @@ async function onConnectShim (port: browser.runtime.Port) {
}
case "main:/selectReceiverBegin": {
openerMediaType = message.data.defaultMediaType;
receiverSelector.open(
Array.from(statusBridgeReceivers.values())
, openerMediaType);
, message.data.defaultMediaType);
break;
}