简体   繁体   English

Android MediaPlayer.snoop():如何获取未来的音频数据?

[英]Android MediaPlayer.snoop(): How do you get future audio data?

This is something that I'm guessing is impossible without weird work arounds if its possible at all. 我想如果没有这可能的话,没有怪异的解决方法,这是不可能的。 However, 然而,

How would I use snoop() (or something like it) to get audio data for the audio approximately 10 seconds in advance or for the entire audio file(s) playing in the background? 我将如何使用snoop()(或类似的东西)提前约10秒钟获取音频数据或在后台播放的整个音频文件的音频数据?

I have little to no idea how this would work. 我几乎不知道这将如何工作。 However, one idea was maybe record 10 seconds of audio + audio data (somehow) and delay the playback or just not allow it to play for those ten seconds and then play it 10 seconds later with the audio stuff already recorded. 但是,一个想法可能是录制10秒钟的音频+音频数据(以某种方式)并延迟播放,或者只是不允许它播放那10秒钟,然后在10秒钟后播放已录制的音频内容。 This sounds pretty impossible because I feel like you wouldn't be able to halt or otherwise silence audio playing from a device. 这听起来几乎是不可能的,因为我感觉您将无法停止或以其他方式使来自设备的音频播放静音。

I want to use this for a game in which the player reacts to the songs that they are playing inn their media player. 我想在游戏中使用该功能,让播放器对他们在媒体播放器中播放的歌曲做出反应。 That's why it would be useful to show the user what the audio data looks like before it actually comes up in the song. 这就是为什么在实际将音频数据显示在歌曲中之前向用户显示音频数据会很有用的原因。

Anyway, help would be greatly appreciated and it would improve the game a ton! 无论如何,将不胜感激帮助,它将大大改善游戏!

Thanks in advance, Karl 预先感谢,卡尔

The implementations it is very device dependent! 它的实现取决于设备!

Theoretically will work on all devices and Os, but far away is not true! 从理论上讲可以在所有设备和操作系统上运行,但是距离不正确!

I have used the play() in 7 device test on the 8th doesn't worked! 我在8号的7个设备测试中使用过play()无效!

Hope it helps! 希望能帮助到你!

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

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