Swift/macOS - force playing audio through speaker - swift

Here (link) can be found a method (related to AVAudioSession) to force playing audio through iPhone speaker. However, on macOS, there seems no such a class AVAudioSession. Is it possible to force playing audio through speaker on macOS (btw also with the max volume)? Thank you.

Related

Use camera in react native app with background audio playing? (Like a song from music app)

When recording a video or opening the camera with react native background audio is paused.
Is there a specific or recommended way to allow background audio to play when the camera is open?
I am using react-native-camera and have used react-native-image-picker previously but they do not have anything in their documentation related.
After doing some looking around, in swift there is AVAudioSession which could potentially be used on the native side?
I would love some recommendations and guidance to resolve this!

Ipod stops Playing while recording Audio

Recording the audio and playing the iPod at the same time, but iPod stops playing,while recording audio in iPhone application. Please help
This is normal, just tested it out on my iPhone 4, 5.0.1. It's probably to avoid possible interference between the output music and the mic, since, to my knowledge, the microphone and the speakers are right next to each other.

Video and headphones issue

I have a custom video player that works very well. I discovered a problem and would like to know if this is a problem of iOS or is there a way to solve. When I'm watching and listening to the video with headphones on and take off my headphones, the sound continues, but the video freezes.
I am using MPMoviePlayerController for video and AVAudioPlayer for audio.
Tks for help
You can get a callback when headphones are unplugged from the device. This might be a good starting point.
Check out this SO question: Headphones unplugged during playback cause bug on iPhone app

iPhone 4.0 problem.. MPMoviePlayerViewController , AVAudio APIs

I'm making iphone program. The main function is playing video files, and recording sound.
OS 3.1.3 version is fine. But iPhone 4.0 makes problem!!
When I executed playing video (MPMoviePlayerController) and continuously recording sound (AVAudioRecorder), AVAudioRecorder doesn't work....
No recording..! ;o;
Somebody help!!
Check the useApplicationAudioSession property on MPMoviePlayerController. In iOS 3.1.x, the movie player was always getting its own system provided audio session. In iOS 4.0, it can now share the application session, and that's the default value as well. Try switching that property to NO before starting to play your movie.

How to play audio and video together in iphone

I want to play some videos with audio from different audio files. For this i am playing a video(using MPMoviePlayerController) and i am playing an audio(using AVAudioPlayer).
When i play my code through simulator it works fine (the video with my audio file specified). When i run the application in device it doesn't work like that. It plays video but sound file is not getting played. How can i play an audio and a video together ?
This has been discussed before and I don't think anyone's figured it out yet:
Play audio and video at a same time in iPhone application
how can we play audio and video together in ipod/iphone?
Which format support the audio file with a playing video?