Ijkplayer: 请问ijkplayer如何设置静音,而不是关闭系统的声音

Created on 12 May 2017  ·  7Comments  ·  Source: bilibili/ijkplayer

All 7 comments

是android吗,如果是,那么可以通过上层来控制audiotrack的音量,和底层实现没有区别

iOS 如何设置静音,而不是关闭系统的声音。。静音播放,不妨碍后台音乐app播放音乐的那种。。。

有找到解决方法吗?

mMediaPlayer.setVolume(0.0f, 0.0f);

可否发送截图看一眼,为啥我这儿敲不出来这个方法

发自网易邮箱大师
在2018年03月08日 11:20,chenyayun 写道:

mMediaPlayer.setVolume(0.0f, 0.0f);


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.

可以通过设置AVaudioSession的单例的mode来将模式设置为混音,这样就可以播放两个声音

Android的静音可以如下处理:

 AudioManager mAudioManager = (AudioManager) ContextUtil.getContext().getApplicationContext().getSystemService(Context.AUDIO_SERVICE);
        if (mAudioManager != null) {
            mAudioManager.setStreamMute(AudioManager.STREAM_MUSIC, isMuted);
        }

需要注意就是Context需要使用Application的。
参考:https://zhuanlan.zhihu.com/p/20686419

Was this page helpful?
0 / 5 - 0 ratings