fix: PTT blur/unmute, EC button hiding robustness, PTT status indicator
This commit is contained in:
@@ -49,6 +49,8 @@ export class CallEmbed {
|
||||
|
||||
private readonly initialState: CallControlState;
|
||||
|
||||
private styleRetryObserver?: MutationObserver;
|
||||
|
||||
static getIntent(dm: boolean, ongoing: boolean): ElementCallIntent {
|
||||
if (ongoing) {
|
||||
return dm ? ElementCallIntent.JoinExistingDM : ElementCallIntent.JoinExisting;
|
||||
@@ -236,6 +238,7 @@ export class CallEmbed {
|
||||
this.disposables.forEach((disposable) => {
|
||||
disposable();
|
||||
});
|
||||
this.styleRetryObserver?.disconnect();
|
||||
this.call.stop();
|
||||
this.container.removeChild(this.iframe);
|
||||
this.control.dispose();
|
||||
@@ -263,11 +266,33 @@ export class CallEmbed {
|
||||
if (!doc) return;
|
||||
|
||||
doc.body.style.setProperty('background', 'none', 'important');
|
||||
const controls = doc.body.querySelector('[data-testid="incall_leave"]')?.parentElement
|
||||
?.parentElement;
|
||||
if (controls) {
|
||||
controls.style.setProperty('position', 'absolute');
|
||||
controls.style.setProperty('visibility', 'hidden');
|
||||
|
||||
// Inject CSS for things that can't be reliably caught by DOM timing
|
||||
if (!doc.getElementById('lotus-ec-styles')) {
|
||||
const style = doc.createElement('style');
|
||||
style.id = 'lotus-ec-styles';
|
||||
style.textContent = [
|
||||
'body { background: none !important; }',
|
||||
// Hide "using to Device key transport" status line
|
||||
'[style*="height: 0"][style*="z-index: 1"][style*="align-self: center"] { display: none !important; }',
|
||||
].join('\n');
|
||||
(doc.head ?? doc.body).appendChild(style);
|
||||
}
|
||||
|
||||
// Hide EC built-in controls (we provide our own)
|
||||
const leaveBtn = doc.body.querySelector('[data-testid="incall_leave"]');
|
||||
if (leaveBtn) {
|
||||
this.styleRetryObserver?.disconnect();
|
||||
this.styleRetryObserver = undefined;
|
||||
const controls = leaveBtn.parentElement?.parentElement;
|
||||
if (controls) {
|
||||
controls.style.setProperty('position', 'absolute');
|
||||
controls.style.setProperty('visibility', 'hidden');
|
||||
}
|
||||
} else if (!this.styleRetryObserver) {
|
||||
// Controls not in DOM yet — observe and retry when they appear
|
||||
this.styleRetryObserver = new MutationObserver(() => this.applyStyles());
|
||||
this.styleRetryObserver.observe(doc.body, { childList: true, subtree: true });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user