【问题标题】:Accessing microphone from firefox add-on从 Firefox 插件访问麦克风
【发布时间】:2016-01-12 07:25:57
【问题描述】:

我正在探索wit.ai 并想在 Firefox 插件中试用它。我关注了这个网络快速入门guide,它解释了如何在网页中实现。

如果我将它作为网页运行,firefox 会弹出麦克风权限,但是当我实现与附加组件相同的权限时,firefox 不会弹出权限并且来自 javascript 的日志说,麦克风正在连接,这意味着它仍然没有权限。

如何获得从 Firefox 插件访问麦克风的权限?

【问题讨论】:

    标签: firefox firefox-addon firefox-addon-sdk


    【解决方案1】:

    我实际上也在做同样的事情。

    这是怎么做的 - https://github.com/Noitidart/FoxSpeak/issues/4

    我们在这里看到 - https://dxr.mozilla.org/mozilla-central/source/browser/modules/webrtcUI.jsm#170

      receiveMessage: function(aMessage) {
        switch (aMessage.name) {
    
          // Add-ons can override stock permission behavior by doing:
          //
          //   var stockReceiveMessage = webrtcUI.receiveMessage;
          //
          //   webrtcUI.receiveMessage = function(aMessage) {
          //     switch (aMessage.name) {
          //      case "rtcpeer:Request": {
          //        // new code.
          //        break;
          //      ...
          //      default:
          //        return stockReceiveMessage.call(this, aMessage);
          //
          // Intercepting gUM and peerConnection requests should let an add-on
          // limit PeerConnection activity with automatic rules and/or prompts
          // in a sensible manner that avoids double-prompting in typical
          // gUM+PeerConnection scenarios. For example:
    

    他们允许插件在这里注入。我没有时间完成这个,但如果你在我之前完成,请分享。 :)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-03-06
      • 2019-08-28
      • 2010-09-16
      • 1970-01-01
      • 2019-03-27
      • 1970-01-01
      相关资源
      最近更新 更多