Play MP4 in mobile without sound

Hi guys,

I recently deployed a level to mobile Android. The level includes some MP4 movies which are mapped as materials onto some meshes (flat screens in the level). However, for some reason, when I deploy my package to mobile the sound of the MP4 is played even though I have chosen not to have a media sound file and do not have a sound cue in my level of that movie. I’ve also not selected a sound wave in my Media asset so there’s no reason why it should play the sound of the MP4. When I do a mobile (or regular) preview in the editor, the moview plays without sound, as I expected. When I deploy to the Android mobile, the sound is playing. How can I prevent this? Anyone has experience with mobile development? Thanks in advance.

Android always plays media audio via the OS sound mixer at the moment. The MediaSoundWave is completely ignored on Android as the Android Media API doesn’t have a way to extract the audio data yet.

You should be able to disable the audio by setting the selected audio track to INDEX_NONE (or -1).

Okay, that clarifies things. Thanks a lot for your help.

Hi gmpreussner,

I tried what you proposed by adding a Set Audio Track index node and set index to -1 (or INDEX_NONE which is converted to -1) with target being a variable of type Media Sound Wave (which defaults the sound wave of the movie).

This is added right after the Open Source node. Unfortunately, the sound is still playing when I launch it on smartphone. Am I doing something wrong and/or is there anything I can do else (apart from removing the sound from the MP4 upfront which doesn’t seem to be a real future-proof solution).

Thanks for your help.

Open sets the audio track to 0 and only valid indices for audio track >= 0 are passed to the player. You could make this change in AndroidMediaTracks.cpp to FAndroidMediaTracks::SelectTrack:

case EMediaTrackType::Audio:
	if (TrackIndex == INDEX_NONE)
	{
		JavaMediaPlayer->SetAudioEnabled(false);
		SelectedAudioTrack = TrackIndex;

		return true;
	}

	if (AudioTracks.IsValidIndex(TrackIndex))
	{
		if (!JavaMediaPlayer->SelectTrack(AudioTracks[TrackIndex].Index))
		{
			return false;
		}

		JavaMediaPlayer->SetAudioEnabled(true);
		SelectedAudioTrack = TrackIndex;
		InitializeAudioSink();

		return true;
	}
	break;

This should let -1 disable audio as expected.

I’ve fixed this for 4.17 (UE-45570).

Thanks for the workaround. I removed the sound from the mp4 upfront since I had to fix it urgently but hopefully your solution could still help someone else. I do hope they fix this problem though.