Quantcast
Channel: Questions in topic: "ios"
Viewing all articles
Browse latest Browse all 4709

How to Control iOS device volume with Unity?

$
0
0
I developed Enterprise App, and installed it to my iPad. the problem is that the iPad will be built in the wall, so it will not be possible to control volume button. I want to control the volume button during the exhibition. I made UIButton "-" and "+" to control the volume of the device instead of real volume button, not the Unity audio component's volume. I researched several times, so know what to do in Unity. using System.Collections; using System.Collections.Generic; using UnityEngine; using System.Runtime.InteropServices; public class IOSManager : MonoBehaviour { public static IOSManager _instance; [DllImport("__Internal")] private static extern void iosVolumeMinus(); private static extern void iosVolumePlus(); void Awake(){ _instance = this; } public void CallMinusFunc() { iosVolumeMinus(); } public void CallPlusFunc() { iosVolumePlus(); } } Well, I tried somethings and realized that MPMusicPlayerController And MPVolumeView may work, but had some problems. ![alt text][1] If I use MPMusicPlayerController, alert : 'volume' is deprecated: first deprecated in iOS 7.0 - Use MPVolumeView for volume control. If I use MPVolumeView, alert : Incomplete definition of type 'struct objc_class'. It is my first time to develop iOS app, so I don't know what is the problem. please help me.. [1]: /storage/temp/110297-captured.png

Viewing all articles
Browse latest Browse all 4709

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>