iOS Increase volume of each sound played - ios

I am using AVAudioSession and AVAudioPlayer calling the steps below in my code. However, the sound is not playing on my specified number.
Here is the code:
[playSoundURL1 play];
[playSoundURL1 setVolume:(0.5)];

Related

How to play a video starting from specific point on iOS 9

I'm playing video using MPMoviePlayerController and I need to play it starting from a given point by this code:
MPMoviePlayerController *player;
[player setCurrentPlaybackTime:from];
[player setInitialPlaybackTime:from];
[player setEndPlaybackTime:to];
[player prepareToPlay];
[player play];
But it doesn't work, the video always plays from beginning.
I've seen on Apple Docs that initialPlaybackTime is deprecated in iOS 9 (as well as endPlaybackTime). Does it mean than it will not work on iOS 9? I tried to run this code on iOS 8.4, but the result is the same: the video always plays from the very beginning.
How to make it play from a given point?
Thank you!
Use AVPlayer instead of MPMoviePlayer. It will give you more control over Media playback.
See this (AVPlayer)

AVFoundation playing a sound is stopped when playing background music

I play a sound with AVFoundation. No problem with that. But when I play music the sound gets stopped. There is some way to play the two sounds simultaneously?
I tried with:
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryAmbient error:nil];
before playing the sound without success.

Recording audio and video after having played video with audio

I'm building an app in which I can record video with audio input.
It works well: I use AVCaptureSession with two AVCaptureDeviceInput, one for video, one for audio.
I then record the movie with AVCaptureMovieFileOutput.
Until now, no problem, my video gets recorded, and audio is present.
But I have a problem if I try to record this video with audio input after a video (with audio) has been played (with AVPlayer). Indeed, the video gets recorded, but there is no audio!
Three things:
I have tried to put [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryRecord error:nil]; before recording, it doesn't change anything.
Any AVPlayer instance is paused before trying to record anything.
The AVPlayer instance, even if paused, is still present when I try to record (is it a problem?)
I would like to say that I have this problem on my iPhone 4, but the same app, compiled on my iPad Air, works like a charm (there is audio in my recording even after having played a video...). How is it even possible?
Fix:
Before taking video just
[self.moviePlayer replaceCurrentItemWithPlayerItem:nil];

iOS 6 AVAudioSession issue

In my application I have made [audioSession setCategory:AVAudioSessionCategoryPlayback] to play audio in back ground and also to mute other audio play backs while playing song in my application. I am playing the audio using AVPlayer and also I have UIWebView for playing video in same Application. The issue arises when I play both video in web view and audio using AVPlayer. The music mixes in this case. Prior to iOS 6 when I rech same situation one audio pauses automatically and the mixing up does not occur. So kindly suggest some solutions.
Try to set
Required background modes -> App plays audio
in Info.plist.

Resume Background Audio After Playing Sound With AVAudioPlayer

I am looking for a way to resume audio played by another application after my application plays its own sound with AVAudioPlayer. Right now, if I am listening to music and launch my application, it pauses the music, plays my sound, but doesn't resume the background music.
Here is what i'm doing to generate the sound playback:
myChime = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:#"chime" ofType:#"mp3"]] error:nil];
myChime.delegate = self;
[myChime play];
// Here I am looking to resume the audio that the system was playing before my application played its sound. I have seen many applications do this such as, GPS apps that speak a voice direction and then resume the music.
You need to properly implement the AVAudioSession delegate methods. If you set the audio session to inactive, then the system will know you are done playing your sound and will resume any other audio sessions. Refer to the Audio Session Programming Guide, especially the setActive:error: method.

Resources