如何提高媒体播放器的音量 [英] How to increase volume of mediaPlayer

查看:198
本文介绍了如何提高媒体播放器的音量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写,在某些情况下,警告用户并发出警报声的应用程式。我的问题是,在媒体播放某些情况下容积可由用户甚至媒体减小体积沉默。我想以编程方式检查卷并将其提高到100%,然后打报警。

I am writing an app that in some situations warns user with an alarm sound. My problem is that in some situation volume of media playing may be decreased by user or even media volume is silent. I want to check the volume programatically and increase it to 100% and then play alarm.

你知道吗?请注意,我已经测试 mediaPlayer.setVolume(1,1)并没有什么改变。

Any idea? Note that I have tested mediaPlayer.setVolume(1,1) and nothing changed.

推荐答案

这是不是设置音量的功能。
这里它的体积的任何值的设置:

This isn't the function for setting the volume. Here it's the setting of the volume to any value:

AudioManager audioManager = (AudioManager) this.getSystemService(Context.AUDIO_SERVICE);
// For example to set the volume of played media to maximum.
audioManager.setStreamVolume (AudioManager.STREAM_MUSIC, audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC),0);

这篇关于如何提高媒体播放器的音量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆