天天看點

問題:安卓手機插入OTG攝像頭時,如何禁用攝像頭自帶的MIC?

  最近有人問吾,安卓手機,插入OTG攝像頭以後,就沒法錄音了。吾試了一下,應該是攝像頭自帶MIC,系統給自動切換過去了。他問吾,有沒有辦法繼續在手機這邊錄音?吾試了幾個方法都沒用。具體來說:

AudioManager am = (AudioManager)getApplicationContext().getSystemService(Context.AUDIO_SERVICE);
am.setParameters("MIC_CHOOSE=1");
//am.setParameters("MIC_CHOOSE=primary_mic");
 
/*
am.setParameters("input_source=4;routing=-2147483584;format=1");
*/
 
try {
    Class audioSystemClass = Class.forName("android.media.AudioSystem");
    Method setForceUse = audioSystemClass.getMethod("setForceUse", int.class, int.class);
    setForceUse.invoke(null, 0, 0);      // setForceUse(FOR_RECORD, FORCE_NONE)
    } catch (Exception e) {
        e.printStackTrace();
    }
}      

  那麼,有沒有哪位高人能提供一個方法?

繼續閱讀