Volume Control key-controlled audio stream (Setvolumecontrolstream) Description _android

Source: Internet
Author: User
When developing multimedia applications or game applications, you need to use the volume Control key to set the program's volume size. There is more than one audio stream in the Android system, and through the function setvolumecontrolstream (int streamtype) in the activity, you can set up the audio stream controlled by the volume Control key in the activity, Typically set in the OnCreate function.

There are several audio streams in Android

Audiomanager.stream_music/** The audio STREAM for MUSIC playback * *
audiomanager.stream_ring/** The audio STREAM for the phone ring * *
audiomanager.stream_alarm/** The audio STREAM for alarms * *
audiomanager.stream_notification/** The audio STREAM for notifications * *
Audiomanager.stream_system/** The audio STREAM for SYSTEM sounds * *
Audiomanager.stream_voicecall/** The audio STREAM for phone calls *

setvolumecontrolstream Function Description

void android.app.Activity. Setvolumecontrolstream (int streamtype)
suggests an audio stream whose volume should is changed by the hardware volume.

The suggested audio stream would be tied to the "window" of this activity. If the activity is switched, the stream set this is no longer the suggested stream. The client does not need to save and restore the old suggested stream value in OnPause and Onresume.

Parameters:
Streamtype the type of the audio stream whose volume should is changed by the hardware volume. It isn't guaranteed that the hardware volume controls'll always change this stream ' s volume (for example, if a In progress, it stream ' s volume may changed instead). To reset back to the default, use Audiomanager.use_default_stream_type.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.