How can we play audio and video together on ipod / iphone?

Hi all

I play video (.mp4 format) without sound (I mean that it has no sound, this is a dumb video), and in the background I play an audio file (.mp3 format), when I play my code through the simulator it is excellent It works as I want, when I click on the video, it’s just turned off, but I play a sound behind, so for the user it seems that the video has this sound, but when I installed my code on the device and played the video, than it so that it plays video, but without sound, how can I play audio and video together in the above format?

in fact, we do not just play one video or audio file that it just comes from the array, randomly choosing the same for the audio file so that we cannot do this, I think that any other idea for him ??

Should we use a different aur video audio format for this? thanks for the help

Balraj verma

+3
source share
5 answers

The problem is that the default audio recording does not allow you to mix sound.

In the help library ( Working with video players ), they say that for an audio session you should use a mixed configuration of categories, such as the Surrounding category. In application deletion:

AVAudioSession *audioSession = [AVAudioSession sharedInstance];
NSError *setCategoryError = nil;
[audioSession setCategory:AVAudioSessionCategoryAmbient error: &setCategoryError];
+3
source

Apple , - . . .

PCM, .

, mp3 iPhone 3G 3GS. , .

+1

You must combine audio and video with some video editing software such as iMovie or Windows Movie Maker. Using software for composite audio and video together is not a good idea and adds extra overhead, synchronization problems, etc.

0
source

As far as I know, you cannot play AVAudioPlayer and MPMoviePlayer files at the same time.

0
source

Source: https://habr.com/ru/post/1713880/


All Articles