• <small id='geJRv'></small><noframes id='geJRv'>

    • <bdo id='geJRv'></bdo><ul id='geJRv'></ul>
    <i id='geJRv'><tr id='geJRv'><dt id='geJRv'><q id='geJRv'><span id='geJRv'><b id='geJRv'><form id='geJRv'><ins id='geJRv'></ins><ul id='geJRv'></ul><sub id='geJRv'></sub></form><legend id='geJRv'></legend><bdo id='geJRv'><pre id='geJRv'><center id='geJRv'></center></pre></bdo></b><th id='geJRv'></th></span></q></dt></tr></i><div id='geJRv'><tfoot id='geJRv'></tfoot><dl id='geJRv'><fieldset id='geJRv'></fieldset></dl></div>

    1. <tfoot id='geJRv'></tfoot>

        <legend id='geJRv'><style id='geJRv'><dir id='geJRv'><q id='geJRv'></q></dir></style></legend>

        iOS:访问设备硬件音量控制

        时间:2023-06-01
          <tbody id='tPhQg'></tbody>
            • <bdo id='tPhQg'></bdo><ul id='tPhQg'></ul>

              <small id='tPhQg'></small><noframes id='tPhQg'>

                • <legend id='tPhQg'><style id='tPhQg'><dir id='tPhQg'><q id='tPhQg'></q></dir></style></legend>
                • <tfoot id='tPhQg'></tfoot>

                  <i id='tPhQg'><tr id='tPhQg'><dt id='tPhQg'><q id='tPhQg'><span id='tPhQg'><b id='tPhQg'><form id='tPhQg'><ins id='tPhQg'></ins><ul id='tPhQg'></ul><sub id='tPhQg'></sub></form><legend id='tPhQg'></legend><bdo id='tPhQg'><pre id='tPhQg'><center id='tPhQg'></center></pre></bdo></b><th id='tPhQg'></th></span></q></dt></tr></i><div id='tPhQg'><tfoot id='tPhQg'></tfoot><dl id='tPhQg'><fieldset id='tPhQg'></fieldset></dl></div>
                  本文介绍了iOS:访问设备硬件音量控制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我已经在里面实现了这个流媒体(https://github.com/DigitalDJ/AudioStreamer)我的应用程序运行起来很棒,但是它没有实现音量控制,有人有提示如何开始使用音量滑动或其他东西吗?

                  I have implemented this streamer(https://github.com/DigitalDJ/AudioStreamer) inside my app and it runs fantastic, however it doesn't have volume controls implemented, anyone have tips how to get started with volume slide or something?

                  我正在寻找一些类似的问题:

                  I was looking trough some similar questions :

                  • iOS:更改设备音量

                  访问 iOS 设备上的硬件信息

                  iOS 系统音量控制

                  没有找到任何有用的方法来回答我的问题,如何改变音量(上/下),当然也可以将它连接到某种控件,即滑块,感谢任何帮助

                  Didn't find any of these useful to answer to my question, how to change volume(up/down) and of course hook it to some kind of control i.e. slider, any help is appreciated

                  推荐答案

                  确保将 MediaPlayer 框架添加到项目中

                  make sure you add the MediaPlayer framework to your project

                  您必须在 .h 文件中定义一个视图才能将滑块放入本例中的viewVolume"

                  you have to define a view in your .h file to put the slider in in this case "viewVolume"

                  信息:这只能在真实设备上的模拟器中运行.

                  INFO: THIS WONT WORK IN A SIMULATOR ONLY ON A REAL DEVICE.

                  #import <MediaPlayer/MediaPlayer.h>
                  
                  - (void)showTheVolumeSlider {
                  
                      MPVolumeView *volumeViewSlider = [[MPVolumeView alloc] initWithFrame:viewVolume.bounds] ;
                      [viewVolume addSubview:volumeViewSlider];
                      [volumeViewSlider sizeToFit];
                  
                  }
                  

                  此代码正在使用 ARC.

                  this code is using ARC.

                  此代码也可以使用:

                  musicPlayer = [MPMusicPlayerController iPodMusicPlayer];
                      musicPlayer.volume = slider.value;
                  

                  但是如果你想使用它,你必须创建一个系统来更新滑块,因为设备的音量是从其他地方调整的

                  but if you want to use this you have to make an system that updates the slider as the volume of the device is adjusted from an other place

                  这将适用于更新音量,但我不知道这是否是最好的方法

                  this wil work for updating the volume but i don't know if it's the best way

                    timer = [NSTimer scheduledTimerWithTimeInterval:0.01 target:self selector:@selector(updateSound) userInfo:nil repeats:YES];
                  

                  这个来更新 UISlider:

                  this to update the UISlider:

                  - (void)updateSound {
                  
                      musicPlayer = [MPMusicPlayerController iPodMusicPlayer];
                      slider.value = musicPlayer.volume;
                      // value from 0.0 to 1.0
                  
                  }
                  

                  这篇关于iOS:访问设备硬件音量控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:如何使用 iOS SDK 修剪视频文件并转换为 15 秒视频 下一篇:SecTrustEvaluate 始终使用 SecPolicyCreateSSL 返回 kSecT

                  相关文章

                  最新文章

                  <i id='FfyMZ'><tr id='FfyMZ'><dt id='FfyMZ'><q id='FfyMZ'><span id='FfyMZ'><b id='FfyMZ'><form id='FfyMZ'><ins id='FfyMZ'></ins><ul id='FfyMZ'></ul><sub id='FfyMZ'></sub></form><legend id='FfyMZ'></legend><bdo id='FfyMZ'><pre id='FfyMZ'><center id='FfyMZ'></center></pre></bdo></b><th id='FfyMZ'></th></span></q></dt></tr></i><div id='FfyMZ'><tfoot id='FfyMZ'></tfoot><dl id='FfyMZ'><fieldset id='FfyMZ'></fieldset></dl></div>
                  1. <small id='FfyMZ'></small><noframes id='FfyMZ'>

                    <legend id='FfyMZ'><style id='FfyMZ'><dir id='FfyMZ'><q id='FfyMZ'></q></dir></style></legend>
                  2. <tfoot id='FfyMZ'></tfoot>
                      • <bdo id='FfyMZ'></bdo><ul id='FfyMZ'></ul>