Public Sub IsHeadsetPluggedIn As Boolean
Dim no As NativeObject = Me
Return no.RunMethod("isHeadsetPluggedIn", Null).AsBoolean
End Sub
#if objc
#import <AVFoundation/AVFoundation.h>
- (BOOL)isHeadsetPluggedIn {
AVAudioSessionRouteDescription* route = [[AVAudioSession sharedInstance] currentRoute];
for (AVAudioSessionPortDescription* desc in [route outputs]) {
if ([[desc portType] isEqualToString:AVAudioSessionPortHeadphones])
return YES;
}
return NO;
}
#end if