带有JS/TS的iframe的静音音频输出

发布于 2025-02-11 06:46:15 字数 1808 浏览 0 评论 0原文

我想在我的Angular应用中静音一个iframe音频输出。我尝试了一些解决方案,但他们对我没有工作。

这是我的iframe:

<iframe allow="camera; microphone; display-capture; autoplay; clipboard-write" src="https://meet.jit.si/a#jitsi_meet_external_api_id=0&amp;config.prejoinPageEnabled=false&amp;config.disableDeepLinking=true&amp;interfaceConfig.TOOLBAR_ALWAYS_VISIBLE=true&amp;interfaceConfig.TOOLBAR_BUTTONS=%5B%5D&amp;userInfo.displayName=%22Gustavo%20Paciente%22&amp;appData.localStorageContent=null" name="jitsiConferenceFrame0" id="jitsiConferenceFrame0" allowfullscreen="true" style="height: 778px; width: 1350px; border: 0px;"></iframe>

这是我已经尝试过的“解决方案”:

1-在这种情况下,卷属性设置为html,但是音频没有静音:

const iframe: any = document.getElementById('jitsiConferenceFrame0');
iframe.setAttribute("volume", "0");

2-在这种情况下,“ contentDocument”是null

const iframe: any = document.querySelector('iframe[id="jitsiConferenceFrame0"]');
iframe.contentDocument.getElementById("muted").checked = true;
iframe.contentWindow.speaker[0].muted = true;
iframe.contentWindow.speaker[1].muted = true;

3-在这种情况下,“ iframe.contentDocument”(第2行)为null和“ iframe.contentwindow”,但“ iframe.contentwindow.document”(第2行)也为null。

var iframe = document.getElementById('iframeId');
var innerDoc = iframe.contentDocument || iframe.contentWindow.document;
var MediaSource = innerDoc.getElementById('mediaElem');
MediaSource.muted=true;

我认为我没有解决问题,但仍然需要一些帮助。如何解决?

在这里编辑是我的 iframe对象

I want to mute an iFrame audio output in my Angular App. I tried some solutions, but they didn't work for me.

Here is my iFrame:

<iframe allow="camera; microphone; display-capture; autoplay; clipboard-write" src="https://meet.jit.si/a#jitsi_meet_external_api_id=0&config.prejoinPageEnabled=false&config.disableDeepLinking=true&interfaceConfig.TOOLBAR_ALWAYS_VISIBLE=true&interfaceConfig.TOOLBAR_BUTTONS=%5B%5D&userInfo.displayName=%22Gustavo%20Paciente%22&appData.localStorageContent=null" name="jitsiConferenceFrame0" id="jitsiConferenceFrame0" allowfullscreen="true" style="height: 778px; width: 1350px; border: 0px;"></iframe>

And here are the "solutions" I've already tried:

1 - In this case, the volume attribute is set to html, but the audios it no muted:

const iframe: any = document.getElementById('jitsiConferenceFrame0');
iframe.setAttribute("volume", "0");

2 - In this case, the "contentDocument" is null

const iframe: any = document.querySelector('iframe[id="jitsiConferenceFrame0"]');
iframe.contentDocument.getElementById("muted").checked = true;
iframe.contentWindow.speaker[0].muted = true;
iframe.contentWindow.speaker[1].muted = true;

3 - In this case, "iframe.contentDocument" (line 2) is null and "iframe.contentWindow" exists, but "iframe.contentWindow.document" (line 2) is also null.

var iframe = document.getElementById('iframeId');
var innerDoc = iframe.contentDocument || iframe.contentWindow.document;
var MediaSource = innerDoc.getElementById('mediaElem');
MediaSource.muted=true;

I think I'm not so far of getting it solved, but still need some help. How to solve it?

EDIT Here is my iframe object

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文