简体   繁体   English

窃听(聚焦)音频流android

[英]eavesdrop on (focussed) audio stream android

Despite reading everything I can on developer.android.com and stackoverflow I cannot figure out how to do this, though I really think it should be possible. 尽管阅读了我能在developer.android.com和stackoverflow上获得的所有内容,但是我确实认为应该可以实现,但是我仍然不知道该怎么做。

I'm trying to make a generic "visualizer"-style app using OpenGL ES 2.0. 我正在尝试使用OpenGL ES 2.0制作通用的“可视化工具”风格的应用程序。 I would like to be able to eavesdrop on whatever audio stream currently has focus so that I can respond to the music. 我希望能够监听当前所关注的任何音频流,以便对音乐做出反应。 The device should be able to play music from any app they want, but then open my app and have it respond. 该设备应该能够播放他们想要的任何应用程序中的音乐,然后打开我的应用程序并使其响应。

So far I've found plenty of ways to play, record, stream, etc. audio from a known source. 到目前为止,我已经找到了许多从已知来源播放,记录,流式传输音频的方法。 However, I cannot figure out how to eavesdrop on the device. 但是,我无法弄清楚如何在设备上进行窃听。 On the mac this is as simple as inserting an audio unit at the hardware side. 在Mac上,这就像在硬件端插入音频单元一样简单。 Is there anything similar in android? android中有类似的东西吗? Or does sandboxing prevent this entirely? 还是沙箱完全阻止了这种情况?

Here's another way of looking that this issue. 这是解决该问题的另一种方法。 Suppose the OS let you do this. 假设操作系统允许您执行此操作。 Suppose there was an API that let you do 假设有一个API可以让您

Audio.doEavesDrop(EavesDrop callback)

Now, imagine what some of the negative consequences could be: 现在,想象一下一些负面后果可能是:

  • hanging the audio stream. 悬挂音频流。 That callback has return control at sometime, what if it doesn't for some reason? 该回调在某个时候具有返回控制权,如果由于某种原因没有返回该怎么办? What happens to the audio stream? 音频流会怎样?

  • maliciously eaves dropping: your employer or a blackmailer, or someone else who wants to invade your privacy uses this to capture every sound your phone outputs 恶意窃听:您的雇主或敲诈者,或其他想要侵犯您隐私的人,会利用它捕获电话输出的所有声音

If you were designing the platform how would you defend against this issues (and these are only the ones I could think of in a few minutes). 如果您正在设计平台,您将如何防御这一问题(而这些只是我几分钟内想到的问题)。

Do you think this should be possible? 您认为这应该可行吗? Maybe it isn't and there is(are) good reason(s) for it. 也许不是,并且有充分的理由。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM