iOS video playback interface Display Volume control

Source: Internet
Author: User

In the work need to display in the video playback interface to control the volume of the slider, so learn a bit about volume control (to use the real machine)

Avplayer: Provides a Volume control API, but only supports IOS7

Avaudioplayer: Provides a volume control API that is currently supported

Mpmusicplayercontroller: Provides a Volume control API, but supports IOS7 below

MPMoviePlayerController: Seemingly does not support volume control temporarily

To use the system to play the audio with the control of the little buddies.

Use Mpvolumeview to display on the interface and to control the volume of the device by sliding the slider. The position of the slider reflects the current system audio output volume The first time it is displayed. When the user drags the slider, the update volume changes. The volume size also changes. Using the method is very simple, create mpvolumeview add to play the video interface can be displayed. (Note that you want to use true machine debugging to see the effect). The Created Volume control object is added to the view and is displayed in the location of the corresponding parent view.

The slider can be customized to suit your needs.

Mpvolumeview *volumeview = [[Mpvolumeview alloc] init];

Volumeview.frame=cgrectmake (10,20, 200, 30);

[Volumeview Setshowsvolumeslider:yes];

[Volumeview Setshowsroutebutton:no];

[Volumeview SizeToFit];

Set Slider picture

[Volumeview setvolumethumbimage:[uiimage imagenamed:@ "Pingfen_select"] forstate:uicontrolstatenormal];

You can use this method to give a background color to a thin line

[Volumeview setmaximumvolumesliderimage:[uiimage imagenamed:@ "Pingfen_select"] forstate:uicontrolstatenormal];

[Self.viewaddSubview:volumeView];

Related Article

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.