How to Control iOS device volume with Unity?
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.
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..
Your answer
Follow this Question
Related Questions
Using .framework for iOS as Plugin. 0 Answers
Flutter Unity iOS Build Undefined symbols for architecture arm64: 0 Answers
How to build IOS library using NativeRenderingPlugin 0 Answers
Cross platform native plugin - AskForReviewNow unresponsive on TestFlight 0 Answers
Error when importing Framework natively to Xcode swift 0 Answers